Skip to content

Instantly share code, notes, and snippets.

@aaronkub
Created September 8, 2018 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronkub/99777e9819342f2c440a91ef810ddd24 to your computer and use it in GitHub Desktop.
Save aaronkub/99777e9819342f2c440a91ef810ddd24 to your computer and use it in GitHub Desktop.
def get_lemmatized_text(corpus):
from nltk.stem import WordNetLemmatizer
lemmatizer = WordNetLemmatizer()
return [' '.join([lemmatizer.lemmatize(word) for word in review.split()]) for review in corpus]
lemmatized_reviews = get_lemmatized_text(reviews_train_clean)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment