1 # strsim-rs [![Crates.io](https://img.shields.io/crates/v/strsim.svg)](https://crates.io/crates/strsim) [![Crates.io](https://img.shields.io/crates/l/strsim.svg?maxAge=2592000)](https://github.com/dguo/strsim-rs/blob/master/LICENSE) [![Linux build status](https://travis-ci.org/dguo/strsim-rs.svg?branch=master)](https://travis-ci.org/dguo/strsim-rs) [![Windows build status](https://ci.appveyor.com/api/projects/status/ggue6i785618a39w?svg=true)](https://ci.appveyor.com/project/dguo/strsim-rs)
3 [Rust](https://www.rust-lang.org) implementations of [string similarity metrics]:
6 - [Optimal string alignment]
7 - [Damerau-Levenshtein]
8 - [Jaro and Jaro-Winkler] - this implementation of Jaro-Winkler does not limit the common prefix length
17 ### [Documentation](https://docs.rs/strsim/)
18 You can change the version in the url to see the documentation for an older
20 [changelog](https://github.com/dguo/strsim-rs/blob/master/CHANGELOG.md).
26 use strsim::{hamming, levenshtein, osa_distance, damerau_levenshtein, jaro,
30 match hamming("hamming", "hammers") {
31 Ok(distance) => assert_eq!(3, distance),
32 Err(why) => panic!("{:?}", why)
35 assert_eq!(3, levenshtein("kitten", "sitting"));
37 assert_eq!(3, osa_distance("ac", "cba"));
39 assert_eq!(2, damerau_levenshtein("ac", "cba"));
41 assert!((0.392 - jaro("Friedrich Nietzsche", "Jean-Paul Sartre")).abs() <
44 assert!((0.911 - jaro_winkler("cheeseburger", "cheese fries")).abs() <
50 If you don't want to install Rust itself, you can run `$ ./dev` for a
51 development CLI if you have [Docker] installed.
54 [MIT](https://github.com/dguo/strsim-rs/blob/master/LICENSE)
56 [string similarity metrics]:http://en.wikipedia.org/wiki/String_metric
57 [Damerau-Levenshtein]:http://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance
58 [Jaro and Jaro-Winkler]:http://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance
59 [Levenshtein]:http://en.wikipedia.org/wiki/Levenshtein_distance
60 [Hamming]:http://en.wikipedia.org/wiki/Hamming_distance
61 [Optimal string alignment]:https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance#Optimal_string_alignment_distance
62 [Docker]:https://docs.docker.com/engine/installation/