#search #text #string #matching #levenshtein

distance

A collection of approximate string matching algorithms

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

#1154 in Algorithms

Download history 2319/week @ 2023-02-07 2596/week @ 2023-02-14 3529/week @ 2023-02-21 3267/week @ 2023-02-28 1967/week @ 2023-03-07 1995/week @ 2023-03-14 2440/week @ 2023-03-21 4203/week @ 2023-03-28 2103/week @ 2023-04-04 1938/week @ 2023-04-11 2556/week @ 2023-04-18 1707/week @ 2023-04-25 2826/week @ 2023-05-02 2108/week @ 2023-05-09 2065/week @ 2023-05-16 2949/week @ 2023-05-23

10,259 downloads per month
Used in 16 crates (10 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