Libraryless. Click here for Pure Java version (2567L/16K).
// dictionary has to be a ciSet static Chain<S> constructWordFromCISet(S word, Set<S> dictionary) { if (contains(dictionary, word)) ret Chain<S>(word); for ping (int i = l(word)-1; i > 0; i--) { S prefix = takeFirst(i, word); if (contains(dictionary, prefix)) { Chain<S> chain = constructWordFromCISet(substring(word, i), dictionary); if (chain != null) ret Chain<S>(prefix, chain); } } null; }
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: | 235 / 368 |
Version history: | 5 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1027972 - constructWordFromCISet_withConnectors |