Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
更多使用DocumentTermMatrix()的停止词_R_Tm - Fatal编程技术网

更多使用DocumentTermMatrix()的停止词

更多使用DocumentTermMatrix()的停止词,r,tm,R,Tm,目前,我正在R中使用函数DocumentTermMatrix(),以适应LDA模型。除了默认的停止词外,我还想添加我自己应该删除的词 library(tm) myStopwords <- c("aa", "bb") dtm <- DocumentTermMatrix(myCorpus, control = list( tolower =

目前,我正在R中使用函数
DocumentTermMatrix()
,以适应LDA模型。除了默认的停止词外,我还想添加我自己应该删除的词

library(tm)
myStopwords <- c("aa", "bb")
dtm <- DocumentTermMatrix(myCorpus,
                           control = list(
                           tolower = TRUE,
                           removePunctuation = TRUE,
                           removeNumbers= TRUE,
                           stemming = FALSE,
                           stopwords = TRUE,
                           minWordLength = 2))
library(tm)

myStopwords您可以通过在
DocumentTermMatrix
函数中添加
removeWords=c(“aa”、“bb”)
来添加自己的停止词

library(tm)
myStopwords <- c("aa", "bb")
dtm <- DocumentTermMatrix(myCorpus,
                           control = list(
                           tolower = TRUE,
                           removePunctuation = TRUE,
                           removeNumbers= TRUE,
                           stemming = FALSE,
                           stopwords = TRUE,
                           removeWords = c("aa","bb"),
                           minWordLength = 2))
))
library(tm)

myStopwords您可以通过在
DocumentTermMatrix
函数中添加
removeWords=c(“aa”、“bb”)
来添加自己的停止词

library(tm)
myStopwords <- c("aa", "bb")
dtm <- DocumentTermMatrix(myCorpus,
                           control = list(
                           tolower = TRUE,
                           removePunctuation = TRUE,
                           removeNumbers= TRUE,
                           stemming = FALSE,
                           stopwords = TRUE,
                           removeWords = c("aa","bb"),
                           minWordLength = 2))
))
library(tm)
myStopwords