1.英文词频统2.中文词频统计(代码片段)

猿仙笙 猿仙笙     2022-10-29     247

关键词:

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.从文件读取待分析文本。3.安装并使用jieba进行中文分词。pipinstalljiebaimportjiebaljieba.lcut(text)4.更新词库,加入所分析对象的专业词汇。jieba.add_word(‘天罡北斗阵‘) #逐个添加jieba.load_userdi... 查看详情

综合练习:词频统计(代码片段)

1.英文词频统f=open(‘lyric.txt‘,‘r‘)lyric=f.read()f.close()punctuation=‘‘‘,.?/:;‘"‘‘‘a=‘in‘,‘on‘,‘with‘,‘by‘,‘for‘,‘at‘,‘about‘,‘under‘,‘of‘,‘i‘,‘a‘,‘is‘,‘its‘,‘so‘,‘and‘,‘dont‘,‘it‘,‘to‘,‘ill‘,‘t... 查看详情

软件工程个人作业词频统计(代码片段)

---恢复内容开始---  软件工程个人作业——单词频率统计曾子轩Schoolofinformation,USTC一、项目介绍与分析(作业要求:http://www.cnblogs.com/denghp83/p/8627840.html)  项目介绍:    1. 统计文件的字符数    2. 统计... 查看详情

中文词频统计(代码片段)

中文词频统计1.下载一长篇中文小说。2.从文件读取待分析文本。3.安装并使用jieba进行中文分词。pipinstalljiebaimportjiebaljieba.lcut(text)4.更新词库,加入所分析对象的专业词汇。jieba.add_word(‘天罡北斗阵‘) #逐个添加jieba.load_userdi... 查看详情

中文词频统计(代码片段)

...进行中文分词。pipinstalljiebaimportjiebalist(jieba.lcut(news))生成词频统计排序排除语法型词汇,代词、冠词、连词输出词频最大TOP20 importjiebafo=open("xiyouji 查看详情

中文词频统计(代码片段)

中文词频统计1.下载一长篇中文小说。2.从文件读取待分析文本。3.安装并使用jieba进行中文分词。pipinstalljiebaimportjiebaljieba.lcut(text)4.更新词库,加入所分析对象的专业词汇。jieba.add_word(‘天罡北斗阵‘) #逐个添加jieba.load_userdi... 查看详情

中文词频统计(代码片段)

...进行中文分词。pipinstalljiebaimportjiebalist(jieba.lcut(news))生成词频统计排序排除语法型词汇,代词、冠词、连词输出词频最大TOP20#-*-coding:UTF-8-*-#-*-author:Kam 查看详情

中文词频统计(代码片段)

...进行中文分词。pipinstalljiebaimportjiebalist(jieba.lcut(news))生成词频统计排序排除语法型词汇,代词、冠词、连词输出词频最大TOP20 importjiebaf=open(‘好吗.txt‘, 查看详情

201671030119词频统计软件项目报告(代码片段)

...统计软件源码需求分析-使用JAVA编程语言,独立完成一个英文文本词频统计的软件开发-软件基本功能要求如下:1.程序可读入任意英文文本文件,该文件中英文词数大于等于1个。2.程序需要很壮健,能读取容纳英文原版《哈利波... 查看详情

中文词频统计(代码片段)

...进行中文分词。pipinstalljiebaimportjiebalist(jieba.lcut(news))生成词频统计排序排除语法型词汇,代词、冠词、连词输出词频最大TOP20 将代码与运行结果截图发布在博客上。importjieb 查看详情

中文词频统计(代码片段)

...进行中文分词。pipinstalljiebaimportjiebalist(jieba.lcut(news))生成词频统计排序排除语法型词汇,代词、冠词、连词输出词频最大TOP20 将代码与运行结果截图发布在博客上。importjieb 查看详情

中文词频统计(代码片段)

...进行中文分词。pipinstalljiebaimportjiebalist(jieba.lcut(news))生成词频统计排序排除语法型词汇,代词、冠词、连词输出词频最大TOP20  #coding=utf-8impor 查看详情

中文词频统计(代码片段)

...;…"forvinjieba.cut(str):   print(v)  中文词频统计1.下载一长篇中文小说。  2.从文件读取待分析文本。  3.安装并使用jieba进行中文分词。pipinstalljiebaimportjiebaljieba.lcut(text) 4.更新词库,加入所分... 查看详情

中文词频统计(代码片段)

importjiebaf=open(‘novel.txt‘,‘r‘,encoding=‘utf-8‘)content=f.read()f.close()symbol=‘‘‘。,“”!?\n();‘‘‘foriinsymbol:content=content.replace(i,‘‘)#使用jieba进行中文分词contentList=list(jieba.cut(content))#生成词频统计c 查看详情

中文词频统计

...文长篇小说,并转换成UTF-8编码。2.使用jieba库,进行中文词频统计,输出TOP20的词及出现次数。3.排除一些无意义词、合并同一词。4.对词频统计结果做简单的解读。代码如下:importjiebatxt=open(‘aaa.txt‘,‘r‘,encoding=‘utf-8‘).read(... 查看详情

中文词频统计(代码片段)

#coding=utf--8importjiebaexclude=‘,‘,‘、‘,‘。‘,‘\u3000‘,‘\n‘,‘"‘,"《",‘》‘,‘?‘txt=open(‘doupo.txt‘,‘r‘).read()wordList=list(jieba.cut(txt))wordSet=set(wordList)-excludewordDict=forwinwordSet:wordDict[ 查看详情

中文词频统计(代码片段)

importjiebafo=open(‘aaa.txt‘,‘r‘,encoding=‘utf-8‘)text=fo.read()text2=list(jieba.lcut(text))sign=‘你‘,‘‘,‘我‘,‘我们‘,‘他‘,‘他们‘,‘我的‘,‘他的‘,‘你的‘,‘呀‘,‘和‘,‘是‘,‘,‘,‘。‘,‘:‘,‘“‘,‘”‘,‘的‘... 查看详情

中文词频统计

1.下载一中文长篇小说,并转换成UTF-8编码。2.使用jieba库,进行中文词频统计,输出TOP20的词及出现次数。3.排除一些无意义词、合并同一词。4.对词频统计结果做简单的解读。  查看详情