Struct TokenSort

Source
pub struct TokenSort<D: DistanceMetric> { /* private fields */ }
Expand description

TokenSort modifies the inner string distance dist to adjust for differences in word orders by reording words alphabetically.

For other types than strings this is just a delegate to the inner metric.

Trait Implementations§

Source§

impl<D> DistanceMetric for TokenSort<D>
where D: DistanceMetric,

Source§

type Dist = <D as DistanceMetric>::Dist

Represents the data type in which this distance is evaluated.
Source§

fn distance<S, T>(&self, a: S, b: T) -> Self::Dist

Generic implementation of the metric.
Source§

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.
Source§

fn normalized<S, T>(&self, a: S, b: T) -> f64

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.
Source§

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

Convenience normalization for str types.

Auto Trait Implementations§

§

impl<D> Freeze for TokenSort<D>
where D: Freeze,

§

impl<D> RefUnwindSafe for TokenSort<D>
where D: RefUnwindSafe,

§

impl<D> Send for TokenSort<D>
where D: Send,

§

impl<D> Sync for TokenSort<D>
where D: Sync,

§

impl<D> Unpin for TokenSort<D>
where D: Unpin,

§

impl<D> UnwindSafe for TokenSort<D>
where D: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.