Fuzzy Prefix Search
Flexible Trie implementation in Rust for fuzzy prefix string searching and auto-completion.
Documentation:
Features
- Fast prefix-based fuzzy searching (Levenshtein distance)
- Fuzzy search with customizable edit distance
- Multiple data associations per word
- Jaro-Winkler similarity scoring for search results
- No unsafe
- No dependencies
Installation
Add this to your Cargo.toml:
[]
= "0.1"
Usage
Here's a quick example of how to use the Fuzzy Prefix Search:
use Trie;
Advanced Usage
Custom Data Types
The Trie supports any data type that implements Clone, Default, PartialEq, Eq, and Hash:
let mut trie = new;
trie.insert;
Removing Data
You can remove all occurrences of a specific data value:
trie.remove_all;
Performance
- O(k) time complexity for insertion, where k is the length of the word
- Space-efficient storage using a tree structure with shared prefixes
- TODO: Benchmarks, optimizations, algorithm selection...
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Resources
- https://phiresky.github.io/levenshtein-demo/
- https://www.geeksforgeeks.org/trie-insert-and-search/
- http://stevehanov.ca/blog/?id=114
- https://murilo.wordpress.com/2011/02/01/fast-and-easy-levenshtein-distance-using-a-trie-in-c/
- https://blog.vjeux.com/2011/c/c-fuzzy-search-with-trie.html
License
This project is licensed under the MIT or Apache 2.0 License - see the LICENSE files for details.