tests/wordcount.r

library(ngram)

x = "a b a c a b b"
test = wordcount(x)
truth = 7L
stopifnot(identical(test, truth))

y = "I am the very model of a modern major general. I have information vegetable, animal, and mineral."
test = wordcount(y)
truth = 17L
stopifnot(identical(test, truth))

Try the ngram package in your browser

Any scripts or data that you put into this service are public.

ngram documentation built on Nov. 1, 2022, 1:06 a.m.