Python library for spell-checking text in multiple languages, backed by pyenchant.
Supported languages: ru_RU, en_US, es_ES, fr_FR, de_DE, pt_PT
pip install spellchecks
# or
uv add spellchecksThese are native OS packages — they cannot be installed from PyPI.
| Package | Purpose |
|---|---|
libenchant-2 |
C library that pyenchant wraps; provides the spell-checking abstraction layer |
aspell |
Spell-checking backend used by enchant at runtime |
aspell-en / aspell-ru / aspell-es / aspell-fr / aspell-de / aspell-pt |
Per-language word dictionaries for aspell |
# macOS (installs enchant + hunspell backend + EN dictionary)
brew install enchant
export PYENCHANT_LIBRARY_PATH=/opt/homebrew/lib/libenchant-2.dylib
# additional languages via hunspell dicts, e.g.:
brew install hunspell
# place .dic/.aff files in ~/Library/Spelling/
# Debian/Ubuntu
apt-get install libenchant-2-dev aspell aspell-en aspell-ru aspell-es aspell-fr aspell-de aspell-pt-brfrom spellchecks import SpellChecker
checker = SpellChecker(language="ru_RU")
corrections = checker.check("Превед медвет")
# [OneCorrection(first_position=0, last_position=6, word='Превед', suggestions=(...)),
# OneCorrection(first_position=7, last_position=13, word='медвет', suggestions=(...))]from spellchecks import SpellChecker, FileProvider
provider = FileProvider("/data/dicts")
provider.add_word("alice", "Превед") # add to alice's personal dictionary
words = provider.get_words("alice")
checker = SpellChecker(language="ru_RU", exclusion_words=words)
corrections = checker.check("Привет Превед")
# Превед is now excluded from correctionsSpellChecker(*, language, exclusion_words=(), exclude_urls=True, cache_size=10000, max_suggestions=0)
language— one of the supported language codesexclusion_words— iterable of words to ignore (case-insensitive)exclude_urls— automatically ignore URLs found in the text (defaultTrue)cache_size— LRU cache size for suggestions;0disables caching (default10000)max_suggestions— max suggestions per misspelled word;0= unlimited (default0)
SpellChecker.check(text)
text— text to check
Implement UserDictProtocol for custom storage backends:
from spellchecks import UserDictProtocol
class RedisProvider:
def get_words(self, user_name: str) -> list[str]: ...
def add_word(self, user_name: str, word: str) -> None: ...
def remove_word(self, user_name: str, word: str) -> None: ...uv sync --all-groups
just lint
just test