class

Cadmium::Trie

Inherits Reference / Object

Constructors

new(case_sensitive : Bool = true)
Source

Instance methods

add(string : String)

Adds a string to the Trie

Returns true if the string was already present, and false otherwise

Source
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

Source
contains?(string)

Determines if string has been added to the Trie

Source
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.

Source
keys_with_prefix(prefix)

Finds all of the words that begin with prefix

Source
matches_on_path(path)

Finds all of the words stored in the Trie that are found along path

Source
size

Returns the number of nodes in the Trie

Source