$nodes
$nodes : array
All nodes of the tree
Handles creation of the suffix tree.
Based on the implementation of makagonov on http://stackoverflow.com/a/14580102
getOccurence(string $pSubstring) : integer
Returns the amount of occurences of the given string in the suffix tree.
Use hasSubstring($pSubstring) to check, if the given string is contained in the suffix tree.
string | $pSubstring | String to get the amount of occurences |
Returns -1, if length of $pSubstring is greater
than the string represented by the suffix tree.
Else returns the amount of occurences of the
given string.
newNode(integer $pStart, integer $pEnd) : integer
Creates as new node with given start and end indexes. Increases the current node by one.
integer | $pStart | Start index of node in string represented
|
integer | $pEnd | End index of node in string represented
|
Index of the current node
findSurpriseValue(\Sax\SuffixTree\Node $pNode, string $pSubstring) : integer
Tries to find the surprise value of the given substring in the given node.
If not successfull for the given string and a child node starts with the first letter of the given string, it will try its corresponding child. Used in a recursive manner with given node representing the root node at the begin
\Sax\SuffixTree\Node | $pNode | Node on which to try to find the given substring |
string | $pSubstring | String to get occurences of |
Amount of surprise for the given substring
findSubstring(\Sax\SuffixTree\Node $pNode, string $pSubstring) : integer
Tries to find parts of the given substring on the edge to the given node.
If successfull, the part of the given node is cutted of the substring. Children ( if any ), will continue finding the rest of the substring. Used in a recursive manner with given node representing the root node at the begin
\Sax\SuffixTree\Node | $pNode | Node on which to try to find the given substring |
string | $pSubstring | String to get occurences of |
Amount of surprise for the given substring