import re
from collections import Counter
path='E:\etest.txt'
with open(path,'r') as f:
s=f.read()
data=re.split(r'\W+',s)
fdata=Counter(data)
for i,j in fdata.most_common():
print(i,':',j)
import re
from collections import Counter
path='E:\etest.txt'
with open(path,'r') as f:
s=f.read()
data=re.split(r'\W+',s)
fdata=Counter(data)
for i,j in fdata.most_common():
print(i,':',j)
本文标题:统计英文文章中词频
本文链接:https://www.haomeiwen.com/subject/eaydlftx.html
网友评论