text_distance

Crates.iotext_distance
lib.rstext_distance
version0.5.0
sourcesrc
created_at2023-03-27 13:58:25.229213
updated_at2023-04-28 13:29:45.087749
descriptionA collection of approximate string matching algorithms
homepage
repositoryhttps://github.com/Okroshiashvili/text_distance
max_upload_size
id822170
size49,733
Nodar Okroshiashvili (Okroshiashvili)

documentation

README

Cargo Build & Test

Text Distance


⚠ WARNING: This is a work in progress. The API is not optimized and stable yet.


Side Note: I've started this project to learn Rust. If you see something that is very odd or is in dire need of improvement please let me know!


Text Distance - A collection of algorithms for measuring the distance between two strings.

Usage

Add this to your Cargo.toml:

[dependencies]
text_distance = "0.2.0"

or in terminal run

cargo add text_distance

Example

use text_distance::Levenshtein;


fn main() {
    let lev = Levenshtein {s: "test".to_string(),  t: "book".to_string()};

    let plain_distance = lev.distance();
    let normalized_distance = lev.normalized_distance();
    let similarity = lev.similarity();
    let normalized_similarity = lev.normalized_similarity();

    println!("plain_distance: {}", plain_distance);
    println!("normalized_distance: {}", normalized_distance);
    println!("similarity: {}", similarity);
    println!("normalized_similarity: {}", normalized_similarity);
}
Commit count: 51

cargo fmt