read_keywords {keyATM} | R Documentation |
Convert a quanteda dictionary to keywords
Description
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.
Usage
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 |
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 |
Value
a named list which can be used as keywords for e.g. keyATM()
See Also
Examples
## Not run:
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")
## End(Not run)
[Package keyATM version 0.5.2 Index]