Skip to content Skip to sidebar Skip to footer

Python Lemmatizing Input List, Return Output List

I have a list containing strings that I am lemmatizing. Though I can lemmatize all the strings, I am having a hard time returning the lemmatized strings in the same list format tha

Solution 1:

lmtzr.lemmatize takes a single string and returns a single string. So lemmatized_words will be a single string at a time.

To lemmatize all the words and store them in a list, you want something like this:

typea = ['colors', 'caresses', 'ponies', 'presumably', 'owed', 'says']
lemmatized_words = [lmtzr.lemmatize(x) for x in typea]
print lemmatized_words

Post a Comment for "Python Lemmatizing Input List, Return Output List"