小编Pau*_*l_J的帖子

使用tm和RWeka创建N-Grams - 与VCorpus合作但不与Corpus合作

在使用'tm'和'RWeka'软件包创建biGrams的许多指南之后,我感到很沮丧的是,在tdm中只返回了1克.通过大量的反复试验,我发现使用' VCorpus '但不使用' Corpus ' 可以实现正常的功能.顺便说一句,我很确定这是在1个月前与'Corpus'合作但现在不是.

R(3.3.3),RTools(3.4),RStudio(1.0.136)和所有软件包(tm 0.7-1,RWeka 0.4-31)已更新至最新版本.

如果对于语料库不起作用以及其他人是否有同样的问题,我将不胜感激.

#A Reproducible example
#
#Weka bi-gram test
#

library(tm)
library(RWeka)

someCleanText <- c("Congress shall make no law respecting an establishment of",
                    "religion, or prohibiting the free exercise thereof or",
                    "abridging the freedom of speech or of the press or the",
                    "right of the people peaceably to assemble and to petition",
                    "the Government for a redress of grievances")

aCorpus <- Corpus(VectorSource(someCleanText))   #With this, only 1-Grams …
Run Code Online (Sandbox Code Playgroud)

r n-gram tm term-document-matrix rweka

6
推荐指数
1
解决办法
3036
查看次数

标签 统计

n-gram ×1

r ×1

rweka ×1

term-document-matrix ×1

tm ×1