get_tuple() is kept only for compatibility with jiebaR. New code should
use count_ngrams() instead.
Value
If dataframe = TRUE, a data frame with name and count columns,
sorted by descending count. Otherwise, a named integer vector.
Details
This function is deprecated and should not be used in new code.
It is provided only as a compatibility wrapper around count_ngrams()
and replicates the behavior of jiebaR::get_tuple().
Prefer count_ngrams() because the original jiebaR::get_tuple() interface
has several design problems:
Its n-gram extraction behavior does not match the most obvious reading of the argument name:
size = ncounts all contiguous n-grams from2:n, not just the exact sizen.Its documentation says it accepts list input, but the original exported implementation does not reliably support lists.
It concatenates tokens without a separator, which makes tuple boundaries ambiguous.
Examples
suppressWarnings(get_tuple(c("sd", "sd", "sd", "rd"), 2))
#> name count
#> 1 sdsd 2
#> 2 sdrd 1