[][src]Trait str_distance::DistanceMetric

pub trait DistanceMetric {
    type Dist: PartialOrd;
    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
;
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
; fn str_distance<S, T>(&self, a: S, b: T) -> Self::Dist
    where
        S: AsRef<str>,
        T: AsRef<str>
, { ... }
fn str_normalized<S, T>(&self, a: S, b: T) -> f64
    where
        S: AsRef<str>,
        T: AsRef<str>
, { ... } }

Associated Types

type Dist: PartialOrd

Represents the data type in which this distance is evaluated.

Loading content...

Required methods

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

Generic implementation of the metric.

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

Evaluates the normalized distance between two strings A value of '0.0' corresponds to the "zero distance", both strings are considered equal by means of the metric, whereas a value of '1.0' corresponds to the maximum distance that can exist between the strings.

Loading content...

Provided methods

fn str_distance<S, T>(&self, a: S, b: T) -> Self::Dist where
    S: AsRef<str>,
    T: AsRef<str>, 

Evaluates the distance between two str.

fn str_normalized<S, T>(&self, a: S, b: T) -> f64 where
    S: AsRef<str>,
    T: AsRef<str>, 

Convenience normalization for str types.

Loading content...

Implementors

impl DistanceMetric for Jaro[src]

type Dist = f64

impl DistanceMetric for DamerauLevenshtein[src]

type Dist = DistanceValue

impl DistanceMetric for Levenshtein[src]

type Dist = DistanceValue

impl DistanceMetric for Cosine[src]

type Dist = f64

impl DistanceMetric for Jaccard[src]

type Dist = f64

impl DistanceMetric for Overlap[src]

type Dist = f64

impl DistanceMetric for QGram[src]

type Dist = usize

impl DistanceMetric for SorensenDice[src]

type Dist = f64

impl DistanceMetric for RatcliffObershelp[src]

type Dist = f64

impl<D> DistanceMetric for Winkler<D> where
    D: DistanceMetric,
    <D as DistanceMetric>::Dist: Into<f64>, 
[src]

type Dist = f64

impl<D> DistanceMetric for TokenSort<D> where
    D: DistanceMetric
[src]

type Dist = <D as DistanceMetric>::Dist

impl<D: DistanceMetric> DistanceMetric for TokenSet<D>[src]

type Dist = <D as DistanceMetric>::Dist

Loading content...