StringMetric

Trait StringMetric 

Source
pub trait StringMetric {
    // Required method
    fn distance(&self, s1: &str, s2: &str) -> Result<f64>;

    // Provided methods
    fn normalized_distance(&self, s1: &str, s2: &str) -> Result<f64> { ... }
    fn similarity(&self, s1: &str, s2: &str) -> Result<f64> { ... }
}
Expand description

Trait for string distance metrics

Required Methods§

Source

fn distance(&self, s1: &str, s2: &str) -> Result<f64>

Calculate the distance between two strings

Provided Methods§

Source

fn normalized_distance(&self, s1: &str, s2: &str) -> Result<f64>

Calculate normalized distance (0.0 to 1.0)

Source

fn similarity(&self, s1: &str, s2: &str) -> Result<f64>

Calculate similarity (1.0 - normalized distance)

Implementors§