wordcloud2 R

簡單詞雲

csdn特色詞雲
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)
發佈了3 篇原創文章 · 獲贊 0 · 訪問量 548
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章