#fuzzy #trie #levenshtein #dictionary #dict

fuzzy_trie

Key-value collection to make fuzzy searches

12 releases (5 stable)

1.2.0 Sep 6, 2022
1.1.1 Mar 20, 2021
1.1.0 Aug 2, 2020
0.6.0 May 14, 2020
0.2.2 May 3, 2020

#347 in Data structures

Download history 3/week @ 2022-11-20 1/week @ 2022-11-27 1/week @ 2022-12-04 13/week @ 2022-12-11 1/week @ 2022-12-18 1/week @ 2022-12-25 1/week @ 2023-01-01 2/week @ 2023-01-08 1/week @ 2023-01-15 3/week @ 2023-01-22 8/week @ 2023-01-29 21/week @ 2023-02-05 24/week @ 2023-02-12 24/week @ 2023-02-19 24/week @ 2023-02-26

72 downloads per month

MIT license

16KB
311 lines

Key-value collection to make fuzzy searches

FuzzyTrie is a trie with a LevensteinAutomata to make fuzzy searches

Example

use fuzzy_trie::FuzzyTrie;

let mut trie = FuzzyTrie::new(2, false);
trie.insert("vanilla").insert("vanilla item");
trie.insert("hello").insert("hello item");
trie.insert("helo").insert("helo item");
trie.insert("vanllo").insert("vanllo item");


let mut hello = Vec::new();
trie.fuzzy_search("hello", &mut hello);
let mut hello_iter = hello.into_iter();

assert_eq!(hello_iter.next(), Some((0, &"hello item")));
assert_eq!(hello_iter.next(), Some((1, &"helo item")));
assert_eq!(hello_iter.next(), None);


let mut vanila = Vec::new();
trie.fuzzy_search("vanilla", &mut vanila);
let mut vanila_iter = vanila.into_iter();

assert_eq!(vanila_iter.next(), Some((0, &"vanilla item")));
assert_eq!(vanila_iter.next(), Some((2, &"vanllo item")));
assert_eq!(vanila_iter.next(), None);

Some more examples are in tests.rs


lib.rs:

Key-value collection to make fuzzy searches

Dependencies

~57KB