sclass PhraseCache { MultiMap<S, LS> byFirstWord = ciMultiMap(); F1<S, LS> tokenizer = f<S, LS> javaTokNPunctuation; // doesn't check if phrase is there already void add(S phrase) { LS tok = callF(tokenizer, phrase); if (l(tok) == 1) ret; byFirstWord.put(second(tok), tok); } }
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: | #1022266 |
| Snippet name: | PhraseCache - cached by first word. case-insensitive |
| Eternal ID of this version: | #1022266/5 |
| Text MD5: | da702447366678ed7fe485cb80ecc845 |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-04-10 16:27:42 |
| Source code size: | 312 bytes / 11 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 548 / 1013 |
| Version history: | 4 change(s) |
| Referenced in: | #1022302 - PhraseCache_rarestWord - cached by one word in the sentence [untested] #1022303 - FullPhraseCache - as tree over words #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674) |