pub struct Levenshtein {
pub del_cost: usize,
pub ins_cost: usize,
pub sub_cost: usize,
}Expand description
Levenshtein distance is an edit distance between two sequences.
It is the minimum number of single-character edits (insertions, deletions or substitutions) required to change one word into the other.
See also DamerauLevenshtein which is an extended
version of this algorithm that also includes transpositions.
Fields§
§del_cost: usizeThe cost of removing a character.
ins_cost: usizeThe cost of adding a new character.
sub_cost: usizeThe cost of replacing a character with another one.
Trait Implementations§
Source§impl Algorithm<usize> for Levenshtein
impl Algorithm<usize> for Levenshtein
Source§fn for_iter<C, E>(&self, s1: C, s2: C) -> Result<usize>
fn for_iter<C, E>(&self, s1: C, s2: C) -> Result<usize>
Calculate distance/similarity for iterators. Read more
Source§fn for_vec<E>(&self, s1: &[E], s2: &[E]) -> Result<R>
fn for_vec<E>(&self, s1: &[E], s2: &[E]) -> Result<R>
Calculate distance/similarity for vectors. Read more
Source§fn for_str(&self, s1: &str, s2: &str) -> Result<R>
fn for_str(&self, s1: &str, s2: &str) -> Result<R>
Calculate distance/similarity for strings. Read more
Auto Trait Implementations§
impl Freeze for Levenshtein
impl RefUnwindSafe for Levenshtein
impl Send for Levenshtein
impl Sync for Levenshtein
impl Unpin for Levenshtein
impl UnwindSafe for Levenshtein
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
Mutably borrows from an owned value. Read more