sclass PhraseCache_rarestWord { // values: pairs of (rarest word index, phrase tokens) MultiMap<S, Pair<Int, LS>> byRarestWord = ciMultiMap(); F1<S, LS> tokenizer = f<S, LS> 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)); } }
Began life as a copy of #1022266
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1022302 |
| Snippet name: | PhraseCache_rarestWord - cached by one word in the sentence [untested] |
| Eternal ID of this version: | #1022302/5 |
| Text MD5: | fb163a231876fd6101b0e552d8cbf3f5 |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-03-13 05:10:27 |
| Source code size: | 471 bytes / 13 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 500 / 514 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |