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

#97 in Algorithms

Download history 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 116129/week @ 2024-10-24 117662/week @ 2024-10-31 125321/week @ 2024-11-07 168500/week @ 2024-11-14 121702/week @ 2024-11-21 123676/week @ 2024-11-28 142082/week @ 2024-12-05 147034/week @ 2024-12-12 81243/week @ 2024-12-19 44652/week @ 2024-12-26 79320/week @ 2025-01-02

381,204 downloads per month
Used in 211 crates (34 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