我希望创建一个基于文本关键字权重的网络。但是,在运行与tm_map相关的代码时,出现了错误:
library (tm)
library(NLP)
lirary (openNLP)
text = c('.......')
corp <- Corpus(VectorSource(text))
corp <- tm_map(corp, stripWhitespace)
Warning message:
In tm_map.SimpleCorpus(corp, stripWhitespace) :
transformation drops documents
corp <- tm_map(corp, tolower)
Warning message:
In tm_map.SimpleCorpus(corp, tolower) : transformation drops documents
这些代码2个月前能够工作,现在我正在尝试新数据,但它已经不能工作了。请问有人能告诉我哪里出了错吗?谢谢。
我甚至尝试了下面的命令,但它也不起作用。
corp <- tm_map(corp, content_transformer(stripWhitespace))
VCorpus
是volatile corpus
,而 "A volatile corpus is fully kept in memory and thus all changes only affect the corresponding R object."(参见 tm)。 - Rafs