Python 进行 结巴 分词

#一直因为这个编码问题没有分出来 ,后来多试验了几次就行了,供大家参考一下


import jieba

f1=open('all.txt','r',encoding='utf-8',errors='ignore')
f2=open('allutf8.txt','w',encoding='utf-8')

line=f1.readline()
while line:
seg_list=jieba.cut(line,cut_all=False)
f2.write(" ".join(seg_list))
line=f1.readline()
print(f2)
f1.close()
f2.close()

猜你喜欢

转载自www.cnblogs.com/cyh1989/p/9038383.html