Skip to content

Instantly share code, notes, and snippets.

@aaronkub
Last active September 29, 2018 15:59
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/282a9f377d3ff5f8073464727a980d1f to your computer and use it in GitHub Desktop.
Save aaronkub/282a9f377d3ff5f8073464727a980d1f to your computer and use it in GitHub Desktop.
from nltk.corpus import stopwords
english_stop_words = stopwords.words('english')
def remove_stop_words(corpus):
removed_stop_words = []
for review in corpus:
removed_stop_words.append(
' '.join([word for word in review.split()
if word not in english_stop_words])
)
return removed_stop_words
no_stop_words = remove_stop_words(reviews_train_clean)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment