[−][src]Enum imdb_index::Similarity
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]
fn eq(&self, other: &Similarity) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Copy for Similarity
[src]
impl Eq for Similarity
[src]
impl Default for Similarity
[src]
fn default() -> Similarity
[src]
impl Clone for Similarity
[src]
fn clone(&self) -> 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<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
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]
Auto Trait Implementations
impl Send for Similarity
impl Unpin for Similarity
impl Sync for Similarity
impl UnwindSafe for Similarity
impl RefUnwindSafe for Similarity
Blanket Implementations
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,