CountVectorizer忽略大写单词的原因是什么?
cv = CountVectorizer(stop_words=None,analyzer='word',token_pattern='.*',max_features=None)
text = ['this','is','a','Test','!']
fcv = cv.fit_transform(list)
fcv = [cv.vocabulary_.get(t) for t in text]
print fcv
返回
[5, 3, 2, None, 1]
答案 0 :(得分:4)
这是因为lowercase
默认设置为True
CountVectorizer
,添加lowercase=False
。
cv = CountVectorizer(stop_words=None, analyzer='word', token_pattern='.*',
max_features=None, lowercase=False)