sclass FullPhraseCache { L phrases; // different spellings of full phrase Map byFirstWord = ciMap(); void add(S phrase) { LS tok = javaTokNPunctuation_cached(phrase); if (l(tok) == 1) ret; add(tok, 1); } void add(LS tok, int idx) { if (idx >= l(tok)-1) ret with phrases.add(tok); FullPhraseCache subCache = getOrCreate(byFirstWord, tok.get(idx), FullPhraseCache); subCache.add(tok, idx+2); } }