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

27
LINES

< > BotCompany Repo | #1017382 // ai_buParser1_reconstructedGroupings2 - with productions

JavaX fragment (include)

static L<T3<AI_BottomUpParser1.Word, AI_BottomUpParser1.Word, T3<S>>> ai_buParser1_reconstructedGroupings2(AI_BottomUpParser1 parser, AI_BottomUpParser1.Word group, S category) {
  L<T3<AI_BottomUpParser1.Word, AI_BottomUpParser1.Word, T3<S>>> l = new L;
  if (group == null || !group.isGroup()) ret l;
  
  MultiMap<S> superClasses = reverseMultiMap(parser.subClasses);
  Set<S> classes = makeHull_optimized(superClasses, category);

  // a + b = c
  for (S a : keys(parser.groupingsByA))
    for (PairS bAndC : parser.groupingsByA.get(a)) {
      S b = bAndC.a, c = bAndC.b;
      if (contains(classes, c)) {
        //print("Possible production: " + a + " + " + b + " = " + c);
        for (L<AI_BottomUpParser1.Word> parts : group.constituents) {
          if (l(parts) != 2) continue; // shouldn't happen
          AI_BottomUpParser1.Word partA = first(parts), partB = second(parts);
          if (!contains(partA.classes, a)) continue;
          if (!contains(partB.classes, b)) continue;
          T3<S> production = t3(a, b, c);
          l.add(t3(partA, partB, production));
          //print("  Found grouping: " + partA.text + " + " + partB.text);
        }
      }
    }
  
  ret l;
}

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: #1017382
Snippet name: ai_buParser1_reconstructedGroupings2 - with productions
Eternal ID of this version: #1017382/3
Text MD5: 162cbc529b17846e0766320bd80985ff
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 16:09:21
Source code size: 1222 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 340 / 373
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1017383 - ai_buParser_simplify (old)