nsyllable.tokens: nsyllable methods for tokens

View source: R/nsyllable-methods.R

nsyllable.tokensR Documentation

nsyllable methods for tokens

Description

Extends nsyllable() methods for tokens objects.

Usage

## S3 method for class 'tokens'
nsyllable(
  x,
  language = "en",
  syllable_dictionary = nsyllable::data_syllables_en,
  use.names = FALSE
)

Arguments

x

character vector whose syllables will be counted. This will count all syllables in a character vector without regard to separating tokens, so it is recommended that x be individual terms.

language

specify the language for syllable counts by ISO 639-1 code. The default is English, using the data object data_syllables_en, an English pronunciation dictionary from CMU.

syllable_dictionary

optional named integer vector of syllable counts where the names are lower case tokens. This can be used to override the language setting, when set to NULL (the default). If a syllable dictionary is supplied, this will override the language argument.

use.names

logical; if TRUE, assign the tokens as the names of the syllable count vector

Examples



quanteda.textstats documentation built on Nov. 2, 2023, 5:07 p.m.