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

16
LINES

< > BotCompany Repo | #1022849 // phraseCache_mark - mark found phrases in BitSet

JavaX fragment (include)

1  
svoid phraseCache_mark(PhraseCache cache, LS tok, BitSet mark_io) {
2  
  if (cache == null) ret;
3  
  for (int i = 1; i < l(tok); i += 2) {
4  
    L<LS> phrases = cache.byFirstWord.get(tok.get(i));
5  
    new Best<LS> best;
6  
    for (LS phrase : phrases)
7  
      if (codeTokenSubListEqualsIC_skipFirst(tok, phrase, i))
8  
        best.put(phrase, l(phrase));
9  
    if (best.has()) {
10  
      int j = i+l(best!)-3;
11  
      for (int k = i; k <= j; k += 2)
12  
        setBit(mark_io, k);
13  
      i = j;
14  
    }
15  
  }
16  
}

Author comment

Began life as a copy of #1022272

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: #1022849
Snippet name: phraseCache_mark - mark found phrases in BitSet
Eternal ID of this version: #1022849/6
Text MD5: f267b7682705aa6173d8cd1eb568507b
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 21:22:05
Source code size: 496 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 192 / 226
Version history: 5 change(s)
Referenced in: [show references]