Skip to content

Instantly share code, notes, and snippets.

@prateekjoshi565
Created April 21, 2019 12:17
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 prateekjoshi565/30821151888d76abbcaaceee458c4929 to your computer and use it in GitHub Desktop.
Save prateekjoshi565/30821151888d76abbcaaceee458c4929 to your computer and use it in GitHub Desktop.
genre_stopwords_remove
from nltk.corpus import stopwords
stop_words = set(stopwords.words('english'))
# function to remove stopwords
def remove_stopwords(text):
no_stopword_text = [w for w in text.split() if not w in stop_words]
return ' '.join(no_stopword_text)
movies_new['clean_plot'] = movies_new['clean_plot'].apply(lambda x: remove_stopwords(x))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment