!7 sclass Checker 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); } } p-exp { L rules = ai_parseRulesWithMacros(mL_raw("Rules BB")); 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; new Checker c; c.construct = e.text(); applyNLLogicFacts_v3(c, voidfunc(Exp e) { if (e cast Func) if (eq(e.name, 'construct)) construct = e.arg.text(); }, rules); ret nlLogic_parseExpression(c.construct); }); pnl(newRules); }