static L<S dropSuffixUsingWordTree_all(L<S> tok, Map<S, O> tree) { } // tok = CNC // returns [(index, tree leaf)] static LPair<Int, O> matchEndUsingWordTree_all(L<S> tok, Map<S, O> tree) { O best = null; // best leaf int bestIndex = 0; // best index int j = l(tok)-2; LPair<Int, O> out = new L; while (j > 0) { O def = tree.get("<default>"); if (def != null) { best = def; bestIndex = j; } O t = tree.get(tok.get(j)); if (t == null) break; if (!t instanceof Map) break with addPair(out, j, t); // leaf! j -= 2; tree = (Map) t; } if (best != null) addPair(out, bestIndex, best); ret out; }
Began life as a copy of #1018103
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: | #1018104 |
| Snippet name: | dropSuffixUsingWordTree_all [dev.] |
| Eternal ID of this version: | #1018104/1 |
| Text MD5: | 60353334bfd444bbd225f16374fa6111 |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-09-02 13:09:48 |
| Source code size: | 671 bytes / 26 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 482 / 531 |
| Referenced in: | [show references] |