直到我使用这个短语," TermDocumentMatrix"很好。
Interface Convertible {
void unfoldRoof();
}
然而,在使用这个短语之后," TermDocumentMatrix"会产生错误。
doc <- tm_map(doc, gsub, pattern = "buy", replacement = "bought")
我需要更换一个字。 所以我用过这句话。
我的文档结构如下。
Error in UseMethod("meta", x) :
no applicable method for 'meta' applied to an object of class "character"
我如何使用&#34; TermDocumentMatrix&#34;?
1. so I bought it.
2. I bought the EH AC line in November 2014
3. 3rd product bought from AC and all no good.
(skip)
答案 0 :(得分:1)
您需要将正确的内容转换器传递给tm_map
,而不是任意字符操作函数
doc <- tm_map(doc, content_transformer(function(x)
gsub(x, pattern = "buy", replacement = "bought")))