!7 cmodule IWantYouToBe > DynPrintLog { class Rule1 implements RuleOnTok, RuleOnString, Runnable { LS pattern = wordTok("I want you to be my assistant"); Set vars = litciset("assistant"); transient SS map; // not null if there is a match public void process(S s) { process(wordTok(s)); } public void process(LS tok) { map = nullIfContainsKeysOtherThan(gazelle_zipTwoTokenizationsToMap(pattern, tok), vars); } public void run { if (map != null) emit("I want that {you are my " + getOrKeep(map, "assistant") + "}"); } } A process(A rule, S s) { rule.process(s); ret rule; } start-thread { assertNull(process(new Rule1, "I want you to be his friend").map); printStruct(assertEquals(litcimap("assistant", "girl"), process(new Rule1, "I want you to be my girl").map)); printDone(); } }