distance

Crates.iodistance
lib.rsdistance
version0.4.0
sourcesrc
created_at2016-06-27 22:50:44.836758
updated_at2016-07-10 14:23:28.899206
descriptionA collection of approximate string matching algorithms
homepage
repositoryhttps://github.com/mbrlabs/distance
max_upload_size
id5514
size31,453
Marcus Brummer (mbrlabs)

documentation

https://mbrlabs.github.io/distance

README

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);
Commit count: 31

cargo fmt