svoid nlLogic_setScriptID(L rules, fS scriptID) { final Set ids = collectAsHashSet(rules, 'globalID); for (IfThen rule : rules) { rule.globalID = scriptID + rule.globalID; mapIntoSameCollection(rule.options, func(S s) -> S { new Matches m; for (S pat : splitAtVerticalBar("trumps *|conflicts with")) if (match(pat, s, m)) ret format(pat, scriptID + $1); ret s; }); nlLogic_visit(rule, voidfunc(O o) { S name; if (o cast Func) { if (eq(o.name, 'followingUpOn)) { L tok = javaTok(nlLogic_text(o.arg)); if (ids.contains(_get(tok, 1))) { tok.set(1, scriptID + tok.get(1)); o.arg = Sentence2(join(tok)); } } } }); } }