Skip to content Skip to sidebar Skip to footer

How To Iterate Each Word Through Nltk Synsets And Store Misspelled Words In Separate List?

I am trying to take a text file with messages and iterate each word through NLTK wordnet synset function. I want to do this because I want to create a list of mispelled words. For

Solution 1:

You already have the pseudocode in your explanation, you can just code it as you have explained, as follows:

misspelled_words = []                 # The list to store misspelled words
for word in chat_messages_tokenized:  # loop through each word
    if not wn.synset(word):           # if there is no synset for this word
        misspelled_words.append(word) # add it to misspelled word list

print(misspelled_words)

Post a Comment for "How To Iterate Each Word Through Nltk Synsets And Store Misspelled Words In Separate List?"