pub struct DamerauLevenshtein {
pub restricted: bool,
pub del_cost: usize,
pub ins_cost: usize,
pub sub_cost: usize,
pub trans_cost: usize,
}Expand description
Damerau-Levenshtein distance is an edit distance between two sequences.
It is an improved version of Levenshtein that also includes transpositions.
It is the minimum number of operations (consisting of insertions, deletions or substitutions of a single character, or transposition of two adjacent characters) required to change one text into the other.
Fields§
§restricted: boolIf false (default), allow adjacent transpositions.
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.
trans_cost: usizeThe cost of swapping two adjacent characters.
Trait Implementations§
Source§impl Algorithm<usize> for DamerauLevenshtein
impl Algorithm<usize> for DamerauLevenshtein
Source§fn for_vec<E: Eq + Hash>(&self, s1: &[E], s2: &[E]) -> Result<usize>
fn for_vec<E: Eq + Hash>(&self, s1: &[E], s2: &[E]) -> Result<usize>
Calculate distance/similarity for vectors. Read more
Source§fn for_iter<C, E>(&self, s1: C, s2: C) -> Result<R>
fn for_iter<C, E>(&self, s1: C, s2: C) -> Result<R>
Calculate distance/similarity for iterators. 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 DamerauLevenshtein
impl RefUnwindSafe for DamerauLevenshtein
impl Send for DamerauLevenshtein
impl Sync for DamerauLevenshtein
impl Unpin for DamerauLevenshtein
impl UnwindSafe for DamerauLevenshtein
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