Uses 911K of libraries. Click here for Pure Java version (4405L/23K).
!7 // adapted from https://github.com/eugenp/tutorials/tree/master/algorithms-searching/src/main/java/com/baeldung/algorithms/suffixtree cmodule SuffixTreeSpike > DynPrintLog { // text is by default persistent and can be made non-persistent switchable S text = "hello world what is up in the world"; switchable S testPattern; transient SuffixTree tree; void makeTree { time "makeTree" { print("Text length: " + n2(l(text))); tree = new SuffixTree(text); } print("Estimated tree size: " + nBytes(guessObjectSize(tree))); } start-thread { makeTree(); //print(tree.printTree()); /*print(+text); print(+pattern); pnl(tree.markText(pattern));*/ } // API L<SuffixTree.Node> search(CharSequence pattern) { ret tree.getAllNodesInTraversePath(pattern, tree.root, false); } void dontPersistText { dontPersist("text"); } void setText(S text) { if (setField(+text)) makeTree(); } void setTransientText(S text) { dontPersistText(); setText(text); } }
Began life as a copy of #1028130
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: | #1029201 |
Snippet name: | Suffix Tree Spike v2.1 [dev.] |
Eternal ID of this version: | #1029201/11 |
Text MD5: | e4fd06ee345c9b9675e32ec475159202 |
Transpilation MD5: | 6a92413a9123576ea58a2b352981f04a |
Author: | stefan |
Category: | javax / text searching |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-07-25 01:05:02 |
Source code size: | 1109 bytes / 46 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 297 / 2053 |
Version history: | 10 change(s) |
Referenced in: | -