tokens_tolower: Convert the case of tokens

View source: R/casechange-functions.R

tokens_tolowerR Documentation

Convert the case of tokens

Description

tokens_tolower() and tokens_toupper() convert the features of a tokens object and re-index the types.

Usage

tokens_tolower(x, keep_acronyms = FALSE, verbose = quanteda_options("verbose"))

tokens_toupper(x, verbose = quanteda_options("verbose"))

Arguments

x

the input object whose character/tokens/feature elements will be case-converted

keep_acronyms

logical; if TRUE, do not lowercase any all-uppercase words (applies only to ⁠*_tolower()⁠ functions)

verbose

if TRUE print the number of tokens and documents before and after the function is applied. The number of tokens does not include paddings.

Examples

# for a document-feature matrix
toks <- tokens(c(txt1 = "b A A", txt2 = "C C a b B"))
tokens_tolower(toks)
tokens_toupper(toks)

quanteda documentation built on Aug. 5, 2026, 1:09 a.m.