#levenshtein #did-you-mean

correct_word

A No brainer 'did you mean' library for Rust

3 releases

0.1.2 Dec 22, 2023
0.1.1 Dec 17, 2023
0.1.0 Dec 17, 2023

#562 in Text processing

Download history 2/week @ 2024-02-14 21/week @ 2024-02-21 15/week @ 2024-02-28 2/week @ 2024-03-06 5/week @ 2024-03-13 20/week @ 2024-03-27 45/week @ 2024-04-03

65 downloads per month
Used in 2 crates

MIT license

9KB
73 lines

Correct Word

A no brain "did you mean" suggestions generator written in Rust. Plans to use a weird array of algorithms to get the best results. But for now, it only uses the Levenshtein distance.

Usage

Complete docs can be found here.

use correct_word::correct_word;
use correct_word::Algorithm;

fn main() {
    let word = "helo";
    let dictionary = vec!["hello", "world", "hell", "help", "helo", "hola"];
    let suggestion = correct_word(Algorithm::Levenshtein, word, dictionary, None);
    println!("{} with confidence {}", suggestion.0, suggestion.1);
}

License

This project is licensed under the MIT License - see the LICENSE file for details

No runtime deps