Turning short reviews into token-count columns
A count vectorizer learns a vocabulary and represents each document by term counts.
CountVectorizer in practice
With whitespace tokenization, “easy easy cheap” adds two to the easy column. Word order disappears and languages without spaces need an explicit tokenizer.
中文
词频向量如何把短评变成表格?
词袋计数先学习词表,再让每行记录一篇文档里各词出现的次数。
CountVectorizer 应用实例
“好用 好用 便宜”若按空格切分,前两词对同一列贡献 2。词袋会丢失词序,中文文本还要明确分词策略。