// rulesMechListName = "" => default rules & facts static Steppable nlLogic_processInputOrFact_steppable(S input, bool inputAsFact, S rulesMechListName, Collector out) { ret nlLogic_processInputOrFact_steppable(input, inputAsFact, eq(rulesMechListName, "") ? ai_activeRulesAndFacts() : pair(ai_rulesFromMechLists(tok_splitAtComma(rulesMechListName)), emptyList_asList(S)), out); } static new ThreadLocal nlLogic_processInputOrFact_steppable_allowUnsafeEvals; static Steppable nlLogic_processInputOrFact_steppable(S input, bool inputAsFact, Pair, LS> rulesAndFacts, final Collector out) { ret nlLogic_processInputOrFact_steppable(new NLLogicChecker_v2, input, inputAsFact, rulesAndFacts, out); } static Steppable nlLogic_processInputOrFact_steppable(NLLogicChecker_v2 c, S input, bool inputAsFact, Pair, LS> rulesAndFacts, final Collector out) { 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)]; c.allowUnsafeEvals = isTrue(nlLogic_processInputOrFact_steppable_allowUnsafeEvals!); print("Have " + n2(rulesAndFacts.a, "rule")); c.useIterate = true; //c.staticVerbose = true; ret nlLogic_fillBattleSpace_steppable(c, ai_ruleWithParamsCollector(out, c), false); }