Skip to content

A collection of approximate string matching algorithms for Rust

License

Notifications You must be signed in to change notification settings

mbrlabs/distance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);

About

A collection of approximate string matching algorithms for Rust

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages