text_plain_output_1.png image_output_1.png
from sklearn.feature_extraction.text import TfidfVectorizer

from sklearn.feature_extraction.text import TfidfVectorizer
corpus = ['I live in Mumbai', 'I like Mumbai', 'I dont like Pune']
vectorizer = TfidfVectorizer()
X = vectorizer.fit_transform(corpus)
print(vectorizer.get_feature_names_out())
print(X)