static LS phraseCache_group(PhraseCache cache, LS tok) { if (cache == null) ret tok; tok = cloneList(tok); 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; tok_addCurlyBracketsAroundPart(tok, i, j); i = j; } } ret tok; } static LS phraseCache_group(PhraseCache cache, S s) { ret phraseCache_group(cache, javaTokNPunctuation(s)); }
Began life as a copy of #1022268
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: | #1022272 |
Snippet name: | phraseCache_group |
Eternal ID of this version: | #1022272/4 |
Text MD5: | 523e5ee8501c6170750f182edc10c410 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-03-12 15:42:17 |
Source code size: | 625 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 247 / 282 |
Version history: | 3 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1022310 - fullPhraseCache_group #1022849 - phraseCache_mark - mark found phrases in BitSet |