// tok = CNC // returns (index, tree leaf) static Pair<Int, O> matchStartUsingWordTree(L<S> tok, Map<S, O> tree) { O best = null; // best leaf int bestIndex = 0; // best index int j = 1; while (j < l(tok)) { O def = tree.get("<default>"); if (def != null) { best = def; bestIndex = j; } O t = tree.get(tok.get(j)); j += 2; if (t == null) break; if (!t instanceof Map) ret pair(j, t); // leaf! tree = (Map) t; } ret pair(bestIndex, best); }
Began life as a copy of #1014764
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1017908 |
Snippet name: | matchStartUsingWordTree |
Eternal ID of this version: | #1017908/6 |
Text MD5: | bff59190e81ff380eca7d4a0f0579c9f |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-08-23 01:35:01 |
Source code size: | 508 bytes / 20 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 360 / 383 |
Version history: | 5 change(s) |
Referenced in: | [show references] |