使用 DocumentTermMatrix() 的更多停用词
More stop words using the DocumentTermMatrix()
目前,我正在使用 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))
谁能帮我在上面的代码中添加自己的停用词?谢谢!
您可以通过在 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))
))
目前,我正在使用 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))
谁能帮我在上面的代码中添加自己的停用词?谢谢!
您可以通过在 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))
))