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

23
LINES

< > BotCompany Repo | #1017430 // Test ai_matchParseTrees_v2 (OK)

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

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

!7

p-exp {
  for (Pair<S> p : ll(
    pair("I called my mother", "I called my brother"),
    pair("It's time for tea", "What time is it"))) {
    print("\n" + p);
    PTElement tree1 = ai_parseBottomUpToTree(p.a);
    PTElement tree2 = ai_parseBottomUpToTree(p.b);
    
    L<Pair<O>> matches = ai_matchParseTrees_v2(tree1, tree2);
    //pnl(flattenListOfPairs(matches));
    
    // Quick&Dirty matching using PTElement/WeightedProduction.toString()
    matches = dropPairsWithSameToStringOnBothSidesIC(matches);
    
    //print("\nSimplified.");
    pnl(map(func(O o) -> S {
      O oo = o instanceof Pair ? second(o/Pair) : o;
      ret oo instanceof PTElement ? str(o) + " (depth=" + ptElement_depth(oo/PTElement) + ")" : str(o);
    }, flattenListOfPairs(matches)));
  }
}

Author comment

Began life as a copy of #1017425

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: #1017430
Snippet name: Test ai_matchParseTrees_v2 (OK)
Eternal ID of this version: #1017430/8
Text MD5: 1a13da522b2181cadb839688c94ec2cc
Transpilation MD5: e761917c0b74630b34da2e21e3364207
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 15:37:50
Source code size: 801 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 299 / 652
Version history: 7 change(s)
Referenced in: [show references]