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

31
LINES

< > BotCompany Repo | #1017421 // Scan 2 parse trees in parallel Spike [OK]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 3874K of libraries. Click here for Pure Java version (11000L/80K).

!7

p-exp {
  PTElement tree1 = ai_parseBottomUpToTree("I called my mother");
  PTElement tree2 = ai_parseBottomUpToTree("I called my brother");
  
  print();
  matchTrees(tree1, tree2);
}

svoid matchTrees(PTElement a, PTElement b) {
  PTElement a2 = ai_parseTree_descendToComposite(a);
  PTElement b2 = ai_parseTree_descendToComposite(b);
  
  if (isNull(a2) != isNull(b2))
    ret with print("Composite vs non-composite: " + or(a2, a) + " / " + or(b2, b));
    
  if (a2 == null) {
    print("Non-composites: " + a);
    print("                " + b);
    ret;
  }
    
  print("Composites: " + a2);
  print("            " + b2);
  temp tempIndent();
  print();
  matchTrees(first(a2.children), first(b2.children));
  print();
  matchTrees(second(a2.children), second(b2.children));
}

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: #1017421
Snippet name: Scan 2 parse trees in parallel Spike [OK]
Eternal ID of this version: #1017421/12
Text MD5: 9a4ae7935f88b9bdd0a86348e4fa0604
Transpilation MD5: cf4e9628937d639bce21e351acfd8a64
Author: stefan
Category: javax / a.i.
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-20 14:43:07
Source code size: 817 bytes / 31 lines
Pitched / IR pitched: No / No
Views / Downloads: 415 / 978
Version history: 11 change(s)
Referenced in: #1017425 - Test ai_matchParseTrees