我试图关注this example,但遇到错误。
> library("RWeka")
> library("tm")
Loading required package: NLP
> data("crude")
> BigramTokenizer <- function(x) NGramTokenizer(x, Weka_control(min = 2, max = 2))
> tdm <- TermDocumentMatrix(crude, control = list(tokenize = BigramTokenizer))
Error in rep(seq_along(x), sapply(tflist, length)) :
invalid 'times' argument
In addition: Warning message:
In mclapply(unname(content(x)), termFreq, control) :
scheduled core 1 encountered error in user code, all values of the job will be affected
有什么想法吗?
答案 0 :(得分:1)
只需使用一些更好/现代的包装。我可以提出几个选择:
tm
。有关示例,请参阅插图。 (我是作者)。tm
,请尝试tokenizers包替换RWeka
ngram tokenizer。