尝试使用 tm_term_score 为行中的文本将术语短语或术语对评分为 1 或 0 会得到此错误:
c1 <- Corpus(VectorSource(r1))
inspect(c1)
inspect(c1[2])
cleanR1 <- tm_map(c1, removeWords, stopwords('english'))
cleanR1 <- tm_map(cleanR1, content_transformer(tolower))
cleanR1 <- tm_map(cleanR1, removeWords, c("re", "ve", "ahha"))
cleanR1 <- tm_map(cleanR1, removePunctuation)
cleanR1 <- tm_map(cleanR1, removeSpecialChars)
cleanR1 <- tm_map(cleanR1, removeNumbers)
cleanR1 <- tm_map(cleanR1,removeWords,stopwords('en'))
cleanR1 <- tm_map(cleanR1,stripWhitespace)
cleanR1 <- tm_map(cleanR1,stemDocument)
cleanR1 <- tm_map(cleanR1, PlainTextDocument)
tm_term_score(cleanR1, terms, FUN = slam::row_sum)
UseMethod(“tm_term_score”,x)中的错误:没有适用于“tm_term_score”的方法应用于类“c('VCorpus','Corpus')”的对象
str(terms) chr [1:61] “帮助学习”“帮助成长”。