
word = '''
Lately, I've been, I've been losing sleep
Dreaming about the things that we could be
But baby, I've been, I've been praying hard,
Said, no more counting dollars
We'll be counting stars, yeah we'll be counting stars
I see this life like a swinging vine
Swing my heart across the line
And my face is flashing signs
Seek it out and you shall find
Old, but I'm not that old
Young, but I'm not that bold
I don't think the world is sold
I'm just doing what we're told
I feel something so right
Doing the wrong thing
I feel something so wrong
Doing the right thing
I could lie, coudn't I, could lie
Everything that kills me makes me feel alive
Lately, I've been, I've been losing sleep
Dreaming about the things that we could be
But baby, I've been, I've been praying hard,
Said, no more counting dollars
We'll be counting stars
'''
#标点替换为空格
symbol = [",", ".", "!", "?", "'", ":", "-"]
#无意义的单词
words = ['t','ve','ll','m']
new_art = word
for i in range(len(symbol)):
new_art = new_art.replace(symbol[i],' ') #把文章的标点符号替换
new_art = new_art.lower() #改成小写
art_list = new_art.split() #以空格将字符串分成单词列表
dic = dict(zip())
for i in art_list:
dic[i] = new_art.count(i) #用字典记录单词和其出现次数
for i in words:
if(dic.get(i)!=None): #如果为冠词之类的无意义的词,将其舍弃
dic.pop(i)
new_dic = sorted(dic.items(),key=lambda x:x[1],reverse = True)
for i in range(10):
print(new_dic[i]) #取出现频率最高的10个单词

【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本