我使用tm包进行修复数据的文本分析,将数据读入数据框,转换为Corpus对象,应用各种方法使用lower,stipWhitespace,removestopwords等清理数据.
取回Corpus对象为stemCompletion.
使用tm_map函数执行了stemDocument,我的对象词被阻止了
得到了预期的结果.
当我使用tm_map函数运行stemCompletion操作时,它不起作用并得到以下错误
UseMethod("words")中的错误:没有适用于"字"的方法应用于"字符"类的对象
执行trackback()以显示并获得如下步骤
> traceback()
9: FUN(X[[1L]], ...)
8: lapply(dictionary, words)
7: unlist(lapply(dictionary, words))
6: unique(unlist(lapply(dictionary, words)))
5: FUN(X[[1L]], ...)
4: lapply(X, FUN, ...)
3: mclapply(content(x), FUN, ...)
2: tm_map.VCorpus(c, stemCompletion, dictionary = c_orig)
1: tm_map(c, stemCompletion, dictionary = c_orig)
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个错误?
tm ×1