完整中英文词频
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 I‘m a wolf in sheeps clothing ‘Cause at the end of the night It is her I‘ll be holding I love you so That‘s what you‘ll say You‘ll tell me Baby baby please don‘t 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 I‘m 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 bunny‘s That I‘d like to pursue Now even now they eating out the palm of my hand There‘s only one carrot and they all gotta share it I love you so That‘s what you‘ll say You‘ll tell me Baby baby please don‘t 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 I‘m 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)))
以上是关于完整中英文词频的主要内容,如果未能解决你的问题,请参考以下文章