zj3D 9 months ago
parent 6edef230ac
commit a647f06f32

@ -0,0 +1,13 @@
import re, sys, collections
from cppy.cp_util import *
stopwords = set(open( stopwordfilepath,encoding = 'utf8' ).read().split(','))
words = re.findall('[a-z]{2,}', open( testfilepath,encoding = 'utf8').read().lower())
counts = collections.Counter(w for w in words if w not in stopwords)
for (w, c) in counts.most_common(10):
print(w, '-', c)
'''
熟练的软件工程师会如此简单完成任务
后面的例子我们必须变的啰嗦一些不能用这种太 hacker 的写法
'''
Loading…
Cancel
Save