ngrams: *n*-grams of sequences

Description Usage Arguments Details Value Examples

View source: R/ngrams.R

Description

*n*-grams of sequences

Usage

1
ngrams(S, n, xsep = "")

Arguments

S

character of length 1 or longer, contains the sequence

n

numeric of length 1, syllable length, can only be 1, 2 or 3

xsep

character, how should syllables be separated for 2-grams or 3-grams

Details

there is a substantially faster function in the textcnt function in the tau package...

Value

a data.frame with two columns, the first describes the syllables and the second is the count

Examples

1
2
3
4
5
SS <- "AAAABBBA"
ngrams(SS, 1)
ngrams(SS, 2)
ngrams(SS, 3)
ngrams(SS, 3, xsep="-")

gobbios/cfp documentation built on July 15, 2018, 3:45 p.m.