[][src]Struct str_distance::qgram::SorensenDice

pub struct SorensenDice { /* fields omitted */ }

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

The distance corresponds to

    1 - 2 * |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 1. is returned. If one input is empty and the other is not, a value of 0. is returned. This avoids a return of f64::NaN for those cases.

Methods

impl SorensenDice[src]

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

Creates a new [SorensenDice] of length q.

Panics

Panics if q is 0.

Trait Implementations

impl Clone for SorensenDice[src]

impl Debug for SorensenDice[src]

impl Default for SorensenDice[src]

fn default() -> Self[src]

Use a bigram as default fragment length.

impl DistanceMetric for SorensenDice[src]

type Dist = f64

Represents the data type in which this distance is evaluated.

Auto Trait Implementations

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.