Download Jar. Uses 3874K of libraries. Click here for Pure Java version (10984L/80K).
1 | !7 |
2 | |
3 | p-exp { |
4 | for (Pair<S> p : ll( |
5 | pair("I called my mother", "I called my brother"), |
6 | pair("It's time for tea", "What time is it"))) { |
7 | print("\n" + p); |
8 | PTElement tree1 = ai_parseBottomUpToTree(p.a); |
9 | PTElement tree2 = ai_parseBottomUpToTree(p.b); |
10 | |
11 | L<Pair<O>> matches = ai_matchParseTrees_v2(tree1, tree2); |
12 | //pnl(flattenListOfPairs(matches)); |
13 | |
14 | // Quick&Dirty matching using PTElement/WeightedProduction.toString() |
15 | matches = dropPairsWithSameToStringOnBothSidesIC(matches); |
16 | |
17 | //print("\nSimplified."); |
18 | pnl(map(func(O o) -> S { |
19 | O oo = o instanceof Pair ? second(o/Pair) : o; |
20 | ret oo instanceof PTElement ? str(o) + " (depth=" + ptElement_depth(oo/PTElement) + ")" : str(o); |
21 | }, flattenListOfPairs(matches))); |
22 | } |
23 | } |
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: | 454 / 1054 |
Version history: | 7 change(s) |
Referenced in: | [show references] |