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

#2135 in Algorithms

Download history 2836/week @ 2024-01-03 2441/week @ 2024-01-10 1493/week @ 2024-01-17 2114/week @ 2024-01-24 2037/week @ 2024-01-31 1477/week @ 2024-02-07 1559/week @ 2024-02-14 2199/week @ 2024-02-21 2000/week @ 2024-02-28 2105/week @ 2024-03-06 1955/week @ 2024-03-13 2176/week @ 2024-03-20 1329/week @ 2024-03-27 2250/week @ 2024-04-03 2418/week @ 2024-04-10 1488/week @ 2024-04-17

7,912 downloads per month
Used in 18 crates (12 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