!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)); } } pnlStruct(mapPairB(f l, priorityQueueToList(results)); for (Pair>> p : priorityQueueToList(results)) { L match = antiFilter(f parsing_checkMatchPairUsingMechList, p.b); if (l(match) < l(p.b)) print(" Reduced match to: " + sfu(match)); } } }