spellkit
Native spell checking with a small Rust API.
This project is based on euclio/spellbound (last upstream commit 2020).
| Platform | API |
|---|---|
| macOS | NSSpellChecker |
| Windows | ISpellChecker |
| *nix | hunspell |
Example
use Checker;
Checker::new() defaults to English (en_US / en_GB on Linux, en-US on Windows). Use with_locale for another language. Locales may be written as en_US or en-US.
Unknown or unsupported locales behave differently by platform:
- Linux: missing dictionary / unknown locale →
Error::Unavailable - macOS: empty locale →
Error::Unavailable; unknown tags may still create a checker (system fallback) - Windows: unsupported language tag →
Error::Unavailable
Threading
macOS serializes access to the shared NSSpellChecker. Do not assume Checker is Send / Sync across platforms.
Linux
Needs a hunspell dictionary on disk (default search includes /usr/share/hunspell). Example:
- Arch:
pacman -S hunspell hunspell-en_us - Debian/Ubuntu:
apt install libhunspell-dev hunspell-en-us
Without a dictionary, Checker::new() returns Error::Unavailable.
License
MIT OR Apache-2.0
Credits
Originally by Andy Russell. Maintained as spellkit by Robert Mongold.