!7

sclass MatchInput > DynPrintLogWithInput {
  start {
    useLocalMechListCopies(true);
    set serverMechList_raw_fresh_verbose;
  }
  
  void update(S s) {
    print("\n> " + s);
    L<S> pats = mL("English sentence patterns");
    L<S> tok = javaTokWithAngleBracketsC(s);
    printStruct(tok);
    for (S pat : pats) {
      L<S> tokPat;
      tokPat = javaTokWithAngleBracketsC(pat);
      L<Pair<S>> match = uniquify(dropTwinPairs(zipTwoListsToPairs_ifSameLength(tokPat, tok)));
      if (match != null) {
        print("  Result: Choose pattern " + quote(pat) + " for input "  + quote(s) + " if match: " + sfu(match));
        for (Pair<S> p : match)
          if (isAngleBracketed(p.a)) {
            Set<S> entries = mechSetCI(plural_mech(deAngleBracket(p.a)));
            //print("Found " + n2(entries, "entry", "entries") + " for " + p.a);
            if (contains(entries, p.b))
              print("  Match!!");
          }
      }
    }
  }
}