将文档添加到scikit-learn的CountVectorizer中?

时间:2017-04-21 14:51:48

标签: scikit-learn tf-idf countvectorizer

我想使用CountVectorizer将文档添加到预生成的矩阵中。

word_counter = CountVectorizer()
words_matrix = word_counter.fit_transform(['first string','second string'])

现在我想添加另一个字符串' 第三个​​字符串'到 words_matrix 。扩展矩阵 - 如下所示:

words_matrix += word_counter.fit_transform(['third string'])

但如果没有fit_transform 这一切,我就无法让它发挥作用。

0 个答案:

没有答案
相关问题