barrust / pyspellchecker

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

Wrong correction suggestion #63

Closed nshresthan closed 4 years ago

nshresthan commented 4 years ago

I am trying to use the spellchecker, but it gives the same word as correction even it is not the correct word.

spell_en = SpellChecker()
miss_en = spell_en.unknown(["rlnwatvwv", "reditanstalt", "uivrv", "candidates","gibaatwwxxx"])
for word in miss_en:
    print("misspelled word: ", word)
    print("suggested correction: ", spell_en.correction(word))
    print("candidates: ", spell_en.candidates(word))
    print("----------")

output: misspelled word: uivrv suggested correction: livre candidates: {'livre'}

misspelled word: reditanstalt suggested correction: reditanstalt candidates: {'reditanstalt'}

misspelled word: gibaatwwxxx suggested correction: gibaatwwxxx candidates: {'gibaatwwxxx'}

misspelled word: rlnwatvwv suggested correction: rlnwatvwv candidates: {'rlnwatvwv'}

barrust commented 4 years ago

Actually, in candidates and correction it returns the word back if no options are found. The way you know if it worked is just to check if the result is the word that you put in!

FuzzyCoder commented 2 years ago

The documentation states otherwise.