Я только что установил проверку орфографии из источника:
git clone https://github.com/barrust/pyspellchecker.git
cd pyspellchecker
python setup.py install
Мой код:
from spellchecker import SpellChecker
spell = SpellChecker()
misspelled = SpellChecker.unknown(['something', 'is', 'hapenning', 'here'])
for word in misspelled:
print(spell.correction(word))
print(spell.candidates(word))
Ошибка:
Traceback (most recent call last):
File "/Users/saptarshi.d/Documents/Project/preprocessing.py", line 26, in <module>
spell = SpellChecker()
File "/Library/Python/2.7/site-packages/pyspellchecker-0.3.0-py2.7.egg/spellchecker/spellchecker.py", line 42, in __init__
self._word_frequency.load_dictionary(full_filename)
File "/Library/Python/2.7/site-packages/pyspellchecker-0.3.0-py2.7.egg/spellchecker/spellchecker.py", line 327, in load_dictionary
with gzip.open(filename, mode='rt', encoding=encoding) as fobj:
TypeError: open() got an unexpected keyword argument 'encoding'
Я не понимаю, как поступить.