文件名称:word-frequency-count:基于python的词频统计
文件大小:208KB
文件格式:ZIP
更新时间:2024-06-01 17:06:02
word-frequency-count 利用Python做一个词频统计 词频统计 对纯英语的文本文件【Eg: 瓦尔登湖(英文版).txt】的英文单词出现的次数进行统计,并记录起来 代码实现 import string from os import path with open('瓦尔登湖(英文版).txt','rb') as text1: words = [word.strip(string.punctuation).lower() for word in str(text1.read()).split()] words_index = set(words) count_dict = {index:words.count(index) for index in words_index} with open(path.dirname(__file__) + '/fi
【文件预览】:
word-frequency-count-master
----countWord.rar(207KB)
----README.md(946B)