get_ngrams_ind {biogram}R Documentation

Get indices of n-grams

Description

Computes list of n-gram elements positions in sequence.

Usage

get_ngrams_ind(len_seq, n, d)

Arguments

len_seq

integer value describing sequence's length.

n

integer size of n-gram.

d

integer vector of distances between elements of n-gram (0 means consecutive elements). See Details.

Details

A format of d vector is discussed in Details of count_ngrams.

Value

A list with number of elements equal to n. Every element is a vector containing locations of given n-gram letter. For example, first element of list contain indices of first letter of all n-grams. The attribute d of output contains distances between letter used to compute locations (see Details).

Examples

# positions trigrams in sequence of length 10
get_ngrams_ind(10, 9, 0)

[Package biogram version 1.6.3 Index]