小编ECu*_*evs的帖子

用于提取 ngram 的 TF-IDF 向量化器

如何使用TF-IDF vectorizer从scikit学习库提取unigramsbigrams鸣叫的?我想用输出训练分类器。

这是来自 scikit-learn 的代码:

from sklearn.feature_extraction.text import TfidfVectorizer
corpus = [
    'This is the first document.',
    'This document is the second document.',
    'And this is the third one.',
    'Is this the first document?',
]
vectorizer = TfidfVectorizer()
X = vectorizer.fit_transform(corpus)
Run Code Online (Sandbox Code Playgroud)

python n-gram scikit-learn tfidfvectorizer

5
推荐指数
1
解决办法
479
查看次数

标签 统计

n-gram ×1

python ×1

scikit-learn ×1

tfidfvectorizer ×1