!7 sclass ConstructChecker extends NLLogicChecker_v3 { S construct; bool checkExpression_impl(Exp e, Matching m) { if (e cast Func) if (eq(e.name, 'construct)) { S pat = e.arg.text(); ret matcher.match(pat, construct, m.matches); } ret super.checkExpression_impl(e, m); } } static L preprocessRules(L rules) { final L metaRules = nlLogic_filterByRHSConstructs(rules, 'construct); new L newRules; for (IfThen rule : rules) newRules.add(nlLogic_transformShallow(rule, func(Exp e) -> Exp { if (!e instanceof Sentence2) ret e; final new ConstructChecker c; c.construct = e.text(); applyNLLogicFacts_v3(c, voidfunc(Exp e) { if (e cast Func) if (eq(e.name, 'construct)) c.construct = e.arg.text(); }, metaRules); ret nlLogic_parseExpression(c.construct); })); ret newRules; } p-exp { L rules = ai_parseRulesWithMacros(mL_raw("Rules BB")); // Meta rules = preprocessRules(rules); pnl(rules); // Concrete S input = "was kostet der eintritt yo"; nlLogic_evalExp_verbose = false; temp tempSetTL(nlLogic_processInputOrFact_allowUnsafeEvals, true); L results = nlLogic_processInputOrFact(input, false, pair(rules, (L) null)); pnl(nlLogic_outputFromExecutedRules(new LinkedHashSet, results)); }