请问用R语言怎么对中文pdf文件进行词频的统计。试过如下代码,得到的excel是乱码?
library(readtext)
library(jiebaR)
library(dplyr)
pdf_text <- readtext("xxx.pdf")
pdf_cut <- segment(pdf_text$text, worker(user="xxx.txt", stop_words="xxx.txt"))
word_freq <- pdf_cut %>% subset(nchar(pdf_cut)>1 %>% frq() %>% arrange(-freq) %>% head(100)
write.csv(word_freq, file="xxx.csv", row.names=FALSE)