sklearn实战-乳腺癌细胞数据挖掘
https://study.163.com/course/introduction.htm?courseId=1005269003&utm_campaign=commission&utm_source=cp-400000000398149&utm_medium=share
结果保存在result.txt文档内
# -*- coding: utf-8 -*-
import jieba
import sys
from collections import Counter
import jieba.analyse
filename="招聘分析.txt"
def fenci(filename) :
f = open(filename,'r+')
file_list = f.read()
f.close()
seg_list = list(jieba.cut(file_list,cut_all=True))
tf={}
for seg in seg_list :
#print seg
seg = ''.join(seg.split())
if (seg != '' and seg != "\n" and seg != "\n\n") :
if seg in tf :
tf[seg] += 1
else :
tf[seg] = 1
f = open("result.txt","w+")
for item in tf:
#print item
f.write(item+" "+str(tf[item])+"\n")
f.close()
fenci(filename)