str_test = 'the quick brown for jumps over the lazy dog.'
str_test = str_test.replace('.,!?、',"")
slist = str_test.split(" ")
def WordCounter(slist):
rstd = dict()
for i in slist:
if i in rstd.keys():
rstd[i] += 1
else:
rstd[i] = 1
return rstd
print("词频统计结果:",WordCounter(slist))

结果:

python手动实现WorldCount_词频统计