1 | static L<Pair<AI_BottomUpParser1.Word>> ai_buParser1_reconstructedGroupings(AI_BottomUpParser1 parser, AI_BottomUpParser1.Word group, S category) {
|
2 | L<Pair<AI_BottomUpParser1.Word>> l = new L; |
3 | if (group == null || !group.isGroup()) ret l; |
4 | |
5 | // add subclasses of outer category |
6 | MultiMap<S> finerClasses = reverseMultiMap(parser.subClasses); |
7 | Set<S> classes = makeHull_optimized(finerClasses, category); |
8 | |
9 | // a + b = c |
10 | for (S a : keys(parser.groupingsByA)) |
11 | for (PairS bAndC : parser.groupingsByA.get(a)) {
|
12 | S b = bAndC.a, c = bAndC.b; |
13 | if (contains(classes, c)) {
|
14 | //print("Possible production: " + a + " + " + b + " = " + c);
|
15 | for (L<AI_BottomUpParser1.Word> parts : group.constituents) {
|
16 | if (l(parts) != 2) continue; // shouldn't happen |
17 | AI_BottomUpParser1.Word partA = first(parts), partB = second(parts); |
18 | if (!contains(partA.classes, a)) continue; |
19 | if (!contains(partB.classes, b)) continue; |
20 | l.add(pair(partA, partB)); |
21 | //print(" Found grouping: " + partA.text + " + " + partB.text);
|
22 | } |
23 | } |
24 | } |
25 | |
26 | ret l; |
27 | } |
Began life as a copy of #1017366
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: | #1017377 |
| Snippet name: | ai_buParser1_reconstructedGroupings |
| Eternal ID of this version: | #1017377/4 |
| Text MD5: | 844fea17330cd3adfb5906882d03ffb0 |
| 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-19 17:12:36 |
| Source code size: | 1147 bytes / 27 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 572 / 640 |
| Version history: | 3 change(s) |
| Referenced in: | [show references] |