Using TM, I'm comparing a DocumentTermMatrix against a dictionary list to count totals:
totals <- inspect(DocumentTermMatrix(x, list(dictionary = d)))
This works great for single words, but I want to include double words and can't figure out how to do this.
I tried RWeka:
TrigramTokenizer <- function(x) NGramTokenizer(x,
Weka_control(min = 3, max = 3))
tdm <- TermDocumentMatrix(v.corpus,
control = list(tokenize = TrigramTokenizer))
BUt get the following error message:
Error in simple_triplet_matrix(i = i, j = j, v = as.numeric(v), nrow = length(allTerms), :
'i, j, v' different lengths
In addition: Warning messages:
1: In parallel::mclapply(x, termFreq, control) :
all scheduled cores encountered errors in user code
2: In is.na(x) : is.na() applied to non-(list or vector) of type 'NULL'
3: In simple_triplet_matrix(i = i, j = j, v = as.numeric(v), nrow = length(allTerms), :
NAs introduced by coercion.
Can you help with the Error message?
Thanks!!