strsim 0.2.3

Implementations of string similarity metrics. Includes Hamming, Levenshtein, Damerau-Levenshtein, Jaro, and Jaro-Winkler.
docs.rs failed to build strsim-0.2.3
Please check the build logs and, if you believe this is docs.rs' fault, open an issue.
Visit the last successful build: strsim-0.10.0

strsim-rs Build Status

Rust implementations of string similarity metrics. Best efforts will be made to stay up-to-date with Rust nightly. Includes:

Installation

# Cargo.toml
[dependencies]
strsim = "0.2.3"

Usage

extern crate strsim;

use strsim::{hamming, levenshtein, damerau_levenshtein, jaro, jaro_winkler};

fn main() {
    match hamming("hamming", "hammers") {
        Ok(distance) => assert_eq!(3, distance),
        Err(why) => panic!("{:?}", why)
    }

    assert_eq!(3, levenshtein("kitten", "sitting"));

    assert_eq!(1, damerau_levenshtein("specter", "spectre"));

    assert!((0.392 - jaro("Friedrich Nietzsche", "Jean-Paul Sartre")).abs() <
            0.001);

    assert!((0.911 - jaro_winkler("cheeseburger", "cheese fries")).abs() <
            0.001);
}

Version

0.2.3

License

MIT