Learn R Programming

soundcorrs (version 0.1.1)

ngrams: Frequencies of n-grams.

Description

Find n-grams of specified length and return their counts.

Usage

ngrams(data, n, zeros, as.table)

Arguments

data

[scOne] A scOne object in which to look for n-grams.

n

[integer] The length of n-grams to look for. Defaults to 1.

zeros

[logical] Include linguistic zeros? Defaults to TRUE.

as.table

[logical] Return the result as a table? Defaults to TRUE.

Value

[table] Table with counts of n-grams.

Examples

Run this code
# NOT RUN {
# path to sample data in the "wide format"
fNameData <- system.file ("extdata", "data-capitals.tsv", package="soundcorrs")
# path to a sample transcription
fNameTrans <- system.file ("extdata", "trans-common.tsv", package="soundcorrs")
d.cap.ger <- read.scOne (fNameData, "German", "ALIGNED.German", fNameTrans)
ngrams (d.cap.ger, 2)
ngrams (d.cap.ger, 2, FALSE)
# }

Run the code above in your browser using DataLab