{"id":4717,"library":"pyspellchecker","title":"pyspellchecker","description":"pyspellchecker is a pure Python spell checker based on Peter Norvig's blog post, utilizing a Levenshtein Distance algorithm to find permutations and compare them to a word frequency list. It supports multiple languages including English, Spanish, German, French, Portuguese, Arabic, and Basque. The current version is 0.9.0, and it is actively maintained with updates to support newer Python versions.","status":"active","version":"0.9.0","language":"en","source_language":"en","source_url":"https://github.com/barrust/pyspellchecker","tags":["spell checking","nlp","text processing","levenshtein distance"],"install":[{"cmd":"pip install pyspellchecker","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Requires Python 3.10 or higher.","package":"python","optional":false}],"imports":[{"note":"While the PyPI package is 'pyspellchecker', the primary class is imported directly from the 'spellchecker' module.","wrong":"from pyspellchecker import SpellChecker","symbol":"SpellChecker","correct":"from spellchecker import SpellChecker"}],"quickstart":{"code":"from spellchecker import SpellChecker\n\nspell = SpellChecker()\n\nmispelled_words = spell.unknown(['something', 'is', 'hapenning', 'here'])\n\nfor word in mispelled_words:\n    print(f\"Correction for '{word}': {spell.correction(word)}\")\n    print(f\"Candidates for '{word}': {spell.candidates(word)}\")","lang":"python","description":"Initialize SpellChecker, identify unknown words, and get corrections or candidate spellings."},"warnings":[{"fix":"Upgrade Python to >=3.10 or pin `pyspellchecker` to a compatible version (e.g., `pyspellchecker<0.9.0`).","message":"Version 0.9.0 removed support for Python 3.8 and 3.9. Users on these Python versions should use an older pyspellchecker version (e.g., <=0.8.x).","severity":"breaking","affected_versions":">=0.9.0"},{"fix":"Ensure that `language` is not set when `case_sensitive=True` or `local_dictionary` is provided.","message":"As of version 0.9.0, a `ValueError` is raised if `language` is used simultaneously with `case_sensitive=True` or `local_dictionary` in the `SpellChecker` constructor, as these options are mutually exclusive.","severity":"breaking","affected_versions":">=0.9.0"},{"fix":"Initialize `SpellChecker(distance=1)` or set `spell.distance = 1` after instantiation.","message":"For longer words or performance-critical applications, it is highly recommended to set the `distance` parameter to 1 (default is 2) during `SpellChecker` initialization or afterwards. A higher distance increases computation time significantly.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Update code to explicitly check for `None` return values from `correction()` and `candidates()` to avoid unexpected `TypeError` or `AttributeError`.","message":"Since version 0.7.0, `spell.correction()` and `spell.candidates()` will return `None` if no valid corrections or candidates are found for a given word. Previously, they might have returned the original word or an empty set.","severity":"gotcha","affected_versions":">=0.7.0"},{"fix":"Consider integrating with a contextual spell checker or grammar checker for applications requiring semantic understanding, or build a highly specific custom dictionary for your domain.","message":"pyspellchecker works by comparing permutations to a word frequency list and does not inherently understand word context. This means it may suggest corrections that are grammatically or contextually incorrect in a sentence (e.g., correcting 'their' to 'there').","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}