gecko-dev/third_party/rust/strsim
2018-11-02 10:56:08 -04:00
..
src Bug 1441204 - Upgrade clap from 2.29.0 to 2.31.2. r=maja_zf 2018-06-14 12:45:55 -07:00
tests Bug 1441204 - Upgrade clap from 2.29.0 to 2.31.2. r=maja_zf 2018-06-14 12:45:55 -07:00
.cargo-checksum.json Bug 1502964 - part 2 - update winapi to froydnj/winapi-rs#aarch64; r=ted.mielczarek 2018-11-02 10:56:08 -04:00
appveyor.yml
Cargo.toml Bug 1441204 - Upgrade clap from 2.29.0 to 2.31.2. r=maja_zf 2018-06-14 12:45:55 -07:00
CHANGELOG.md Bug 1441204 - Upgrade clap from 2.29.0 to 2.31.2. r=maja_zf 2018-06-14 12:45:55 -07:00
dev Bug 1441204 - Upgrade clap from 2.29.0 to 2.31.2. r=maja_zf 2018-06-14 12:45:55 -07:00
LICENSE Bug 1441204 - Upgrade clap from 2.29.0 to 2.31.2. r=maja_zf 2018-06-14 12:45:55 -07:00
README.md Bug 1441204 - Upgrade clap from 2.29.0 to 2.31.2. r=maja_zf 2018-06-14 12:45:55 -07:00

strsim-rs Crates.io Crates.io Linux build status Windows build status

Rust implementations of string similarity metrics:

Installation

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

Documentation

You can change the version in the url to see the documentation for an older version in the changelog.

Usage

extern crate strsim;

use strsim::{hamming, levenshtein, osa_distance, 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!(3, osa_distance("ac", "cba"));

    assert_eq!(2, damerau_levenshtein("ac", "cba"));

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

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

Development

If you don't want to install Rust itself, you can run $ ./dev for a development CLI if you have Docker installed.

License

MIT