Stringmetrics
This is a Rust library for approximate string matching that implements simple algorithms such has Hamming distance, Levenshtein distance, Jaccard similarity, and more.
Crate info: https://crates.io/crates/stringmetrics
Crate docs: https://docs.rs/stringmetrics/.
Crate source: https://github.com/pluots/stringmetrics
Note that spellcheck features have been moved to https://crates.io/crates/zspell
Stringmetric Algorithms
One of the main purposes of this library is to provide a variety of string
metric functions. These include a few Levenshtein implementations (including
limit/max, weighted, and generic), Jaccard index, and a Hamming implementation.
These are all found in the algorithms
module. Quick example:
// Basic levenshtein distance
use levenshtein;
assert_eq!;
// Levenshtein distance with a limit to save computation time
use levenshtein_limit;
assert_eq!;
// Basic hamming distance
use hamming;
let a = "abcdefg";
let b = "aaadefa";
assert_eq!;
// Set custom weights
use ;
// This struct holds insertion, deletion, and substitution costs
let weights = new;
assert_eq!;
See the documentation for more details.
License
See the LICENSE file for license information. The provided license does allow for proprietary use and adaptation; that being said, I kindly suggest that if you come up with an improvement, you submit a pull request and help us all out :)