pub trait Dictionary: Send + Sync {
Show 14 methods
// Required methods
fn contains_word(&self, word: &[char]) -> bool;
fn contains_word_str(&self, word: &str) -> bool;
fn contains_exact_word(&self, word: &[char]) -> bool;
fn contains_exact_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_correct_capitalization_of(&self, word: &[char]) -> Option<&[char]>;
fn get_word_metadata(
&self,
word: &[char],
) -> Option<Cow<'_, DictWordMetadata>>;
fn get_word_metadata_str(
&self,
word: &str,
) -> Option<Cow<'_, DictWordMetadata>>;
fn words_iter(&self) -> Box<dyn Iterator<Item = &[char]> + Send + '_>;
fn word_count(&self) -> usize;
fn get_word_from_id(&self, id: &WordId) -> Option<&[char]>;
fn find_words_with_prefix(&self, prefix: &[char]) -> Vec<Cow<'_, [char]>>;
fn find_words_with_common_prefix(
&self,
word: &[char],
) -> Vec<Cow<'_, [char]>>;
}Expand description
An in-memory database that contains everything necessary to parse and analyze English text.
See also: super::FstDictionary and super::MutableDictionary.
Required Methods§
Sourcefn contains_word(&self, word: &[char]) -> bool
fn contains_word(&self, word: &[char]) -> bool
Check if the dictionary contains any capitalization of a given word.
Sourcefn contains_word_str(&self, word: &str) -> bool
fn contains_word_str(&self, word: &str) -> bool
Check if the dictionary contains any capitalization of a given word.
Sourcefn contains_exact_word(&self, word: &[char]) -> bool
fn contains_exact_word(&self, word: &[char]) -> bool
Check if the dictionary contains the exact capitalization of a given word.
Sourcefn contains_exact_word_str(&self, word: &str) -> bool
fn contains_exact_word_str(&self, word: &str) -> bool
Check if the dictionary contains the exact capitalization of 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
fn get_correct_capitalization_of(&self, word: &[char]) -> Option<&[char]>
Sourcefn get_word_metadata(&self, word: &[char]) -> Option<Cow<'_, DictWordMetadata>>
fn get_word_metadata(&self, word: &[char]) -> Option<Cow<'_, DictWordMetadata>>
Get the associated DictWordMetadata for any capitalization of a given word.
Sourcefn get_word_metadata_str(&self, word: &str) -> Option<Cow<'_, DictWordMetadata>>
fn get_word_metadata_str(&self, word: &str) -> Option<Cow<'_, DictWordMetadata>>
Get the associated DictWordMetadata for any capitalization of a given word.
If the word isn’t in the dictionary, the resulting metadata will be
empty.
Sourcefn words_iter(&self) -> Box<dyn Iterator<Item = &[char]> + Send + '_>
fn words_iter(&self) -> Box<dyn Iterator<Item = &[char]> + Send + '_>
Iterate over the words in the dictionary.
Sourcefn word_count(&self) -> usize
fn word_count(&self) -> usize
The number of words in the dictionary.
Sourcefn get_word_from_id(&self, id: &WordId) -> Option<&[char]>
fn get_word_from_id(&self, id: &WordId) -> Option<&[char]>
Returns the correct capitalization of the word with the given ID.