Crates.io | rizzer |
lib.rs | rizzer |
version | 0.2.0 |
source | src |
created_at | 2024-08-19 04:31:30.151095 |
updated_at | 2024-08-19 07:08:41.775948 |
description | Fuzzy matching tool to find string similarity |
homepage | |
repository | https://github.com/AnarchistHoneybun/rizzer |
max_upload_size | |
id | 1343470 |
size | 10,561 |
Rust Fuzzy Matching Library
This library implements a fuzzy string matching algorithm based on the algorithm used by fzf. A very poor port for now, but I'll try to improve it over time.
The algorithm works as follows:
The matching process assigns higher scores to continuous matches and matches at word boundaries, making it particularly effective for searching within longer texts or lists of items.
The library exposes two main functions:
fuzzy_match(text: &str, pattern: &str, case_sensitive: bool, normalize: bool) -> (isize, isize, i32, Vec<usize>)
text
and pattern
.fuzzy_match_score(text: &str, pattern: &str, case_sensitive: bool, normalize: bool) -> i32
Both functions accept the following parameters:
text
: The text to search inpattern
: The pattern to search forcase_sensitive
: Whether the match should be case-sensitivenormalize
: Whether to apply Unicode normalizationUse these functions to implement fuzzy searching in your Rust applications. The best use I've found is for matching on lists of strings for autocomplete, result filtering etc.