def lemmatize(text): lemmatizer = WordNetLemmatizer() return ' '.join(lemmatizer.lemmatize(word) for word in text.split())