print "关键词提取:",",".join(listGJC)
---------------------词频统计
# coding=utf-8
'''
Created on 2018年3月19日
@author: chenkai
结巴分词
支持三种分词模式:
精确模式: 试图将句子最精确地切开,适合文本分析;
全模式: 把句子中所有的可以成词的词语都扫描出来, 速度非常快,但是不能解决歧义;
搜索引擎模式: 在精确模式的基础上,对长词再次切分,提高召回率,适合用于搜索引擎分词。
'''
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import jieba
import jieba.analyse
import re,collections
def getNum(text,path):
word = []
counter = {}
seg_list3 = jieba.cut(text,cut_all=True)
listStr="#".join(seg_list3)
#print "全模式: ",listStr
list3 = listStr.decode("utf-8").split('#')
for w in list3:
if not w in word:
word.append(w)
if not w in counter:
counter[w] = 1
else:
counter[w] += 1
counter_list = sorted(counter.items(), key=lambda x: x[1], reverse=True)
#print counter_list
f = open(path,"w")
for j in counter_list:
text= "\""+j[0].encode("gb18030").decode("gb18030")+"\","+str(j[1])
print text
f.write(text+"\n")
print "the result write in "+path+"..."
print "finish..."
f.close()
getNum(sys.argv[1],sys.argv[2])