Expand description
symspellrs - library exports and PHF integration point
This crate exposes the symspell module which contains the core implementation.
It also re-exports a compile-time proc-macro include_dictionary! (from the
symspellrs_macros crate) that can embed a dictionary and a precomputed
deletion-index (PHF maps) at compile time and return an EmbeddedSymSpell.
Examples
- Compile-time embedding (recommended when you want the dictionary embedded in the binary):
ⓘ
use symspellrs::include_dictionary;
// Returns an `EmbeddedSymSpell` constructed from PHF statics emitted by the macro.
let embedded = include_dictionary!("path/to/words.txt", max_distance = 2, lowercase = true);
let suggestions = embedded.find_top("helo");- Runtime construction (useful when loading dictionaries from dynamic sources):
ⓘ
use symspellrs::{SymSpell, Verbosity};
let entries = vec![("hello".to_string(), 1usize), ("world".to_string(), 1usize)];
let sym = SymSpell::from_iter(2, entries);
let results = sym.lookup("helo", 2, Verbosity::Closest);Re-exports§
pub use symspell::EmbeddedSymSpell;pub use symspell::Suggestion;pub use symspell::SymSpell;pub use symspell::Verbosity;
Modules§
- symspell
- symspell module
Macros§
- include_
dictionary - Re-export the compile-time dictionary macro from the proc-macro crate.