fuzzy-string-distance

Crates.iofuzzy-string-distance
lib.rsfuzzy-string-distance
version1.0.0
sourcesrc
created_at2024-09-15 18:37:20.074468
updated_at2024-09-15 18:37:20.074468
descriptionFuzzy string distance comparisons
homepage
repositoryhttps://github.com/Skeletonxf/fuzzy
max_upload_size
id1375633
size33,323
Skeletonxf (Skeletonxf)

documentation

README

Fuzzy

Fuzzy string comparisons using Levenshtein distance

Whereas simple string comparison is very sensitive to typos, Levenshtein Distance gives the minimum number of single-character edits (insertions, deletions or substitutions) required to change one word into the other. This gives us a sliding scale between 0 (strings are identical) and the length of the longer string (strings are unrelated), which can be used for fuzzy comparisons that can be resilient to typos, minor mistakes, and inconsistent spelling.

use fuzzy_string_distance::levenshtein_distance;
assert_eq!(1, levenshtein_distance(&"rust", &"rusty")); // insert y
assert_eq!(3, levenshtein_distance(&"bug", &"")); // delete all characters
assert_eq!(2, levenshtein_distance(&"typography", &"typpgrapy")); // fix both typos

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Commit count: 0

cargo fmt