pub struct WordCharTreeRootNode<'a, W> { /* private fields */ }Expand description
The root node of a tree, where the edges are chars and the nodes are Option<W> words
Regarding the Option<W> words in the tree, see in particular the following:
Implementations§
Source§impl<W> WordCharTreeRootNode<'_, W>
impl<W> WordCharTreeRootNode<'_, W>
Sourcepub fn get_max_depth(&self) -> usize
pub fn get_max_depth(&self) -> usize
Get the max depth of the tree
Measured in number of lowercase char edges from the root node
to the deepest node in the tree.
In a fully well-formed word char tree, this depth
corresponds to the length in chars of the longest word in the tree.
Sourcepub fn is_fully_well_formed(&self) -> bool
pub fn is_fully_well_formed(&self) -> bool
The tree is fully well-formed as long as either of the following is true:
- The tree is empty, or
- every leaf node (node without child edges) corresponds to a word
W.
Additional notes:
- Non-leaf nodes are allowed to have
word: None. - Non-leaf nodes are allowed to have
word: Some(W).
The tree is NOT fully well-formed if any of the leaf nodes have word: None.
Sourcepub fn is_suitable_for_iterative_char_search(&self) -> bool
pub fn is_suitable_for_iterative_char_search(&self) -> bool
The tree is suitable for iterative char search for words W if the following is true:
- Every non-leaf node has
word: None.
Additional notes:
- Leaf nodes are allowed to have
word: None. - Leaf nodes are allowed to have
word: Some(W).
In iterative char search, words are fed into the search one char at a time.
Because of this, the search will return a match as soon as the shortest match is found.
Example:
- You have a list of words
[..., arm, army, ..., man, ...]. - You have the string “army man”.
- You start an iterative char search on the string to find words from the list in your string.
- The iterative char search will return a match for the word
arm. You wanted to find the wordarmy. - In this case, it was not appropriate to use iterative char search, because the wordlist was not suitable for iterative char search.