我正在尝试用RTermDocumentMatrix
中的包的功能制作一个术语文档矩阵tm
,发现有些单词不包括在内。
> library(tm)
> tdm <- TermDocumentMatrix(Corpus(VectorSource("The book is of great importance.")))
> rownames(tdm)
[1] "book" "great" "importance." "the"
在这里,单词is和of已从矩阵中排除。如果语料库只包含删除的单词,它会给出以下消息。
> tdm <- TermDocumentMatrix(Corpus(VectorSource("of is of is")))
Warning message:
In is.na(x) : is.na() applied to non-(list or vector) of type 'NULL'
> rownames(tdm)
NULL
在构建矩阵之前删除了is和of的消息信号,但我无法弄清楚它发生的原因以及如何将所有标记包含在语料库中。
任何帮助表示赞赏。