【发布时间】:2019-03-14 03:33:54
【问题描述】:
拥有这样的语料库:
'This is the first document.',
'This document is the second document.',
'And this is the third one.',
'Is this the first document?'
我正在使用这个词汇[“this”、“document”、“this document”]。 在矢量化器拟合之后,我得到了这些结果:
[[1 1 0]
[1 2 1]
[1 0 0]
[1 1 0]]
这是正确的。 有没有办法我可以使用正则表达式(或其他东西)来在我的语料库的第一行中获取“此文档”功能? 更具体地说,这个 [1 1 1] 比 [1 1 0]?
我的行是这样的:[“这是第一个文档”]。 我可以以某种方式“删除”“是第一个”(或任何词)来获得“此文档”功能吗?也许使用 token_pattern?
【问题讨论】:
-
countVectorizer 应该打印特征的绝对计数。为什么你的价值观是浮动的?你怎么知道这些是正确的?显示代码并解释更多。
-
对不起,我只是编辑我的问题。
标签: scikit-learn text-analysis countvectorizer