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

20
LINES

< > BotCompany Repo | #1021779 // dm_gazelle_matchAdditionalInput2 (OLD)

JavaX fragment (include)

1  
svoid dm_gazelle_matchAdditionalInput2(L<GazelleTree> l, LS preContext, O... _) {
2  
  for (GazelleTree t : l)
3  
    if (t.rule() != null) {
4  
      RuleEngine2_MatchedRule mr = t.mr;
5  
      L<TextAndType> insWithType = t.rule().insWithType;
6  
      int iCond = t.mr.iCond;
7  
      TextAndType next = get(insWithType, iCond);
8  
      if (next != null && startsWith(next.type, "history-")) {
9  
        int historyIdx = parseFirstInt(next.type);
10  
        S line = get(preContext, l(preContext)-historyIdx);
11  
        if (line == null) continue with print("Got no line for: " + next.type);
12  
        SS inputMap = litmap(next.type, line);
13  
        if (ai_ruleEngine2_matchStep(t.mr, inputMap, true, _)) {
14  
          print("Input match OK: " + line + " - new map: " + t.mr.map + ". Updating prediction.");
15  
          gazelle_addPredictionToTreeNode(t);
16  
        } else
17  
          print("Input match failed: " + line);
18  
      }
19  
    }
20  
}

Author comment

Began life as a copy of #1021775

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1021779
Snippet name: dm_gazelle_matchAdditionalInput2 (OLD)
Eternal ID of this version: #1021779/9
Text MD5: 2efcf52ead585739e4b787d4399dd018
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-16 14:00:23
Source code size: 922 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 243 / 284
Version history: 8 change(s)
Referenced in: [show references]