get_n_gram_weights: Get n-gram weights

Description Usage Arguments Value

View source: R/get-n-gram-weights.R

Description

Tabulates weights for all possible n-grams of a given order.

Usage

1
2
get_n_gram_weights(mod, order, pos = 1L, time = 0,
  zero_indexed = FALSE)

Arguments

mod

A PPM model object as produced by (for example) new_ppm_simple or new_ppm_decay, and subsequently trained on input sequences using model_seq.

order

(Integerish scalar) The order (i.e. number of symbols) of the n-grams to retrieve.

pos

(Integerish scalar) The nominal 'position' at which the n-gram counts are retrieved (only relevant for decay-based models).

time

(Numeric scalar) The nominal 'time' at which the n-grams are retrieved (only relevant for decay-based models).

zero_indexed

(Logical scalar) Whether the n-grams should be presented as zero-indexed (as opposed to one-indexed) integer vectors.

Value

Returns a tibble where each row corresponds to an n-gram. These n-grams are exhaustively enumerated from all possible symbols drawn from the model's alphabet. The tibble contains n columns elt_1, elt_1, ... elt_n, corresponding to the n symbols in the n-gram, and a column weight, identifying the weight of the specified n-gram.


pmcharrison/ppm documentation built on Jan. 13, 2020, 3:57 p.m.