ngrams2df: n-grams to data frame

Description Usage Arguments Value See Also Examples

View source: R/ngram_coding.R

Description

Tranforms a vector of n-grams into a data frame.

Usage

1
ngrams2df(ngrams)

Arguments

ngrams

a character vector of n-grams.

Value

a data.frame with 2 (in case of n-grams without known position) or three columns (n-grams with position information).

See Also

Decode n-grams: decode_ngrams.

Examples

1
ngrams2df(c("2_1.1.2_0.0", "3_1.1.2_0.0", "3_2.2.2_0.0", "2_1.1_0"))

Example output

Loading required package: slam
  position ngram distance
1        2 1.1.2      0.0
2        3 1.1.2      0.0
3        3 2.2.2      0.0
4        2   1.1        0

biogram documentation built on March 31, 2020, 5:14 p.m.