6 stable releases

Uses old Rust 2015

new 1.0.5 Feb 22, 2021
1.0.4 Apr 16, 2019
1.0.3 Jul 6, 2017
1.0.1 Feb 15, 2017
1.0.0 Feb 9, 2016

#35 in Algorithms

Download history 860/week @ 2020-11-04 1062/week @ 2020-11-11 2212/week @ 2020-11-18 1544/week @ 2020-11-25 1380/week @ 2020-12-02 1059/week @ 2020-12-09 1462/week @ 2020-12-16 1049/week @ 2020-12-23 2137/week @ 2020-12-30 1524/week @ 2021-01-06 2339/week @ 2021-01-13 1611/week @ 2021-01-20 2031/week @ 2021-01-27 1697/week @ 2021-02-03 2898/week @ 2021-02-10 3190/week @ 2021-02-17

7,585 downloads per month
Used in 13 crates (6 directly)

MIT license

3KB

levenshtein.rs

Build Coverage Crate

Vladimir Levenshtein’s edit distance algorithm as a Rust library. There’s also a C library, C user command, and JavaScript module.

🎉 This is my first attempt at Rust!

Installation

Cargo:

[dependencies]
levenshtein = "1.0.5"

Usage

extern crate levenshtein;
use levenshtein::levenshtein;

fn main() {
    println!("{}", levenshtein("kitten", "sitting"));
}

Yields:

3

API

fn levenshtein(a: &str, b: &str) -> usize

Given two strings, returns the edit distance between them.

License

MIT © Titus Wormer

No runtime deps