pub struct Sift4Common {
pub max_offset: usize,
pub max_distance: usize,
}Expand description
Sift4 distance is an edit algorithm designed to be “fast and relatively accurate”.
The original blog post describes 3 different implementations of the algorithm,
this is the “common” one. The main difference from Sift4Simple
is the support for max_distance that can be used to stop calculating the distance
after a certain threshold.
Fields§
§max_offset: usizeThe number of characters to search for matching letters. Default: 5.
max_distance: usizeThe distance at which the algorithm should stop computing the value and just exit (the strings are too different anyway). Default: 0.
Trait Implementations§
Source§impl Algorithm<usize> for Sift4Common
impl Algorithm<usize> for Sift4Common
Source§fn for_vec<E: Eq>(&self, s1: &[E], s2: &[E]) -> Result<usize>
fn for_vec<E: Eq>(&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 Sift4Common
impl RefUnwindSafe for Sift4Common
impl Send for Sift4Common
impl Sync for Sift4Common
impl Unpin for Sift4Common
impl UnwindSafe for Sift4Common
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