python3统计词频程序

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/kele_imon/article/details/83054466
import re
from collections import Counter
txt = open("D:/a1.txt").read()
new_txt = re.split('\W+', txt)
result = Counter(new_txt)
a = result.most_common(10)
print(a)

python3统计词频程序,可用。

猜你喜欢

转载自blog.csdn.net/kele_imon/article/details/83054466
今日推荐