Advertisement
lessientelrunya

dictionary

Jun 29th, 2017
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. # Create bags-of-words matrix
  2. from sklearn.feature_extraction.text import CountVectorizer
  3. count_vect = CountVectorizer(stop_words = 'english')
  4. Z = count_vect.fit_transform(corpus)
  5. # The function fit_transform() takes as input a list of strings and does two things:
  6. # first, it "fits the model," i.e., it builds the vocabulary; second, it transforms the data into a matrix.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement