static L<PTElement> ai_parseTree_getChildren(AI_BottomUpParser1 parser, L<WeightedProduction> productions, PTElement e) { if (e.children == null) { e.children = ai_parseTree_makeChildren(parser, productions, e); for (PTElement child : unnull(e.children)) child.parent = e; } ret e.children; } static L<PTElement> ai_parseTree_makeChildren(AI_BottomUpParser1 parser, L<WeightedProduction> productions, final PTElement e) { if (e instanceof ChooseCategory) ret map(((ChooseCategory) e).categories, func(S cat) -> PTElement { new HaveCategory(((ChooseCategory) e).word, cat) }); if (e instanceof HaveCategory) { final HaveCategory h = cast e; L<ai_Reconstructed> l = ai_buParser1_reconstructedProductions(parser, productions, h.word, h.category); ret map(l, func(ai_Reconstructed r) -> PTElement { r.production.b == null ? new HaveCategory(r.a, r.production.a, r) : new ChoosePart(h.word, r) }); } if (e instanceof ChoosePart) { ai_Reconstructed r = ((ChoosePart) e).reconstruction; ret (L) ll(new HaveCategory(r.a, r.production.a), new HaveCategory(r.b, r.production.b)); } null; }
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: | #1017396 |
Snippet name: | ai_parseTree_getChildren - makes them too |
Eternal ID of this version: | #1017396/17 |
Text MD5: | cfedef6e80217009b0d2e8c0d5f3035e |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-09-27 12:54:44 |
Source code size: | 1188 bytes / 27 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 463 / 527 |
Version history: | 16 change(s) |
Referenced in: | [show references] |