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

#9 in #fuzzy-string

Download history 1711/week @ 2024-03-04 2129/week @ 2024-03-11 2411/week @ 2024-03-18 1736/week @ 2024-03-25 1961/week @ 2024-04-01 2022/week @ 2024-04-08 2235/week @ 2024-04-15 2685/week @ 2024-04-22 1828/week @ 2024-04-29 3088/week @ 2024-05-06 2987/week @ 2024-05-13 2299/week @ 2024-05-20 2455/week @ 2024-05-27 2688/week @ 2024-06-03 2539/week @ 2024-06-10 2482/week @ 2024-06-17

10,245 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