下面以总理2015报告原文进行挖掘处理,先将报告内容保存为TXT格式文本。
相关的数据下载地址为:https://github.com/windform/report2015dug
> library(rJava)
> library(Rwordseg)
> library(wordcloud)
> #读入文本数据
> mydata
> #中文分词
> txt
> #将列表转换为向量
> txt.aslist
> #词语统计
> txt.freq
> #频数排序
> txt.result
> #导入停止词表
> stopword
> #将数据转换为向量型数据
> stopword.v
> #去除词语统计中的停止词
> word.pure
> #取出非停止词
> txt.pure
>#提取前100位词语画词云
> wordcloud(names(txt.pure)[1:100],txt.pure[1:100],random.order = FALSE,random.color = FALSE,colors=mycolors)
这是根据总理2015年的政府工作报告制作的可视化词云,上图能很直观看到,工作报告的重心是"发展",这是大方向,围绕发展的关键要素有经济建设、改革、农村、城镇等要素。