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

#2329 in Algorithms

Download history 1380/week @ 2024-10-05 2902/week @ 2024-10-12 2564/week @ 2024-10-19 2327/week @ 2024-10-26 2518/week @ 2024-11-02 1648/week @ 2024-11-09 2274/week @ 2024-11-16 1718/week @ 2024-11-23 1966/week @ 2024-11-30 2388/week @ 2024-12-07 1822/week @ 2024-12-14 777/week @ 2024-12-21 1376/week @ 2024-12-28 2728/week @ 2025-01-04 2638/week @ 2025-01-11 2161/week @ 2025-01-18

9,035 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