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

25
LINES

< > BotCompany Repo | #1017388 // ai_buParser1_reconstructedProductions

JavaX fragment (include)

1  
static L<ai_Reconstructed> ai_buParser1_reconstructedProductions(AI_BottomUpParser1 parser, L<WeightedProduction> productions, AI_BottomUpParser1.Word group, S category) {
2  
  L<ai_Reconstructed> l = new L;
3  
  if (group == null) ret l;
4  
  
5  
  for (WeightedProduction prod : productions)
6  
    if (eq(category, prod.c)) {
7  
      //print("Matching prod: " + sfu(prod));
8  
      if (prod.b == null) {
9  
        if (group.hasClass(prod.a))
10  
          l.add(ai_Reconstructed(prod, group));
11  
        continue;
12  
      }
13  
        
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, prod.a)) continue;
18  
        if (!contains(partB.classes, prod.b)) continue;
19  
        l.add(ai_Reconstructed(prod, partA, partB));
20  
        //print("  Found grouping: " + partA.text + " + " + partB.text);
21  
      }
22  
    }
23  
24  
  ret l;
25  
}

Author comment

Began life as a copy of #1017377

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: #1017388
Snippet name: ai_buParser1_reconstructedProductions
Eternal ID of this version: #1017388/13
Text MD5: 9f3dae3a4777ff539eff4b8460f71b9a
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 19:39:35
Source code size: 996 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 342 / 380
Version history: 12 change(s)
Referenced in: [show references]