概述
主要针对英文文本做出词频计算,因为英文是用空格作为词语分割的。中文需要用到分词的库。
下面就用奥巴马的一片演讲做词频计算
1,分析的文本
speech_etxt = '''
My fellow citizens: I stand here today humbled by the task before us, grateful for the trust you've bestowed, mindful of the sacrifices borne by our ancestors.
I thank President Bush for his service to our nation -- (applause) -- as well as the generosity and cooperation he has shown throughout this transition.
Forty-four Americans have now taken the presidential oath. The words have been spoken during rising tides of prosperity and the still waters of peace. Yet, every so often, the oath is taken amidst gathering clouds and raging storms. At these moments, America has carried on not simply because of the skill or vision of those in high office, but because we, the people, have remained faithful to the ideals of our forebears and true to our founding documents.
So it has
最后
以上就是动人黄豆为你收集整理的利用python进行词频统计_利用python做词频计算(word-count)的全部内容,希望文章能够帮你解决利用python进行词频统计_利用python做词频计算(word-count)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复