Libraryless. Click here for Pure Java version (2567L/16K).
1 | // dictionary has to be a ciSet |
2 | static Chain<S> constructWordFromCISet(S word, Set<S> dictionary) { |
3 | if (contains(dictionary, word)) ret Chain<S>(word); |
4 | for ping (int i = l(word)-1; i > 0; i--) { |
5 | S prefix = takeFirst(i, word); |
6 | if (contains(dictionary, prefix)) { |
7 | Chain<S> chain = constructWordFromCISet(substring(word, i), dictionary); |
8 | if (chain != null) |
9 | ret Chain<S>(prefix, chain); |
10 | } |
11 | } |
12 | null; |
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: | #1027969 |
Snippet name: | constructWordFromCISet |
Eternal ID of this version: | #1027969/6 |
Text MD5: | d6069cb117e5df9309ae1de01fa0a3ac |
Transpilation MD5: | 98dc665b988e84b9e21cc831d163b323 |
Author: | stefan |
Category: | javax / nlp |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-04-21 10:50:13 |
Source code size: | 446 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 236 / 370 |
Version history: | 5 change(s) |
Referenced in: | [show references] |