【python】jieba分词,简单版

读取txt文本内容并使用jieba进行分词。

import jieba
fR = open('gp.txt', 'r', encoding='UTF-8')
sent = fR.read()
sent_list = jieba.cut(sent)
fW = open('gp2.txt', 'w', encoding='UTF-8')
fW.write(' '.join(sent_list))
fR.close()
fW.close()
原文地址:https://www.cnblogs.com/helenlee01/p/12617478.html