barrust / pyspellchecker

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

No correction on misspelled words #120

Closed edoumazane closed 2 years ago

edoumazane commented 2 years ago

Hello, I recently installed pyspellchecker and it appears it's not working properly. I can't figure out what's wrong.

from spellchecker import SpellChecker
spell = SpellChecker()

spell.correction('hapenning')
# 'happenning' -> ok

spell.correction('helo')
# 'helo'

spell.known(['adress'])
# {'adress'}

Here's about my versions:

barrust commented 2 years ago

It looks like both words are in the dictionary. adress is in error due to the opensource nature of the data used to build the dictionary, but helo means helicopter and therefore one could argue isn't misspelled.

words = ["adress", "helo"]
for w in words:
    if w in spell:
        print(w, spell.word_frequency[w])

The library is working as intended, but since the dictionary build is automated using open source subtitles, there are bound to be errors. You can see how the dictionary is built in scripts/build_dictionary.py.

As always, help cleaning up the dictionaries is the best place to help (i.e., by updating the build_dictionary.py script).