1 | sclass PhraseCache_rarestWord {
|
2 | // values: pairs of (rarest word index, phrase tokens) |
3 | MultiMap<S, Pair<Int, LS>> byRarestWord = ciMultiMap(); |
4 | F1<S, LS> tokenizer = f<S, LS> javaTokNPunctuation; |
5 | |
6 | // doesn't check if phrase is there already |
7 | void add(S phrase, S rarestWord) {
|
8 | LS tok = callF(tokenizer, phrase); |
9 | if (l(tok) == 1) ret; |
10 | int ofs = min(1, indexOfIC(tok, rarestWord)); |
11 | byRarestWord.put(tok.get(ofs), pair(ofs, tok)); |
12 | } |
13 | } |
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: | 503 / 518 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |