Registry / data / symspellpy

symspellpy

JSON →
library6.10.0pypypi✓ verified 26d ago

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.

pip install symspellpy
INSTALL
IMPORT
SIG · SYMSPELLPY
S
symspellpy
datapythonv6.10.0
Install
1.7s avg
Import
71ms
Disk
23MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v6.10.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.078s · 24.2MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.7s · import 0.064s · 25MB
23MB installed
● package 23MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SymSpell
✓ from symspellpy import SymSpell
Verbosity
✓ from symspellpy import Verbosity
DistanceAlgorithm
✓ from symspellpy.editdistance import DistanceAlgorithm
✗ from symspellpy import DistanceAlgorithm
DistanceAlgorithm is located in the `symspellpy.editdistance` submodule, not directly under `symspellpy`.

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()`.

from symspellpy import SymSpell, Verbosity import os # Initialize SymSpell sym_spell = SymSpell(max_dictionary_edit_distance=2, prefix_length=7) # A simple corpus for demonstration (in a real app, load from file) dictionary_corpus = {"apple": 10, "banana": 8, "aple": 2, "apply": 5} for term, count in dictionary_corpus.items(): sym_spell.create_dictionary_entry(term, count) # Example usage: lookup a word input_term = "aple" suggestions = sym_spell.lookup(input_term, Verbosity.CLOSEST, max_edit_distance=2) print(f"Input: '{input_term}'") print("Suggestions:") for suggestion in suggestions: print(f" {suggestion.term} (distance: {suggestion.distance}, count: {suggestion.count})") # Example usage: lookup compound words input_phrase = "whereis th elibary" suggestions_compound = sym_spell.lookup_compound(input_phrase, max_edit_distance=2) print(f"\nInput phrase: '{input_phrase}'") print("Compound suggestions:") for suggestion in suggestions_compound: print(f" {suggestion.term} (distance: {suggestion.distance}, count: {suggestion.count})")
Debug
Known issues
breakingSymSpellPy 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.
fix
Upgrade your Python interpreter to version 3.9 or newer. Consider using a virtual environment to manage Python versions.
affects: >=6.7.7
breakingAs 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.
fix
Ensure all frequency counts in your dictionary data are parsed and stored as 64-bit integers before being passed to SymSpellPy.
affects: >=6.9.0
breakingIn 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.
fix
Review any custom distance comparer implementations or direct calls to distance calculation methods and adjust argument names if they use `string1` or `string2`.
affects: >=6.9.0
gotchaPrior 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.
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.
affects: >=6.7.7
gotchaWhen 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.
fix
Always use `ignore_non_words=True` in conjunction with `ignore_term_with_digits=True` to ensure proper behavior.
affects: >=6.7.3
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'symspellpy'
The `symspellpy` package is not installed in the current Python environment.
fix
pip install symspellpy
FileNotFoundError: [Errno 2] No such file or directory: 'frequency_dictionary_en_82_765.txt'
The dictionary file specified in `load_dictionary` or `load_bigram_dictionary` does not exist at the provided path.
fix
Ensure the dictionary file exists and provide the correct absolute or relative path to it in your code, e.g., `sym_spell.load_dictionary("path/to/frequency_dictionary_en_82_765.txt", 0, 1)`.
AttributeError: 'SymSpell' object has no attribute 'distance_algorithm'
Users often try to directly access or modify `distance_algorithm` as a property after `SymSpell` initialization, but it is an internal configuration parameter set during instantiation.
fix
Configure the `distance_algorithm` (and other related parameters like `max_dictionary_edit_distance`, `prefix_length`) when creating the `SymSpell` object, e.g., `from symspellpy import SymSpell, DistanceAlgorithm
sym_spell = SymSpell(max_dictionary_edit_distance=2, prefix_length=7, distance_algorithm=DistanceAlgorithm.DAMERAU_LEVENSHTEIN)`.
TypeError: max_dictionary_edit_distance must be an int
The `max_dictionary_edit_distance` parameter received a non-integer value (e.g., a string or float) during `SymSpell` object initialization.
fix
Provide an integer value for `max_dictionary_edit_distance` when instantiating `SymSpell`, for example: `from symspellpy import SymSpell
sym_spell = SymSpell(max_dictionary_edit_distance=2)`.
Upgrade
Version history
6.10.0latest on PyPI · released Jul 11, 2026
Audit
Dependencies
editdistpyrequiredProvides fast edit distance calculation algorithms, which SymSpellPy uses for its core functionality.
Agent activity
22 hits · last 30 days
node
18
Amazon
1
OpenAI (training)
1
Resources
symspellpy — pip install symspellpy · libregistry