[][src]Enum imdb_index::Similarity

pub enum Similarity {
    None,
    Levenshtein,
    Jaro,
    JaroWinkler,
}

A ranking function to use when searching IMDb records.

A similarity ranking function computes a score between 0.0 and 1.0 (not including 0 but including 1.0) for a query and a candidate result. The score is determined by the corresponding names for a query and a candidate, and a higher score indicates more similarity.

This ranking function can be used to increase the precision of a set of results. In particular, when a similarity function is provided to a Query, then any results returned by querying the IMDb name index will be rescored according to this function. If no similarity function is provided, then the results will be ranked according to scores produced by the name index.

Variants

None

Do not use a similarity function.

Levenshtein

Computes the Levenshtein edit distance between two names and converts it to a similarity.

Jaro

Computes the Jaro edit distance between two names and converts it to a similarity.

JaroWinkler

Computes the Jaro-Winkler edit distance between two names and converts it to a similarity.

Methods

impl Similarity[src]

pub fn possible_names() -> &'static [&'static str][src]

Returns a list of s trings representing the possible similarity function names.

pub fn is_none(&self) -> bool[src]

Returns true if and only if no similarity function was selected.

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

Computes the similarity between the given strings according to the underlying similarity function. If no similarity function is present, then this always returns 1.0.

The returned value is always in the range (0, 1].

Trait Implementations

impl PartialEq<Similarity> for Similarity[src]

#[must_use] fn ne(&self, other: &Rhs) -> bool1.0.0[src]

This method tests for !=.

impl Copy for Similarity[src]

impl Eq for Similarity[src]

impl Default for Similarity[src]

impl Clone for Similarity[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Hash for Similarity[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Debug for Similarity[src]

impl Display for Similarity[src]

impl FromStr for Similarity[src]

type Err = Error

The associated error which can be returned from parsing.

Auto Trait Implementations

Blanket Implementations

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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

type Owned = T

The resulting type after obtaining ownership.

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 = 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.

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

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

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