[736116]: / man / int_to_n_gram.Rd

Download this file

28 lines (24 with data), 692 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/preprocess.R
\name{int_to_n_gram}
\alias{int_to_n_gram}
\title{Encode sequence of integers to sequence of n-gram}
\usage{
int_to_n_gram(int_seq, n, voc_size = 4)
}
\arguments{
\item{int_seq}{Integer sequence}
\item{n}{Length of n-gram aggregation}
\item{voc_size}{Size of vocabulary.}
}
\value{
A numeric vector.
}
\description{
Input is sequence of integers from vocabulary of size \code{voc_size}.
Returns vector of integers corresponding to n-gram encoding.
Integers greater than \code{voc_size} get encoded as \code{voc_size^n + 1}.
}
\examples{
int_to_n_gram(int_seq = c(1,1,2,4,4), n = 2, voc_size = 4)
}