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

27
LINES

< > BotCompany Repo | #1018080 // ai_deriveOutput

JavaX fragment (include)

1  
sbool ai_deriveOutput_debug;
2  
3  
static Set<S> ai_deriveOutput(L<IfThen> rules, LS facts) {
4  
  final new NLLogicChecker_v3 c;
5  
  c.facts = facts;
6  
  c.rules = rules;
7  
  final new NLLogicChecker_v2.Matching m;
8  
  final new LinkedHashSet<S> out;
9  
  for (final IfThen rule : nlLogic_filterByRHSConstructs(rules, 'output)) {
10  
    if (ai_deriveOutput_debug)
11  
      print("ai_deriveOutput: Checking " + rule);
12  
    c.iterate(rule.in, m, r {
13  
      if (ai_deriveOutput_debug)
14  
        print("Got matches: " + sfu(m.matches));
15  
        
16  
      for (Exp e : nlLogic_unrollAnd(rule.out)) {
17  
        if (e cast Func)
18  
          if (eq(e.name, "output"))
19  
            continue with out.add(nlLogic_text(c.apply(e.arg, m)));
20  
        if (c.checkHelper(e, m))
21  
          continue;
22  
        print("Ignoring unknown RHS element: " + e);
23  
      }
24  
    });
25  
  }
26  
  ret out;
27  
}

Author comment

Began life as a copy of #1018057

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1018080
Snippet name: ai_deriveOutput
Eternal ID of this version: #1018080/6
Text MD5: 5d1a2d065b6cff444fb7ebd746e5bbd5
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-08-29 15:52:14
Source code size: 857 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 369 / 382
Version history: 5 change(s)
Referenced in: [show references]