powered by
Some simple "getters" for ngram objects. Necessary since the internal representation is not a native R object.
ngram
ng_order(ng, decreasing = FALSE)# S4 method for ngram ng_order(ng, decreasing = FALSE)get.ngrams(ng)# S4 method for ngram get.ngrams(ng)get.string(ng)# S4 method for ngram get.string(ng)get.nextwords(ng)# S4 method for ngram get.nextwords(ng)
# S4 method for ngram ng_order(ng, decreasing = FALSE)
get.ngrams(ng)
# S4 method for ngram get.ngrams(ng)
get.string(ng)
# S4 method for ngram get.string(ng)
get.nextwords(ng)
# S4 method for ngram get.nextwords(ng)
An ngram object.
Should the sorted order be in descending order?
ngram.order returns an R vector with the original corpus order of the ngrams.
ngram.order
get.ngrams() returns an R vector of all n-grams.
get.ngrams()
get.nextwords() does nothing at the moment; it will be implemented in future releases.
get.nextwords()
getnstring() recovers the input string as an R string.
getnstring()
ngram-class, ngram
ngram-class
library(ngram) str = "A B A C A B B" ng = ngram(str) get.ngrams(ng)[ng_order(ng)]
Run the code above in your browser using DataLab