R/as_kgram_freqs.R

# Not implemented

#' Coerce to k-gram frequency table
#' 
#' $author Valerio Gherardi
#' $md
#' 
#' $description
#' 
#' At present, this is just an utility for recovering a /code{kgram_freqs}
#' object from a /link[kgrams]{language_model}.
#' 
#' $param object object to be coerced to /code{kgram_freqs}.
#' $param ... further argument passed to or from other methods.
#' $return a /code{kgram_freqs} object.
#' $examples
#' model <- language_model( kgram_freqs("a b b a b", 3) )
#' freqs <- as_kgram_freqs(model)
#' $name as_kgram_freqs
# NULL

#' $rdname as_kgram_freqs
# as_kgram_freqs <- function(object, ...)
#         UseMethod("as_kgram_freqs", object)

#' $rdname as_kgram_freqs
#' $export
# as_kgram_freqs.language_model <- function(object, ...) {
#         cpp_obj <- attr(object, "cpp_freqs")
#         .preprocess <- attr(object, ".preprocess")
#         .tknz_sent <- attr(object, ".tknz_sent")
#         new_kgram_freqs(cpp_obj, .preprocess, .tknz_sent)
# }

Try the kgrams package in your browser

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

kgrams documentation built on Oct. 6, 2023, 5:06 p.m.