Struct hyphenation_commons::Patterns
[−]
[src]
pub struct Patterns { pub tally: Option<Vec<u8>>, pub descendants: HashMap<u8, Patterns, BuildHasherDefault<FnvHasher>>, }
A basic trie, used to associate patterns to their hyphenation scores.
Fields
tally: Option<Vec<u8>>
descendants: HashMap<u8, Patterns, BuildHasherDefault<FnvHasher>>
Trait Implementations
impl Debug for Patterns
[src]
impl Clone for Patterns
[src]
fn clone(&self) -> Patterns
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<'a> KLPTrie<'a> for Patterns
[src]
type Score = Vec<u8>
fn new() -> Patterns
Creates an empty Patterns
trie.
fn insert(&mut self, (pattern, tally): KLPair) -> Option<Vec<u8>>
Inserts a Knuth-Liang hyphenation pair into the trie.
If the pattern already exists, the old tally is returned; if not, None
is.
fn score(&self, word: &str) -> Self::Score
Assigns a score to each potential hyphenation point.
All patterns matching a substring of word
are compounded, and for
each hyphenation point, the highest competing value is selected.