[][src]Struct eddie::Jaro

pub struct Jaro { /* fields omitted */ }

Jaro similarity.

See the detailed description.

Usage

use eddie::Jaro;

let jaro = Jaro::new();
let sim = jaro.similarity("martha", "marhta");
assert!((sim - 0.94).abs() < 0.01);

Complementary metrics

Relative distance:

let sim = jaro.similarity(s1, s2);
let dist = jaro.rel_dist(s1, s2);
assert_eq!(dist, 1.0 - sim);

Methods

impl Jaro[src]

pub fn new() -> Self[src]

Creates a new instance of Jaro struct with an internal state for the metric methods to reuse.

Example

use eddie::Jaro;

let jaro = Jaro::new();

pub fn similarity(&self, str1: &str, str2: &str) -> f64[src]

Similarity metric. Reflects how close two strings are, ranging from 1.0 (equality) to 0.0 (nothing in common).

Example

let sim = jaro.similarity("martha", "marhta");
assert!((sim - 0.94).abs() < 0.01);

pub fn rel_dist(&self, str1: &str, str2: &str) -> f64[src]

Relative distance metric. Inversion of similarity. Reflects how far apart two strings are, ranging from 0.0 (equality) to 1.0 (nothing in common).

Example

let dist = jaro.rel_dist("martha", "marhta");
assert!((dist - 0.06).abs() < 0.01);

Auto Trait Implementations

impl !RefUnwindSafe for Jaro

impl Send for Jaro

impl !Sync for Jaro

impl Unpin for Jaro

impl UnwindSafe for Jaro

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, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

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.