最近再研究MapReduce对数据进行分析处理,意外发现了中文无法对词进行分析的问题。固选择使用Python的 jieba包来进行中文分词。 安装jieba包: pip install jieba
jieba的三种模式:
import jieba
seg_str
= "好好学习,天天向上。"
print("/".join
(jieba
.lcut
(seg_str
)))
print("/".join
(jieba
.lcut
(seg_str
, cut_all
=True)))
print("/".join
(jieba
.lcut_for_search
(seg_str
)))
转载请注明原文地址:https://tech.qufami.com/read-26290.html