1

我想使用 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一起使用,我就无法让它工作。

4

0 回答 0