完整中英文词频

Posted h000

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了完整中英文词频相关的知识,希望对你有一定的参考价值。

strRun=‘‘‘Well looky here looky here
Ah what do we have?
Another pretty thang ready for me to grab
But little does she know
That Im a wolf in sheeps clothingCause at the end of the night
It is her Ill be holding

I love you so
Thats what youll say
Youll tell me
Baby baby please dont go away
But when I play, I never stay

To every girl that I meet here this is what I say:
Run run run away, run away baby
Before I put my spell on you
You better get get get away get away darling
Cause everything you heard is true
Your poor little heart will end up alone
Cause lord knows Im a rolling stone
So you better run run run away run away baby

Well let me think let me think
Ah what should I do?
So many eager young bunnys
That Id like to pursue
Now even now they eating out the palm of my hand
Theres only one carrot and they all gotta share it

I love you so
Thats what youll say
Youll tell me
Baby baby please dont go away
But when I play, I never stay
To every girl that I meet here this is what I say:

Run run run away, run away baby
Before I put my spell on you
You better get get get away get away darling
Cause everything you heard is true
Your poor little heart will end up alone
Cause lord knows Im a rolling stone
So you better run run run away run away baby‘‘‘

strList = strRun.split()
print(len(strList), strList)

strListSort=strList.sort()
print(strListSort)
print(strList)

sep=.,:?!
for x in sep:
    j=strRun.replace(x,‘‘)
print(strRun)

strSet=set(strList)
exclude={"a","the","to","at"}
st=strSet-exclude
print(len(st),strSet)

strDict = {}
for word in strSet:
     strDict[word] = strList.count(word)
     print(len(strList),strList)

fo=open("英文歌词.txt","r",encoding=utf-8)
Run=fo.read()
fo.close()
print(Run)

import jieba
k=美国时代周刊电脑学习班电脑软甲学习计算机学习真的身份证号专业翻译
print(list(jieba.cut(k)))
print(list(jieba.cut(k,cut_all=True)))
print(list(jieba.cut_for_search(k)))

fo1=open("水浒传.txt","r",encoding=utf-8)
Run=fo1.read()
fo1.close()
print(Run)

print(list(jieba.cut(Run)))
print(list(jieba.cut(Run,cut_all=True)))
print(list(jieba.cut_for_search(Run)))

技术分享图片

技术分享图片

技术分享图片

技术分享图片

 

以上是关于完整中英文词频的主要内容,如果未能解决你的问题,请参考以下文章

这么好看的效果,你知道怎么实现嘛?统计词频并绘制图片——————附完整代码

201671010432词频统计软件项目报告

完整中英文词频

文件方式实现完整的英文词频统计实例

文件方式实现完整的英文词频统计实例

完整的中英文词频统计