settings: Get or set the corpus settings

Description Usage Arguments Details Examples

Description

Get or set the corpus settings

Get or set various settings in the corpus for the treatment of texts, such as rules for stemming, stopwords, collocations, etc.

Get the settings from a which a dfm was created

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
settings(x, ...)

## Default S3 method:
settings(x = NULL, ...)

## S3 method for class 'corpus'
settings(x, field = NULL, ...)

settings(x, field) <- value

## S3 method for class 'dfm'
settings(x, ...)

Arguments

x

object from/to which settings are queried or applied

...

additional arguments

field

string containing the name of the setting to be set or queried settings(x) query the corps settings

settings(x, field) <- update the corpus settings for field

value

new setting value

Details

Calling settings() with no arguments returns a list of system default settings.

Examples

1
2
3
4
5
6
7
settings(data_corpus_inaugural, "stopwords")
(dfmat1 <- dfm(corpus_subset(data_corpus_inaugural, Year > 1980)))
(dfmat2 <- dfm(corpus_subset(data_corpus_inaugural, Year > 1980),
               remove = stopwords("english")))
settings(data_corpus_inaugural, "stopwords") <- TRUE
dfmat <- dfm(data_corpus_inaugural, stem = TRUE, verbose = FALSE)
settings(dfmat)

quanteda/quanteda documentation built on June 26, 2019, 3:38 a.m.