We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
from sklearn.feature_extraction.text import TfidfVectorizer
text = ["The quick brown fox jumped over the lazy dog.", "The dog.", "The fox"]
vectorizer = TfidfVectorizer()
vectorizer.fit(text)
print(vectorizer.vocabulary_) print(vectorizer.idf_)
vector = vectorizer.transform([text[0]])
print(vector.shape) print(vector.toarray())
The text was updated successfully, but these errors were encountered:
No branches or pull requests
from sklearn.feature_extraction.text import TfidfVectorizer
list of text documents
text = ["The quick brown fox jumped over the lazy dog.",
"The dog.",
"The fox"]
create the transform
vectorizer = TfidfVectorizer()
tokenize and build vocab
vectorizer.fit(text)
summarize
print(vectorizer.vocabulary_)
print(vectorizer.idf_)
encode document
vector = vectorizer.transform([text[0]])
summarize encoded vector
print(vector.shape)
print(vector.toarray())
The text was updated successfully, but these errors were encountered: