!7 sS rule = [[ $x is said + $y is a phrase + $old, $new = gazelle_singleChangedWord($y, $x) + $capitalized = quote(capitalizeWord($x, $old)) => Surely you mean: $capitalized. ]]; cmodule PhraseCorrector > DynPrintLog { class Engine { S input; Set phrases = litciset("United States of America", "some other phrase"); LS iterate__$x_is_said() { ret singletonUnlessNull(input); } Collection iterate__$y_is_a_phrase() { ret phrases; } void action { for (S $x : iterate__$x_is_said()) { for (S $y : iterate__$y_is_a_phrase()) { for (PairS temp1 : singletonUnlessNull(gazelle_singleChangedWord($y, $x))) { S $old, $new = unpair temp1; for (S $capitalized : singletonUnlessNull(quote(capitalizeWord($x, $old)))) { emit(format("Surely you mean \*$capitalized*/.")); } } } } } } start-thread { /*S in_all, out = unpair tok_splitAtDoubleArrow_pair(rule); LS ins = tok_splitAtPlusAtBeginningOfLine(in_all); pnlWithHeading("INS", ins); printWithHeading("OUT", out);*/ new Engine engine; engine.input = "United States of Incarceration"; pnlWithHeading("OUTPUT", getEmits(r { engine.action() })); } }