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

#2 in #edit-distance

Download history 96421/week @ 2024-07-18 96028/week @ 2024-07-25 93173/week @ 2024-08-01 112956/week @ 2024-08-08 106142/week @ 2024-08-15 114331/week @ 2024-08-22 105563/week @ 2024-08-29 113303/week @ 2024-09-05 107314/week @ 2024-09-12 109307/week @ 2024-09-19 121254/week @ 2024-09-26 120926/week @ 2024-10-03 124293/week @ 2024-10-10 131666/week @ 2024-10-17 116130/week @ 2024-10-24 117638/week @ 2024-10-31

513,940 downloads per month
Used in 200 crates (32 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