story=‘‘‘I‘m hurting, baby, I‘m broken down
I need your loving, loving, I need it now
When I‘m without you
I‘m something weak
You got me begging
Begging, I‘m on my knees
I don‘t wanna be needing your love
I just wanna be deep in your love
And it‘s killing me when you‘re away
Ooh, baby,
‘Cause I really don‘t care where you are
I just wanna be there where you are
And I gotta get one little taste
Your sugar
Yes, please
Won‘t you come and put it down on me
I‘m right here, ‘cause I need
Little love and little sympathy
Yeah you show me good loving
Make it alright
Need a little sweetness in my life
Your sugar
Yes, please
Won‘t you come and put it down on me
My broken pieces
You pick them up
Don‘t leave me hanging, hanging
Come give me some
When I‘m without ya
I‘m so insecure
You are the one thing
The one thing, I‘m living for
I don‘t wanna be needing your love
I just wanna be deep in your love
And it‘s killing me when you‘re away
Ooh, baby, ‘‘‘
story = story.lower()#字符串变小写
for i in ‘,.?!‘:
story =story.replace(i,‘ ‘)
story = story.split(‘ ‘)#字符串变单词列表
exp = {‘ ‘,‘i"m‘,‘and‘,‘it‘,‘don"t‘}
dic = {}
keys = set(story)-exp#取得语法成分的单词的键的集合
for a in keys:
dic[a] =story.count(a)
b = list(dic.items())
b.sort(key= lambda x:x[1],reverse=True)#列表从大到小排序
for i in range(15):
print(b[i])#输出排名前十五的元组