{"id":5508,"library":"symspellpy","title":"SymSpellPy","description":"SymSpellPy is a Python port of the SymSpell spelling corrector, designed for high performance and low memory consumption. It provides fast fuzzy search and spell correction capabilities, capable of handling large dictionaries. The library is actively maintained, with a recent major release (v6.x) and a consistent release cadence addressing new features, bug fixes, and performance improvements.","status":"active","version":"6.9.0","language":"en","source_language":"en","source_url":"https://github.com/mammothb/symspellpy","tags":["spell-checker","natural-language-processing","fuzzy-search","correction","nlp"],"install":[{"cmd":"pip install symspellpy","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Provides fast edit distance calculation algorithms, which SymSpellPy uses for its core functionality.","package":"editdistpy","optional":false}],"imports":[{"symbol":"SymSpell","correct":"from symspellpy import SymSpell"},{"symbol":"Verbosity","correct":"from symspellpy import Verbosity"},{"note":"DistanceAlgorithm is located in the `symspellpy.editdistance` submodule, not directly under `symspellpy`.","wrong":"from symspellpy import DistanceAlgorithm","symbol":"DistanceAlgorithm","correct":"from symspellpy.editdistance import DistanceAlgorithm"}],"quickstart":{"code":"from symspellpy import SymSpell, Verbosity\nimport os\n\n# Initialize SymSpell\nsym_spell = SymSpell(max_dictionary_edit_distance=2, prefix_length=7)\n\n# A simple corpus for demonstration (in a real app, load from file)\ndictionary_corpus = {\"apple\": 10, \"banana\": 8, \"aple\": 2, \"apply\": 5}\nfor term, count in dictionary_corpus.items():\n    sym_spell.create_dictionary_entry(term, count)\n\n# Example usage: lookup a word\ninput_term = \"aple\"\nsuggestions = sym_spell.lookup(input_term, Verbosity.CLOSEST, max_edit_distance=2)\n\nprint(f\"Input: '{input_term}'\")\nprint(\"Suggestions:\")\nfor suggestion in suggestions:\n    print(f\"  {suggestion.term} (distance: {suggestion.distance}, count: {suggestion.count})\")\n\n# Example usage: lookup compound words\ninput_phrase = \"whereis th elibary\"\nsuggestions_compound = sym_spell.lookup_compound(input_phrase, max_edit_distance=2)\n\nprint(f\"\\nInput phrase: '{input_phrase}'\")\nprint(\"Compound suggestions:\")\nfor suggestion in suggestions_compound:\n    print(f\"  {suggestion.term} (distance: {suggestion.distance}, count: {suggestion.count})\")\n","lang":"python","description":"This quickstart demonstrates how to initialize SymSpell, manually create dictionary entries, and perform basic spell correction for single words and compound phrases. In a production environment, dictionaries are typically loaded from text files using `sym_spell.load_dictionary()`."},"warnings":[{"fix":"Upgrade your Python interpreter to version 3.9 or newer. Consider using a virtual environment to manage Python versions.","message":"SymSpellPy dropped support for Python 3.6 in v6.7.7 and Python 3.7/3.8 in v6.8.0. The library now requires Python 3.9 or higher. Ensure your environment meets this requirement.","severity":"breaking","affected_versions":">=6.7.7"},{"fix":"Ensure all frequency counts in your dictionary data are parsed and stored as 64-bit integers before being passed to SymSpellPy.","message":"As of v6.9.0, frequency counts provided to dictionary methods (e.g., `create_dictionary_entry`, `load_dictionary`) must be 64-bit integers. Passing smaller integers or non-integer types for counts may lead to unexpected behavior or errors.","severity":"breaking","affected_versions":">=6.9.0"},{"fix":"Review any custom distance comparer implementations or direct calls to distance calculation methods and adjust argument names if they use `string1` or `string2`.","message":"In v6.9.0, internal argument names `string1` and `string2` in distance comparison methods were renamed. If you have custom distance comparers or interact with these methods directly, you may need to update your code.","severity":"breaking","affected_versions":">=6.9.0"},{"fix":"Explicitly configure `symspellpy`'s logger using `logging.getLogger('symspellpy')` if you need to control its output, or ensure your root logger is configured independently.","message":"Prior to v6.7.7, `symspellpy` could inadvertently modify the root logger's configuration. Since v6.7.7, it correctly configures its own module logger. If your application relied on `symspellpy`'s old logging behavior, you may need to adjust your logging setup.","severity":"gotcha","affected_versions":">=6.7.7"},{"fix":"Always use `ignore_non_words=True` in conjunction with `ignore_term_with_digits=True` to ensure proper behavior.","message":"When using `ignore_term_with_digits=True` in `lookup` or `lookup_compound` methods, it is recommended to also set `ignore_non_words=True` for comprehensive filtering, as clarified in v6.7.3. Failing to do so might result in inconsistent filtering of terms with digits.","severity":"gotcha","affected_versions":">=6.7.3"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}