!7 sclass MatchInput > DynPrintLogWithInput { start { dm_requireModule("#1016073/MechLists"); useLocalMechListCopies(true); set serverMechList_raw_fresh_verbose; } void update(S s) { print("\n> " + s); L pats = mL("English sentence patterns"); L tok = javaTokWithAngleBracketsC(s); printStruct(tok); PlanInMotion plan = new(pats); //L>>> results = new L; // pattern + match PriorityQueue>>> results = new PriorityQueue>>>(new Comparator>>>() { public int compare(Pair>> a, Pair>> b) { //print("cmp " + l(a.b) + " " + l(b.b)); ret cmp(l(a.b), l(b.b)); } }); for (S pat : plan.master()) { L tokPat; tokPat = javaTokWithAngleBracketsC(pat); L> match = uniquify(dropTwinPairsIC(zipTwoListsToPairs_ifSameLength(tokPat, tok))); if (match != null) { print(" Result: Choose pattern " + quote(pat) + " for input " + quote(s) + " if match: " + sfu(match)); results.add(pair(pat, match)); for (Pair p : match) if (isAngleBracketed(p.a)) { Set entries = mechSetCI(plural_mech(deAngleBracket(p.a))); //print("Found " + n2(entries, "entry", "entries") + " for " + p.a); if (contains(entries, p.b)) print(" Match!!"); } } } pnlStruct(mapPairB(f l, priorityQueueToList(results)); } }