Fuzzies
Fuzzies is a fast, friendly integration layer that bridges the gap between low-level finite state transducers (fst) and Levenshtein automata, saving you from writing tedious boilerplate.
More information about this crate can be found in the crate documentation
Installation
Example
use ;
Embedding Data
If you don't want to manage external .fst files on disk, embed the dataset directly into your application:
static DICT_DATA: & = include_bytes!;
let dict = from_embedded?;
Built with Fuzzies
Check out real-world projects utilizing fuzzies:
- Mamoru: A blazing-fast Git
commit-msghook that embeds a compiled dictionary of over 106,000 words to instantly catch and block typos before they make it into your version control history.
🎈 Performance
The following benchmarks were gathered using Criterion on an Intel Core i5-10300H (4 cores / 8 threads). You can re-run these on your hardware with cargo bench.
[!NOTE] Running cargo bench on the published crate executes against a small, dynamically generated dataset. The 106,000-word benchmarks shown below were gathered independently using a local dictionary.
| Operation | 1,000 Entries | 106,000 Entries | Scaling Factor |
|---|---|---|---|
| contains (Hit) | 34.60 ns | 65.00 ns | ~1.8x |
| contains (Miss) | 11.08 ns | 100.06 ns | ~9.0x |
| Exact Search (dist = 0) | 2.18 µs | 4.48 µs | ~2.0x |
| Fuzzy Search (dist = 1) | 7.97 µs | 61.58 µs | ~7.7x |
| Prefix Search | 5.53 µs | 125.36 µs | Result-size bound |
Range Search ('b'..='c') |
4.35 µs | 626.37 µs | Result-size bound |
| Batch (1,000 queries) | 4.02 ms (4.0 µs/q) | 14.88 ms (14.8 µs/q) | ~3.7x |
License
This project is licensed under the MIT license.