首页 > 其他 > 详细

1.英文词频统2.中文词频统计

时间:2018-03-28 22:31:14      阅读:193      评论:0      收藏:0      [点我收藏+]

1.英文词频统

news=‘‘‘
Guo Shuqing, head of the newly established China banking and insurance regulatory commission, was appointed Party secretary and vice-governor of the central bank on Monday, according to an announcement published on the People‘s Bank of China website.
 
Guo, 61, former chairman of the China Banking Regulatory Commission, became Party secretary as well as chairman last week of the new banking and insurance regulatory commission, which combines the role of CBRC and the China Insurance Regulatory Commission.
 
Yi Gang, 60, the newly elected central bank governor, was also appointed the Party‘s deputy chief of the central bank.
 
Experts said former governors of the central bank also have held the title of Party chief, but the unusual arrangement will improve coordination between regulators of different sectors.
 
Experts said the PBOC leadership adjustment could be in line with the country‘s newly restructured financial regulatory framework, on top of which is the cabinet-level financial stability and development committee established in November.
 
It coordinates with the PBOC and two specialized supervision bodies-the newly merged banking and insurance regulatory commission, and the China Securities Regulatory Commission.
 
As part of the State institutional reform plan approved by the first session of the 13th National People‘s Congress last week, the new watchdog for banking and insurance will be directly led by the State Council, China‘s Cabinet, which aims to strengthen regulation and prevent systemic financial risks, experts have said.
 
Under the reform plan, functions and duties, including drafting key financial regulations and supervision of the basic financial system, will belong to the PBOC.
 
Ming Ming, an analyst with CITIC Securities, said Guo‘s appointment is expected to solve existing problems with the goal of forestalling and defusing major risks.
‘‘‘
sep = ‘‘‘,.?":;()‘‘‘
for in sep:

    news = news.replace(c,‘ ‘)
 
wordList = news.lower().split()
for w in wordList:
    print(w)
wordDist = {}
wordSet = set(wordList)
for w in wordSet:
    wordDist[w] = wordList.count(w)
 
for w in wordDist:
    print(w, wordDist[w])
dictList = list(wordDist.items())
dictList.sort(key = lambda x: x[1], reverse=True)
exclude = {the,of,and,s,to,which,will,as,on,is,by,}
wordSet=set(wordList)-exclude
for w in wordSet:
    wordDist[w]=wordList.count(w)
for i in range(20):
    print(dictList[i])
f=open(news.txt,r,encoding=utf-8)
news=f.read()
f.close()
print(news)
f=open(newscount.txt,a)
for i in range(25):
    f.write(dictList[i][0]+ +str(dictList[i][1])+\n)
f.close()

2.中文词频统计

import jieba
 
file=open(hong.txt,r,encoding=utf-8)
word=file.read()
file.close()
wordList=list(jieba.cut_for_search(word))
 
wordDist={}
for w in wordList:
    wordDist[w] = wordList.count(w)
 
for w in wordDist:
    print(w, wordDist[w])
dictList = list(wordDist.items())
dictList.sort(key = lambda x: x[1], reverse=True)
sep=‘‘‘,。?“”:、?;!!‘‘‘
 
exclude ={ ,\n,,,\u3000,,,,,,,,,,,,}
 
for c in sep:
    word = word.replace(c, )
 
wordSet=set(wordList)-exclude
f=open(hongcount.txt,a)
for i in range(20):
    f.write(dictList[i][0]+ +str(dictList[i][1])+\n)
f.close()

 

1.英文词频统2.中文词频统计

原文:https://www.cnblogs.com/weiboblogs/p/8666586.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!