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)

1  
// e.g."if a snippet contains token X, it also contains token Y";
2  
static NLABlock ai_pronounResolvedToNLA(S s) {
3  
  s = ai_dropFillers1(s);
4  
  print(s);
5  
  AI_PronounResolver1 resolver = new(s);
6  
  resolver.run();
7  
  print(resolver.nounPhrases);
8  
  print(resolver.pronouns);
9  
  
10  
  for (Map mapping : resolver.allMappings()) {
11  
    L<ParsedWithTokens> pwt = replaceElementsUsingMap(resolver.pwt, mapping);
12  
    pnl(pwt);
13  
  
14  
    new NLABlock nla;
15  
    new Map<ParsedWithTokens, NLABlock.Entity> entityMapping;
16  
    for (ParsedWithToken p : values(mapping)) {
17  
      S name = (S) t!;
18  
      NLABlock.Line line = nla.new Line("there is " + name);
19  
      nla.lines.add(line);
20  
      NLABlock.Entity e = nla.new Entity(name, line);
21  
      nla.entities.add(e);
22  
      entityMapping.put(p, e);
23  
    }
24  
    replaceElementsUsingMap(pwt, entityMapping);
25  
    nla.lines.add();
26  
  }
27  
}

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: 111 / 140
Referenced in: [show references]