So I want to identify and count misspelled words.
I have managed to identify them, but it seems I cannot count them... Please bear in mind I am new to Python. I tried len, but it returned me the length of the word, and I tried count but I got nothing.
From the code below, I want to count the variable "wrong_words".
What am I doing wrong?
P.S:to be crystal clear, the misspelled words are 'hapenning', 'protugal'. And I want as output the sum of them, hence 2.
Thank you
from spellchecker import SpellChecker
spell = SpellChecker()
# find those words that may be misspelled
misspelled = spell.unknown(['something', 'is', 'hapenning', 'here', 'protugal'])
for word in misspelled:
# Get the one `most likely` answer
wrong_words = spell.correction(word)
print(wrong_words)