This function converts or reads a dictionary object from quanteda to a named list. "Glob"-style wildcard expressions (e.g. politic*) are resolved based on the available terms in your texts.

read_keywords(file = NULL, docs = NULL, dictionary = NULL, split = TRUE, ...)

Arguments

file

file identifier for a foreign dictionary, e.g. path to a dictionary in YAML or LIWC format

docs

texts read via keyATM_read()

dictionary

a quanteda dictionary object, ignore if file is not NULL

split

boolean, if multi-word terms be seperated, e.g. "air force" splits into "air" and "force".

...

additional parameters for quanteda::dictionary()

Value

a named list which can be used as keywords for e.g. keyATM()

See also

Examples

if (FALSE) {
  library(keyATM)
  library(quanteda)
  ## using the moral foundation dictionary example from quanteda
  dictfile <- tempfile()
  download.file("http://bit.ly/37cV95h", dictfile)
  data(keyATM_data_bills)
  bills_dfm <- keyATM_data_bills$doc_dfm
  keyATM_docs <- keyATM_read(bills_dfm)
  read_keywords(file = dictfile, docs = keyATM_docs, format = "LIWC")
}