class Cadmium::Trie
- Cadmium::Trie
- Reference
- Object
Defined in:
cadmium/trie/trie.crConstructors
Instance Method Summary
-
#add(string : String)
Adds a string to the Trie
-
#add(strings : Array(String))
Adds an array of strings to the Trie
-
#contains?(string)
Determines if string has been added to the Trie
-
#find_prefix(lookup)
Finds the largest prefix matching the prefix of lookup
-
#keys_with_prefix(prefix)
Finds all of the words that begin with prefix
-
#matches_on_path(path)
Finds all of the words stored in the Trie that are found along path
-
#size
Returns the number of nodes in the Trie
Constructor Detail
Instance Method Detail
def add(string : String)
#
Adds a string to the Trie
Returns true if the string was already present, and false otherwise
def add(strings : Array(String))
#
Adds an array of strings to the Trie
Returns true if all of the strings were already present, and false otherwise
def find_prefix(lookup)
#
Finds the largest prefix matching the prefix of lookup
Returns a 2-Tuple. If a prefix was found, it will be the first element; otherwise, the first element will be nil. The second element will be the substring that was not matched.