ngrams: *n*-grams of sequences

View source: R/ngrams.R

ngramsR Documentation

*n*-grams of sequences

Description

*n*-grams of sequences

Usage

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

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

gobbios/cfp documentation built on April 11, 2022, 2:22 a.m.