static new ThreadLocal applyNLLogicFacts_v4_iterate_withFailed_verbose; svoid applyNLLogicFacts_v4_iterate_withFailed(S input, VF2 onRuleFired, VF3 onRuleFailed) { applyNLLogicFacts_v4_iterate_withFailed(input, onRuleFired, onRuleFailed, mL_facts()); } svoid applyNLLogicFacts_v4_iterate_withFailed(S input, VF2 onRuleFired, VF3 onRuleFailed, LS facts) { applyNLLogicFacts_v4_iterate_withFailed(input, onRuleFired, onRuleFailed, facts, ai_mL_parsedLogicExamples2()); } svoid applyNLLogicFacts_v4_iterate_withFailed(S input, VF2 onRuleFired, VF3 onRuleFailed, LS facts, L rules) { new NLLogicChecker_v2 c; //c.matcher = new NLStringMatcher_dollarVars; addAll(c.facts, facts); c.input = input; applyNLLogicFacts_v4_iterate_withFailed(c, onRuleFired, onRuleFailed, rules); } svoid applyNLLogicFacts_v4_iterate_withFailed(final NLLogicChecker_v2 c, final VF2 onRuleFired, final VF3 onRuleFailed, L rules) { c.rules = rules; for (final IfThen rule : rules) pcall { final new NLLogicChecker_v2.Matching m; m.verbose = isTrue(applyNLLogicFacts_v4_iterate_withFailed_verbose!); if (m.verbose) print("Checking rule (iterating): " + rule); nlLogic_iterate_withOnFail(c, rule.in, m, r { if (m.verbose) { print("Matched " + quote(c.input) + " with rule " + quote(rule)); printStruct(" ", m.matches); } callF(onRuleFired, rule, m); }, voidfunc(Exp e) { callF(onRuleFailed, rule, m, e) }); } }