英文小说词频统计

Posted 844115-l

tags:

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

strYoung =‘‘‘young for you
Gala
sundays coming i wanna drive my car
to your apartment with present like a star
forecaster said the weather may be rainy hard
but i know the sun will shine for us
oh lazy seagull fly me from the dark
i dress my jeans and feed my monkey banana
then i think my age how old, skyline how far
or we need each other in california
you show me your body before night comes down
i touch your face and promise to stay ever young
on this ivory beach we kissed so long
it seems that the passions never gone
you sing me your melody and i feel so please
i want you to want me to keep your dream
together well run wild by a summer symphony
this is what we enjoyed not a fantasy
the tin-mans surfing i wanna try my luck
to the top of tide rip like just have some drugs
i know you have no blame for my proud moonish heart
welcome to the golden beatnik park
oh diamond seashore drag me from the yard
incredible sunward i watch as youre in photograph
for camera your smiles so sweet, palm trees so lush
would you believe my honey its califonia
you show me your body before night comes down
i touch your face and promise to stay ever young
on this ivory beach we kissed so long
it seems that the passions never gone
you sing me your melody and i feel so please
i want you to want me to keep your dream
together well run wild by a summer symphony
-
‘‘‘

fo = open(young for you.txt,r,encoding=utf-8)
young = fo.read()
fo.close()
print(young)

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

strSet = set(strList)
print(len(strSet),strSet)

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

print(len(strDict),strDict)

wcList = list(strDict.items())
wcList.sort()
print(strDict.items())


sep = .,:;?|_
for ch in sep:
    strYoung = strYoung.replace(ch, )

结果

技术分享图片

 

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

词频统计-功能二

如何用python和jieba分词,统计词频?

中文词频统计

中文词频统计

中文词频统计

中文词频统计