CountVectorizer 忽略大写



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]

这是由于lowercaseCountVectorizer中默认设置为True,添加lowercase=False

cv = CountVectorizer(stop_words=None, analyzer='word', token_pattern='.*',
max_features=None, lowercase=False)

相关内容

  • 没有找到相关文章

最新更新