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

settings(x, ...)

# S3 method for default
settings(x = NULL, ...)

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

settings(x, field) <- value

# S3 method for 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

settings(data_corpus_inaugural, "stopwords")
#> NULL
(dfmat1 <- dfm(corpus_subset(data_corpus_inaugural, Year > 1980)))
#> Document-feature matrix of: 10 documents, 3,260 features (77.4% sparse).
(dfmat2 <- dfm(corpus_subset(data_corpus_inaugural, Year > 1980), remove = stopwords("english")))
#> Document-feature matrix of: 10 documents, 3,129 features (79.3% sparse).
settings(data_corpus_inaugural, "stopwords") <- TRUE dfmat <- dfm(data_corpus_inaugural, stem = TRUE, verbose = FALSE) settings(dfmat)
#> note: dfm settings are not yet implemented - coming soon.