这段代码可以统计文本中单词的频率:
这也会给我一些无用的词,比如“the”、“an”、“a”。
我的问题是,Python 中是否有可用的停用词库可以删除所有这些常见词?我想在 Google 应用引擎上运行它。
fullWords = re.findall(r'\w+', allText)
d = defaultdict(int)
for word in fullWords :
d[word] += 1
finalFreq = sorted(d.iteritems(), key = operator.itemgetter(1), reverse=True)
self.response.out.write(finalFreq)
这也会给我一些无用的词,比如“the”、“an”、“a”。
我的问题是,Python 中是否有可用的停用词库可以删除所有这些常见词?我想在 Google 应用引擎上运行它。