Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

11
LINES

< > BotCompany Repo | #1022266 // PhraseCache - cached by first word. case-insensitive

JavaX fragment (include)

1  
sclass PhraseCache {
2  
  MultiMap<S, LS> byFirstWord = ciMultiMap();
3  
  F1<S, LS> tokenizer = f<S, LS> javaTokNPunctuation;
4  
  
5  
  // doesn't check if phrase is there already
6  
  void add(S phrase) {
7  
    LS tok = callF(tokenizer, phrase);
8  
    if (l(tok) == 1) ret;
9  
    byFirstWord.put(second(tok), tok);
10  
  }
11  
}

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: 337 / 788
Version history: 4 change(s)
Referenced in: [show references]