简单词云
csdn特色词云
library(wordcloud2)
library(jiebaR)
library(dplyr)
library(stringr)
getwd()
txt <- scan(file = "C:\\Users\\zengxu\\Documents\\r_project\\materail_for_cloudword.txt", sep = '\n', what = '', encoding = "UTF-8")
head(txt)
wk <- worker(stop_word = "C:\\Users\\zengxu\\Documents\\r_project\\stop_word.txt")
txt <- str_remove_all(txt,'[^[\u4e00-\u9fa5]]')
seg <- segment(code = txt,jiebar = wk)
seg_table <- freq(seg) %>% arrange(desc(freq))
seg_table_top <- head(seg_table,100)
# letterCloud(seg_table_top,word = "H")
wordcloud2(data = seg_table_top,shape = "pentagon") + WCtheme(3)