Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

19
LINES

< > BotCompany Repo | #1017743 // ai_extractEntities_v1 - extracts <noun> phrases from ai_parseToCulledTree

JavaX fragment (include)

static L<PTElement> ai_extractEntities_v1(S input) {
  if (startsWith(input, "!")) ret emptyList(); // skip commands
  input = ai_lookupCurlyCheatSheet(input);
  ret ai_extractEntities_v1(ai_parseToCulledTree(input));
}

static L<PTElement> ai_extractEntities_v1(PTElement tree) {
  new HashSet<PTElement> toSkip;
  new L<PTElement> out;
  for (PTElement e : ai_scanParseTreeForCategory(tree, "<noun>")) {
    if (toSkip.contains(e)) continue;
    //print("Entity found: " + e.text());
    out.add(e);
    PTElement ee = ai_parseTree_simplifyNode(e);
    if (ee != null && ee != e)
      toSkip.add(ee);
  }
  ret out;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1017743
Snippet name: ai_extractEntities_v1 - extracts <noun> phrases from ai_parseToCulledTree
Eternal ID of this version: #1017743/7
Text MD5: b6312a2c618cf590e5f420bca3b8c129
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-09-25 14:16:27
Source code size: 638 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 316 / 377
Version history: 6 change(s)
Referenced in: [show references]