tokens_tolower: Convert the case of tokens

Description Usage Arguments Examples

View source: R/casechange-functions.R

Description

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

Usage

1
2
3
tokens_tolower(x, keep_acronyms = FALSE, ...)

tokens_toupper(x, ...)

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)

...

additional arguments passed to stringi functions, (e.g. stri_trans_tolower), such as locale

Examples

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

Example output

quanteda version 0.99
Using 2 of 1 threads for parallel computing

Attaching package: 'quanteda'

The following object is masked from 'package:utils':

    View

tokens from 2 documents.
txt1 :
[1] "b" "a" "a"

txt2 :
[1] "c" "c" "a" "b" "b"

tokens from 2 documents.
txt1 :
[1] "B" "A" "A"

txt2 :
[1] "C" "C" "A" "B" "B"

quanteda documentation built on Nov. 2, 2018, 1:05 a.m.