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

13
LINES

< > BotCompany Repo | #1026398 // fullPhraseCache_tokenRanges

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (2934L) is out of date.

1  
// returns ranges from C to N
2  
static L<IntRange> fullPhraseCache_tokenRanges(FullPhraseCache cache, LS tok) {
3  
  new L<IntRange> out;
4  
  if (cache == null) ret out;
5  
  for (int i = 1; i < l(tok); i += 2) {
6  
    int j = fullPhraseCache_longestPhraseLength(cache, tok, i);
7  
    if (j > i) {
8  
      out.add(IntRange(i, j-1));
9  
      i = j;
10  
    }
11  
  }
12  
  ret out;
13  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1026398
Snippet name: fullPhraseCache_tokenRanges
Eternal ID of this version: #1026398/2
Text MD5: a7455394096981ee40da98e99b381987
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-02 14:15:07
Source code size: 366 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 191 / 268
Version history: 1 change(s)
Referenced in: [show references]