[][src]Struct str_distance::qgram::Jaccard

pub struct Jaccard { /* fields omitted */ }

Represents a Jaccard metric where q is the length of a q-gram fragment.

The distance corresponds to

    1 - |Q(s1, q) ∩ Q(s2, q)| / |Q(s1, q) ∪ Q(s2, q))|

where Q(s, q) denotes the set of q-grams of length n for the str s.

If both inputs are empty a value of 0. is returned. If one input is empty and the other is not, a value of 1. is returned. This avoids a return of f64::NaN for those cases.

Methods

impl Jaccard[src]

pub fn new(q: usize) -> Self[src]

Creates a new [Jaccard] of length q.

Panics

Panics if q is 0.

Trait Implementations

impl Clone for Jaccard[src]

impl Debug for Jaccard[src]

impl DistanceMetric for Jaccard[src]

type Dist = f64

Represents the data type in which this distance is evaluated.

Auto Trait Implementations

impl RefUnwindSafe for Jaccard

impl Send for Jaccard

impl Sync for Jaccard

impl Unpin for Jaccard

impl UnwindSafe for Jaccard

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.