1 | static void ai_buParser1_reconstructGrouping(AI_BottomUpParser1 parser, AI_BottomUpParser1.Word group, S category) {
|
2 | if (!group.isGroup()) ret; |
3 | |
4 | MultiMap<S> superClasses = reverseMultiMap(parser.subClasses); |
5 | Set<S> classes = makeHull_optimized(superClasses, category); |
6 | print("Starting class " + category + ", found classes: " + classes);
|
7 | |
8 | // a + b = c |
9 | for (S a : keys(parser.groupingsByA)) |
10 | for (PairS bAndC : parser.groupingsByA.get(a)) {
|
11 | S b = bAndC.a, c = bAndC.b; |
12 | if (contains(classes, c)) {
|
13 | print("Possible production: " + a + " + " + b + " = " + c);
|
14 | for (L<AI_BottomUpParser1.Word> parts : group.constituents) {
|
15 | if (l(parts) != 2) continue; // shouldn't happen |
16 | AI_BottomUpParser1.Word partA = first(parts), partB = second(parts); |
17 | if (!contains(partA.classes, a)) continue; |
18 | if (!contains(partB.classes, b)) continue; |
19 | print(" Found grouping: " + partA.text + " + " + partB.text);
|
20 | } |
21 | } |
22 | } |
23 | } |
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: | #1017366 |
| Snippet name: | ai_buParser1_reconstructGrouping |
| Eternal ID of this version: | #1017366/4 |
| Text MD5: | e70bb8bb3aa2b8494b23a4cf1e6dd9b8 |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-07-18 13:45:21 |
| Source code size: | 1029 bytes / 23 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 612 / 650 |
| Version history: | 3 change(s) |
| Referenced in: | [show references] |