“Thank you very much. I've just received a call from Secretary Clinton. She congratulated us. It is about us. On our victory, and I congratulated her and her family on a very, very hard-fought campaign I mean she fought very hard.Hillary has worked very long and very hard over a long period of time, and we owe her a major debt of gratitude for her service to our country. I mean that very sincerely”.
请使用 Python 书写代码统计以上英文段落中出现的词频,并且制作成柱状分析图
柱状图是需要统计每个词语出现的次数吗
import matplotlib.pyplot as plt
from collections import Counter
s = "Thank you very much. I've just received a call from Secretary Clinton. She congratulated us. \
It is about us. On our victory, and I congratulated her and her family on a very, very hard-fought campaign I mean she fought very hard.\
Hillary has worked very long and very hard over a long period of time, and we owe her a major debt of gratitude for her service to our country. I mean that very sincerely"
s = s.replace(","," ").replace("."," ")
res = Counter(s.split())
plt.bar(res.keys(),res.values())
plt.show()