Skip to content

Instantly share code, notes, and snippets.

@ken333135
Created June 19, 2018 02:11
Show Gist options
  • Save ken333135/07b1dd31d786b9cc9a1bd63aa217b0a8 to your computer and use it in GitHub Desktop.
Save ken333135/07b1dd31d786b9cc9a1bd63aa217b0a8 to your computer and use it in GitHub Desktop.
Get Top words for each class (multi-class text classification)
#creates an instance of the TfidfVectorizer
vect = TfidfVectorizer()
#fits the Tfidfvectorizer to your corpus, creating the vocabulary
vect.fit_transform(data_df['Your_freetext_column'])
#shows the fitted TfidfVectorizer and your corpus vocabulary
len(vect.vocabulary_)
vect.vocabulary_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment