sclass PhraseCache_rarestWord { // values: pairs of (rarest word index, phrase tokens) MultiMap> byRarestWord = ciMultiMap(); F1 tokenizer = f javaTokNPunctuation; // doesn't check if phrase is there already void add(S phrase, S rarestWord) { LS tok = callF(tokenizer, phrase); if (l(tok) == 1) ret; int ofs = min(1, indexOfIC(tok, rarestWord)); byRarestWord.put(tok.get(ofs), pair(ofs, tok)); } }