[−][src]Struct str_distance::levenshtein::DamerauLevenshtein
Specify a maximum distance. Specifying a maximum distance allows short circuit exit after exceeding the maximum distance and less cell evaluation. It essentially changes the time complexity from being the product of the two string lengths to being just the length of the shorter string
See http://blog.softwx.net/2015/01/optimizing-damerau-levenshtein_15.html Note that this is based on Sten Hjelmqvist's "Fast, memory efficient" algorithm, described at http://www.codeproject.com/Articles/13525/Fast-memory-efficient-Levenshtein-algorithm. This version differs by including some optimizations, and extending it to the Damerau- Levenshtein algorithm. Note that this is the simpler and faster optimal string alignment (aka restricted edit) distance that difers slightly from the classic Damerau-Levenshtein algorithm by imposing the restriction that no substring is edited more than once. So for example, "CA" to "ABC" has an edit distance of 2 by a complete application of Damerau-Levenshtein, but a distance of 3 by this method that uses the optimal string alignment algorithm. See wikipedia article for more detail on this distinction.
Methods
impl DamerauLevenshtein
[src]
pub fn with_max_distance(max_distance: usize) -> Self
[src]
Trait Implementations
impl Clone for DamerauLevenshtein
[src]
fn clone(&self) -> DamerauLevenshtein
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for DamerauLevenshtein
[src]
impl Default for DamerauLevenshtein
[src]
fn default() -> DamerauLevenshtein
[src]
impl DistanceMetric for DamerauLevenshtein
[src]
type Dist = DistanceValue
Represents the data type in which this distance is evaluated.
fn distance<S, T>(&self, a: S, b: T) -> Self::Dist where
S: IntoIterator,
T: IntoIterator,
<S as IntoIterator>::IntoIter: Clone,
<T as IntoIterator>::IntoIter: Clone,
<S as IntoIterator>::Item: PartialEq + PartialEq<<T as IntoIterator>::Item>,
<T as IntoIterator>::Item: PartialEq,
[src]
S: IntoIterator,
T: IntoIterator,
<S as IntoIterator>::IntoIter: Clone,
<T as IntoIterator>::IntoIter: Clone,
<S as IntoIterator>::Item: PartialEq + PartialEq<<T as IntoIterator>::Item>,
<T as IntoIterator>::Item: PartialEq,
fn str_distance<S, T>(&self, s1: S, s2: T) -> Self::Dist where
S: AsRef<str>,
T: AsRef<str>,
[src]
S: AsRef<str>,
T: AsRef<str>,
fn normalized<S, T>(&self, a: S, b: T) -> f64 where
S: IntoIterator,
T: IntoIterator,
<S as IntoIterator>::IntoIter: Clone,
<T as IntoIterator>::IntoIter: Clone,
<S as IntoIterator>::Item: PartialEq + PartialEq<<T as IntoIterator>::Item>,
<T as IntoIterator>::Item: PartialEq,
[src]
S: IntoIterator,
T: IntoIterator,
<S as IntoIterator>::IntoIter: Clone,
<T as IntoIterator>::IntoIter: Clone,
<S as IntoIterator>::Item: PartialEq + PartialEq<<T as IntoIterator>::Item>,
<T as IntoIterator>::Item: PartialEq,
fn str_normalized<S, T>(&self, a: S, b: T) -> f64 where
S: AsRef<str>,
T: AsRef<str>,
[src]
S: AsRef<str>,
T: AsRef<str>,
Auto Trait Implementations
impl RefUnwindSafe for DamerauLevenshtein
impl Send for DamerauLevenshtein
impl Sync for DamerauLevenshtein
impl Unpin for DamerauLevenshtein
impl UnwindSafe for DamerauLevenshtein
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,