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

22
LINES

< > BotCompany Repo | #1017727 // Derive Facts [OK!]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Libraryless. Click here for Pure Java version (8662L/63K).

!7

p-exp {
  L<IfThen> rules = map nlLogic_parseRule(splitAtEmptyLines(mL_raw("Fact-to-fact rules")));
  final new NLLogicChecker_v3 c;
  c.matcher = new NLStringMatcher_dollarVars_underscores;
  c.facts = mL("Random facts");
  
  final new NLLogicChecker_v2.Matching m;
  final new LinkedHashSet<S> outFacts;
  for (final IfThen rule : rules)
    c.iterate(rule.in, m, r {
      print("Got matches: " + sfu(m.matches));
      Exp out = c.apply(rule.out, m);
      if (out cast Func)
        if (eq(out.name, "fact"))
          outFacts.add(nlLogic_text(out.arg));
    });
    
  pnl(outFacts);
  appendToMechList("Derived facts", outFacts);
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1017727
Snippet name: Derive Facts [OK!]
Eternal ID of this version: #1017727/11
Text MD5: c029557c4cbfc73be4c00494432f4900
Transpilation MD5: c2a2837d9f87029b42777e01f87a5a8f
Author: stefan
Category: javax / a.i.
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-08-04 22:47:38
Source code size: 665 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 306 / 823
Version history: 10 change(s)
Referenced in: [show references]