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

27
LINES

< > BotCompany Repo | #1018080 // ai_deriveOutput

JavaX fragment (include)

sbool ai_deriveOutput_debug;

static Set<S> ai_deriveOutput(L<IfThen> rules, LS facts) {
  final new NLLogicChecker_v3 c;
  c.facts = facts;
  c.rules = rules;
  final new NLLogicChecker_v2.Matching m;
  final new LinkedHashSet<S> out;
  for (final IfThen rule : nlLogic_filterByRHSConstructs(rules, 'output)) {
    if (ai_deriveOutput_debug)
      print("ai_deriveOutput: Checking " + rule);
    c.iterate(rule.in, m, r {
      if (ai_deriveOutput_debug)
        print("Got matches: " + sfu(m.matches));
        
      for (Exp e : nlLogic_unrollAnd(rule.out)) {
        if (e cast Func)
          if (eq(e.name, "output"))
            continue with out.add(nlLogic_text(c.apply(e.arg, m)));
        if (c.checkHelper(e, m))
          continue;
        print("Ignoring unknown RHS element: " + e);
      }
    });
  }
  ret out;
}

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: 367 / 379
Version history: 5 change(s)
Referenced in: [show references]