pub struct FullDictionary { /* private fields */ }
Expand description
A full, fat dictionary. All elements are stored in-memory.
Implementations§
Source§impl FullDictionary
impl FullDictionary
pub fn new() -> Self
Sourcepub fn curated() -> Arc<Self>
pub fn curated() -> Arc<Self>
Create a dictionary from the curated dictionary included
in the Harper binary.
Consider using super::FstDictionary::curated()
instead, as it is more performant for spellchecking.
Sourcepub fn extend_words(
&mut self,
words: impl IntoIterator<Item = (impl AsRef<[char]>, WordMetadata)>,
)
pub fn extend_words( &mut self, words: impl IntoIterator<Item = (impl AsRef<[char]>, WordMetadata)>, )
Appends words to the dictionary. It is significantly faster to append many words with one call than many distinct calls to this function.
Sourcepub fn append_word(&mut self, word: impl AsRef<[char]>, metadata: WordMetadata)
pub fn append_word(&mut self, word: impl AsRef<[char]>, metadata: WordMetadata)
Append a single word to the dictionary.
If you are appending many words, consider using Self::extend_words
instead.
Sourcepub fn append_word_str(&mut self, word: &str, metadata: WordMetadata)
pub fn append_word_str(&mut self, word: &str, metadata: WordMetadata)
Append a single string to the dictionary.
If you are appending many words, consider using Self::extend_words
instead.
Trait Implementations§
Source§impl Clone for FullDictionary
impl Clone for FullDictionary
Source§fn clone(&self) -> FullDictionary
fn clone(&self) -> FullDictionary
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for FullDictionary
impl Debug for FullDictionary
Source§impl Default for FullDictionary
impl Default for FullDictionary
Source§impl Dictionary for FullDictionary
impl Dictionary for FullDictionary
Source§fn 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<'_>>
Suggest a correct spelling for a given misspelled word.
Self::word
is assumed to be quite small (n < 100).
max_distance
relates to an optimization that allows the search
algorithm to prune large portions of the search.
Source§fn get_word_metadata(&self, word: &[char]) -> WordMetadata
fn get_word_metadata(&self, word: &[char]) -> WordMetadata
WordMetadata
for a given word.
If the word isn’t in the dictionary, the resulting metadata will be
empty.Source§fn contains_word(&self, word: &[char]) -> bool
fn contains_word(&self, word: &[char]) -> bool
Source§fn contains_word_str(&self, word: &str) -> bool
fn contains_word_str(&self, word: &str) -> bool
Source§fn get_word_metadata_str(&self, word: &str) -> WordMetadata
fn get_word_metadata_str(&self, word: &str) -> WordMetadata
WordMetadata
for a given word.
If the word isn’t in the dictionary, the resulting metadata will be
empty.Source§fn 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<'_>>
Source§impl PartialEq for FullDictionary
impl PartialEq for FullDictionary
impl Eq for FullDictionary
impl StructuralPartialEq for FullDictionary
Auto Trait Implementations§
impl Freeze for FullDictionary
impl RefUnwindSafe for FullDictionary
impl Send for FullDictionary
impl Sync for FullDictionary
impl Unpin for FullDictionary
impl UnwindSafe for FullDictionary
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more