码迷,mamicode.com
首页 > 其他好文 > 详细

完整中英文词频

时间:2018-09-27 13:02:33      阅读:161      评论:0      收藏:0      [点我收藏+]

标签:com   时代   hold   The   when   lease   img   ati   tty   

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)))

技术分享图片

技术分享图片

技术分享图片

技术分享图片

 

完整中英文词频

标签:com   时代   hold   The   when   lease   img   ati   tty   

原文地址:https://www.cnblogs.com/h000/p/9712319.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!