4 releases (breaking)

Uses old Rust 2015

0.4.0 Jul 10, 2016
0.3.0 Jun 30, 2016
0.2.0 Jun 28, 2016
0.1.0 Jun 27, 2016

#2162 in Algorithms

Download history 1978/week @ 2024-03-14 2146/week @ 2024-03-21 1510/week @ 2024-03-28 2194/week @ 2024-04-04 2539/week @ 2024-04-11 2174/week @ 2024-04-18 2501/week @ 2024-04-25 1985/week @ 2024-05-02 3007/week @ 2024-05-09 2799/week @ 2024-05-16 2119/week @ 2024-05-23 2804/week @ 2024-05-30 2862/week @ 2024-06-06 2262/week @ 2024-06-13 1991/week @ 2024-06-20 1042/week @ 2024-06-27

8,477 downloads per month
Used in 19 crates (13 directly)

Apache-2.0

19KB
319 lines

distance

This is a rust library for approximate string matching algorithms.
Possible applications for this are fuzzy string searching, spell checkers, spam filters, etc.

Algorithms

All algorithms support UTF-8 encoded strings.

Add as dependency

distance is available on crates.io.

[dependencies]
distance = "0.4"

Usage

use distance::*; 

// Levenshtein distance
let distance = levenshtein("hannah", "hanna");   
assert_eq!(1, distance);

// Damerau Levenshtein distance
let distance = damerau_levenshtein("hannah", "hannha");   
assert_eq!(1, distance);

// Hamming distance
let distance = hamming("karolin", "kathrin").unwrap();   
assert_eq!(3, distance);

// Sift3 distance
let distance = sift3("hannah", "hanna");
assert_eq!(0.5, distance);

No runtime deps