Computes list of n-gram elements positions in sequence.
get_ngrams_ind(len_seq, n, d)
len_seq |
|
---|---|
n |
|
d |
|
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).
A format of d
vector is discussed in Details of
count_ngrams
.
# positions trigrams in sequence of length 10 get_ngrams_ind(10, 9, 0)#> [[1]] #> [1] 1 2 #> #> [[2]] #> [1] 2 3 #> #> [[3]] #> [1] 3 4 #> #> [[4]] #> [1] 4 5 #> #> [[5]] #> [1] 5 6 #> #> [[6]] #> [1] 6 7 #> #> [[7]] #> [1] 7 8 #> #> [[8]] #> [1] 8 9 #> #> [[9]] #> [1] 9 10 #> #> attr(,"d") #> [1] 0 0 0 0 0 0 0 0