barrust / pyspellchecker

Pure Python Spell Checking http://pyspellchecker.readthedocs.io/en/latest/
MIT License
691 stars 101 forks source link

Not Working in Python 3.11 #138

Closed joeyagreco closed 1 year ago

joeyagreco commented 1 year ago

Running the sample code from the README file after running pip install pyspellchecker:

    from spellchecker import SpellChecker

    spell = SpellChecker()

    # find those words that may be misspelled
    misspelled = spell.unknown(['something', 'is', 'hapenning', 'here'])

    for word in misspelled:
        # Get the one `most likely` answer
        print(spell.correction(word))

        # Get a list of `likely` options
        print(spell.candidates(word))

Get this error:

Traceback (most recent call last):
  File "C:\test.py", line 9, in <module>
    from spellchecker import SpellChecker
  File "C:\AppData\Local\Programs\Python\Python311\Lib\site-packages\spellchecker\__init__.py", line 2, in <module>
    from  spellchecker.core import Spellchecker,getInstance
  File "C:\AppData\Local\Programs\Python\Python311\Lib\site-packages\spellchecker\core.py", line 26, in <module>
    from indexer import DictionaryIndex
ModuleNotFoundError: No module named 'indexer'
barrust commented 1 year ago

This error is not related to this package. If you look at the code, there is no call in this code to an indexer package. Also, since there are no dependencies, it cannot be that either. This error comes from the spellchecker package and not the pyspellchecker package.

see issue 24

see issue 73

The resolution is to uninstall the spellchecker package and install this package.