0
我正在用R中的tm-package创建文档项矩阵,但是我的语料库中的某些单词在某个过程中会丢失。tm包中的DocumentTermMatrix不会返回所有单词
我会用一个例子来解释。然而
dm <- DocumentTermMatrix(crps)
dm_matrix <- as.matrix(dm)
dm_matrix
# Terms
# Docs and bout class home hours more next night
# 1 1 1 1 1 1 1 1 2
,我想(和预期)是:比方说,我有这个小阴茎
library(tm)
crps <- " more hours to my next class bout to go home and go night night"
crps <- VCorpus(VectorSource(crps))
当我使用DocumentTermMatrix()
从TM-包,它会返回这些结果
# Docs and bout class home hours more next night my go to
# 1 1 1 1 1 1 1 1 2 1 2 1
为什么DocumentTermMatrix()
跳过“my”,“go”和“to”两个字?有没有办法控制和修复这个功能?
我假设你使用'tm'包?什么样的对象是'crps'?你是怎么得到'crps'的?你用'crps < - 语料库(VectorSource(some_text_string))'这样的东西吗? –
是的,我用'crps <-VCorpus(VectorSource(My_text))' –