TfidfVectorizer
Import
from sklearn.feature_extraction.text import TfidfVectorizerVectorise corpus
corpus = [] # list of strings
vectorizer = TfidfVectorizer()
X = vectorizer.fit_transform(corpus)View the features (aka the words it thinks are important)
# print the following
vectorizer.get_feature_names()Remove words that are pointless
# change the code above to
vectorizer = TfidfVectorizer(max_df=0.5)
# this will only look at words that are used infrequently