levenshtein

Levenshtein algorithm

6 stable releases

Uses old Rust 2015

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
Download history 105594/week @ 2024-06-12 99418/week @ 2024-06-19 100327/week @ 2024-06-26 75476/week @ 2024-07-03 78424/week @ 2024-07-10 94188/week @ 2024-07-17 97241/week @ 2024-07-24 92523/week @ 2024-07-31 112376/week @ 2024-08-07 99479/week @ 2024-08-14 116539/week @ 2024-08-21 104837/week @ 2024-08-28 115671/week @ 2024-09-04 109177/week @ 2024-09-11 108587/week @ 2024-09-18 91336/week @ 2024-09-25

442,403 downloads per month
Used in 196 crates (31 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