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

27
LINES

< > BotCompany Repo | #1028862 // ai_pronounResolvedToNLA [abandoned version]

JavaX fragment (include)

// e.g."if a snippet contains token X, it also contains token Y";
static NLABlock ai_pronounResolvedToNLA(S s) {
  s = ai_dropFillers1(s);
  print(s);
  AI_PronounResolver1 resolver = new(s);
  resolver.run();
  print(resolver.nounPhrases);
  print(resolver.pronouns);
  
  for (Map mapping : resolver.allMappings()) {
    L<ParsedWithTokens> pwt = replaceElementsUsingMap(resolver.pwt, mapping);
    pnl(pwt);
  
    new NLABlock nla;
    new Map<ParsedWithTokens, NLABlock.Entity> entityMapping;
    for (ParsedWithToken p : values(mapping)) {
      S name = (S) t!;
      NLABlock.Line line = nla.new Line("there is " + name);
      nla.lines.add(line);
      NLABlock.Entity e = nla.new Entity(name, line);
      nla.entities.add(e);
      entityMapping.put(p, e);
    }
    replaceElementsUsingMap(pwt, entityMapping);
    nla.lines.add();
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028862
Snippet name: ai_pronounResolvedToNLA [abandoned version]
Eternal ID of this version: #1028862/1
Text MD5: a1988ae4682da738b035542f2f1a46c4
Author: stefan
Category: javax / nla
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-10 15:12:23
Source code size: 876 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 208 / 241
Referenced in: [show references]