Crates.io | fuzzy-muff |
lib.rs | fuzzy-muff |
version | |
source | src |
created_at | 2023-05-17 04:16:54.768382 |
updated_at | 2024-12-10 09:40:20.270162 |
description | Fuzzy Matching Library |
homepage | https://github.com/lotabout/fuzzy-matcher |
repository | https://github.com/lotabout/fuzzy-matcher |
max_upload_size | |
id | 866584 |
Cargo.toml error: | TOML parse error at line 21, column 1 | 21 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Fuzzy matching algorithm(s) in Rust!
In your Cargo.toml add the following:
[dependencies]
fuzzy-matcher = "*"
Here are some code example:
use fuzzy_matcher::FuzzyMatcher;
use fuzzy_matcher::skim::SkimMatcherV2;
let matcher = SkimMatcherV2::default();
assert_eq!(None, matcher.fuzzy_match("abc", "abx"));
assert!(matcher.fuzzy_match("axbycz", "abc").is_some());
assert!(matcher.fuzzy_match("axbycz", "xyz").is_some());
let (score, indices) = matcher.fuzzy_indices("axbycz", "abc").unwrap();
assert_eq!(indices, [0, 2, 4]);
fuzzy_match
only return scores while fuzzy_indices
returns the matching
indices as well.echo "axbycz" | cargo run --example fz "abc"
and check what happens.
The skim is currently used by skim, a fuzzy finder.
O(mn)
where m, n
are the length of the pattern
and input line.O(mn)
for fuzzy_indices
and O(2n)
for
fuzzy_match
which will compress the table for dynamic programming.m*n
exceeded the limit, it will fallback to a linear search.O(mn)
where m, n
are the length of the pattern and
input line.O(mn)
for fuzzy_indices
and O(2n)
for
fuzzy_match
which will compress the table for dynamic programming.