Expand description
A spellchecking library compatible with the Hunspell dictionary format.
Spellbook is a lightweight library to do spellchecking based on Hunspell dictionaries. It’s
essentially a rewrite of the excellent C++ library Nuspell in Rust. Spellbook is no_std
(but requires alloc) and carries only hashbrown
as a dependency.
let aff = std::fs::read_to_string("./vendor/en_US/en_US.aff").unwrap();
let dic = std::fs::read_to_string("./vendor/en_US/en_US.dic").unwrap();
let dict = spellbook::Dictionary::new(&aff, &dic).unwrap();
assert!(dict.check("hello"));
assert!(dict.check("world"));
assert!(!dict.check("foobarbaz"));
Structs§
- Checker
- A wrapper struct for a dictionary that allows customizing checking behavior.
- Dictionary
- A data structure allowing for fast lookup of words in a dictionary.
- Parse
Dictionary Error - Suggester
- A wrapper struct for a dictionary that allows customizing suggestion behavior.
Enums§
Constants§
- MAX_
WORD_ LEN - The maximum allowed length of a word in bytes.
Type Aliases§
- Default
Hash Builder - Default hasher for hash tables.