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)

svoid phraseCache_mark(PhraseCache cache, LS tok, BitSet mark_io) {
  if (cache == null) ret;
  for (int i = 1; i < l(tok); i += 2) {
    L<LS> phrases = cache.byFirstWord.get(tok.get(i));
    new Best<LS> best;
    for (LS phrase : phrases)
      if (codeTokenSubListEqualsIC_skipFirst(tok, phrase, i))
        best.put(phrase, l(phrase));
    if (best.has()) {
      int j = i+l(best!)-3;
      for (int k = i; k <= j; k += 2)
        setBit(mark_io, k);
      i = j;
    }
  }
}

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: 188 / 220
Version history: 5 change(s)
Referenced in: [show references]