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

#2409 in Algorithms

Download history 2467/week @ 2025-10-23 2367/week @ 2025-10-30 2835/week @ 2025-11-06 1437/week @ 2025-11-13 2398/week @ 2025-11-20 1751/week @ 2025-11-27 1396/week @ 2025-12-04 828/week @ 2025-12-11 725/week @ 2025-12-18 817/week @ 2025-12-25 945/week @ 2026-01-01 1035/week @ 2026-01-08 1008/week @ 2026-01-15 1656/week @ 2026-01-22 2035/week @ 2026-01-29 2652/week @ 2026-02-05

7,528 downloads per month
Used in 26 crates (20 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