Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No correction on misspelled words #120

Closed
edoumazane opened this issue Mar 15, 2022 · 1 comment · Fixed by #121
Closed

No correction on misspelled words #120

edoumazane opened this issue Mar 15, 2022 · 1 comment · Fixed by #121

Comments

@edoumazane
Copy link

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:

  • Python 3.8.10
  • Pyspellchecker 0.6.3
@barrust
Copy link
Owner

barrust commented Mar 19, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants