class Cadmium::Trie

Defined in:

cadmium/trie/trie.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(case_sensitive : Bool = true) #

[View source]

Instance Method Detail

def add(string : String) #

Adds a string to the Trie

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


[View source]
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


[View source]
def contains?(string) #

Determines if string has been added to the Trie


[View source]
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.


[View source]
def keys_with_prefix(prefix) #

Finds all of the words that begin with prefix


[View source]
def matches_on_path(path) #

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


[View source]
def size #

Returns the number of nodes in the Trie


[View source]