文件方式实现完整的英文词频统计实例

1.读入待分析的字符串 2.分解提取单词  3.计数字典 4.排除语法型词汇 5.排序 6.输出TOP(20)   fo=open('test.txt','r') a=fo.read() fo.close() exc={'the','a','to','of','and','in','that','on',''} a=a.lower() for i in '.,': a=a.replace(i,'
相关文章
相关标签/搜索