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

#2362 in Algorithms

Download history 1545/week @ 2024-09-19 1334/week @ 2024-09-26 1700/week @ 2024-10-03 1999/week @ 2024-10-10 3109/week @ 2024-10-17 2528/week @ 2024-10-24 2133/week @ 2024-10-31 2031/week @ 2024-11-07 1784/week @ 2024-11-14 2280/week @ 2024-11-21 1597/week @ 2024-11-28 2582/week @ 2024-12-05 1986/week @ 2024-12-12 999/week @ 2024-12-19 974/week @ 2024-12-26 2088/week @ 2025-01-02

6,447 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