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

#2635 in Algorithms

Download history 1882/week @ 2024-11-15 2129/week @ 2024-11-22 1807/week @ 2024-11-29 2580/week @ 2024-12-06 1876/week @ 2024-12-13 845/week @ 2024-12-20 1194/week @ 2024-12-27 2460/week @ 2025-01-03 2892/week @ 2025-01-10 2491/week @ 2025-01-17 2258/week @ 2025-01-24 2079/week @ 2025-01-31 3159/week @ 2025-02-07 2996/week @ 2025-02-14 2530/week @ 2025-02-21 1903/week @ 2025-02-28

11,007 downloads per month
Used in 22 crates (16 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