// rulesMechListName = "<default>" => default rules & facts static L<ExecutedRule> nlLogic_processInputOrFact(S input, bool inputAsFact, S rulesMechListName) { ret nlLogic_processInputOrFact(input, inputAsFact, eq(rulesMechListName, "<default>") ? ai_activeRulesAndFacts() : pair(ai_rulesFromMechList(trim(rulesMechListName)), (LS) emptyList())); } static new ThreadLocal<Bool> nlLogic_processInputOrFact_allowUnsafeEvals; static L<ExecutedRule> nlLogic_processInputOrFact(S input, bool inputAsFact, Pair<L<IfThen>, LS> rulesAndFacts) { new NLLogicChecker_v3 c; if (!inputAsFact) c.input = input; c.facts = reversed(rulesAndFacts.b); if (inputAsFact) c.facts = concatLists(ll(input), c.facts); c.rules = reversed(rulesAndFacts.a); // latest rules first! if (!inputAsFact) c.rules = [IfThen r : c.rules | ai_ruleAccessesInput(r)]; if (!isTrue(nlLogic_processInputOrFact_allowUnsafeEvals!)) c.rules = nlLogic_safeLHSEvalsOnly/*_verbose*/(c.rules); print("Have " + n2(rulesAndFacts.a, "rule")); c.useIterate = true; //c.staticVerbose = true; new L<RuleWithParams> battleSpace; nlLogic_fillBattleSpace(c, battleSpace, false); //print("l=" + l(battleSpace)); ret map nlLogic_executedRuleFromRuleWithParams(battleSpace); }
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: | #1018275 |
Snippet name: | nlLogic_processInputOrFact |
Eternal ID of this version: | #1018275/11 |
Text MD5: | 443d185213cc5b00297b898eae606262 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-02-10 21:35:49 |
Source code size: | 1299 bytes / 28 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 442 / 491 |
Version history: | 10 change(s) |
Referenced in: | [show references] |