pub trait Dictionary: Send + Sync {
// Required methods
fn contains_word(&self, word: &[char]) -> bool;
fn contains_word_str(&self, word: &str) -> bool;
fn fuzzy_match(
&self,
word: &[char],
max_distance: u8,
max_results: usize,
) -> Vec<FuzzyMatchResult<'_>>;
fn fuzzy_match_str(
&self,
word: &str,
max_distance: u8,
max_results: usize,
) -> Vec<FuzzyMatchResult<'_>>;
fn get_word_metadata(&self, word: &[char]) -> WordMetadata;
fn get_word_metadata_str(&self, word: &str) -> WordMetadata;
fn words_iter(&self) -> Box<dyn Iterator<Item = &[char]> + Send + '_>;
fn words_with_len_iter(
&self,
len: usize,
) -> Box<dyn Iterator<Item = &[char]> + Send + '_>;
}
Expand description
An in-memory database that contains everything necessary to parse and analyze English text.
See also: FstDictionary
and
FullDictionary
.
Required Methods§
Sourcefn contains_word(&self, word: &[char]) -> bool
fn contains_word(&self, word: &[char]) -> bool
Check if the dictionary contains a given word.
Sourcefn contains_word_str(&self, word: &str) -> bool
fn contains_word_str(&self, word: &str) -> bool
Check if the dictionary contains a given word.
Sourcefn fuzzy_match(
&self,
word: &[char],
max_distance: u8,
max_results: usize,
) -> Vec<FuzzyMatchResult<'_>>
fn fuzzy_match( &self, word: &[char], max_distance: u8, max_results: usize, ) -> Vec<FuzzyMatchResult<'_>>
Gets best fuzzy match from dictionary
Sourcefn fuzzy_match_str(
&self,
word: &str,
max_distance: u8,
max_results: usize,
) -> Vec<FuzzyMatchResult<'_>>
fn fuzzy_match_str( &self, word: &str, max_distance: u8, max_results: usize, ) -> Vec<FuzzyMatchResult<'_>>
Gets best fuzzy match from dictionary
Sourcefn get_word_metadata(&self, word: &[char]) -> WordMetadata
fn get_word_metadata(&self, word: &[char]) -> WordMetadata
Get the associated WordMetadata
for a given word.
If the word isn’t in the dictionary, the resulting metadata will be
empty.
Sourcefn get_word_metadata_str(&self, word: &str) -> WordMetadata
fn get_word_metadata_str(&self, word: &str) -> WordMetadata
Get the associated WordMetadata
for a given word.
If the word isn’t in the dictionary, the resulting metadata will be
empty.