Bug 1608150 [wpt PR 21112] - Add missing space in `./wpt lint` command line docs...
[gecko.git] / third_party / rust / strsim / README.md
blob747debbc3b52a85e1443ca5651a4b2b2dc2e6c07
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]:
4   - [Hamming]
5   - [Levenshtein]
6   - [Optimal string alignment]
7   - [Damerau-Levenshtein]
8   - [Jaro and Jaro-Winkler] - this implementation of Jaro-Winkler does not limit the common prefix length
10 ### Installation
11 ```toml
12 # Cargo.toml
13 [dependencies]
14 strsim = "0.7.0"
15 ```
17 ### [Documentation](https://docs.rs/strsim/)
18 You can change the version in the url to see the documentation for an older
19 version in the
20 [changelog](https://github.com/dguo/strsim-rs/blob/master/CHANGELOG.md).
22 ### Usage
23 ```rust
24 extern crate strsim;
26 use strsim::{hamming, levenshtein, osa_distance, damerau_levenshtein, jaro,
27              jaro_winkler};
29 fn main() {
30     match hamming("hamming", "hammers") {
31         Ok(distance) => assert_eq!(3, distance),
32         Err(why) => panic!("{:?}", why)
33     }
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() <
42             0.001);
44     assert!((0.911 - jaro_winkler("cheeseburger", "cheese fries")).abs() <
45             0.001);
47 ```
49 ### Development
50 If you don't want to install Rust itself, you can run `$ ./dev` for a
51 development CLI if you have [Docker] installed.
53 ### License
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/