"""
功能:词频统计
作者:zlw
日期:11.25
"""
text = 'I love wyl and she is my bestfriend'
words= text.split(' ')
diff_words = list(set(words))
counts = []
for i in range(len(diff_words)):
counts.append(0)
for i in range(len(words)):
for j in range(len(diff_words)):
if diff_words[j] == words[i]:
counts[j] = counts[j] + 1
for word_count in zip(diff_words, counts):
print(word_count)