Go to file
2015-02-19 00:15:07 -05:00
src Add Damerau-Levenshtein implementation 2015-02-19 00:15:07 -05:00
tests Add Damerau-Levenshtein implementation 2015-02-19 00:15:07 -05:00
.gitignore Add initial commit 2015-02-09 21:02:54 -05:00
.travis.yml Add Travis configuration 2015-02-09 22:18:13 -05:00
Cargo.toml Add Damerau-Levenshtein implementation 2015-02-19 00:15:07 -05:00
LICENSE Initial commit 2015-02-09 20:04:10 -05:00
README.md Add Damerau-Levenshtein implementation 2015-02-19 00:15:07 -05:00

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.0"

Usage

extern crate strsim;

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

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

License

MIT