DICE {DICEM}R Documentation

DICE Model Scores

Description

Detects linguistic markers of politeness in natural language. Takes an N-length vector of text documents and returns an N-row data.frame of scores on the two DICE dimensions.

Usage

DICE(text, parser = c("none", "spacy"), uk_english = FALSE, num_mc_cores = 1)

Arguments

text

character A vector of texts, each of which will be tallied for DICE features.

parser

character Name of dependency parser to use (see details). Without a dependency parser, some features will be approximated, while others cannot be calculated at all.

uk_english

logical Does the text contain any British English spelling? Including variants (e.g. Canadian). Default is FALSE

num_mc_cores

integer Number of cores for parallelization. Default is 1, but we encourage users to try parallel::detectCores() if possible.

Details

The best intensity model uses politeness features, which depend on part-of-speech tagged sentences (e.g. "bare commands" are a particular verb class). To include these features in the analysis, a POS tagger must be initialized beforehand - we currently support SpaCy which must be installed separately in Python (see example for implementation). If not, a simpler model can be used, though it is somewhat less accruate.

Value

a data.frame of scores on directness and intensity.

References

Weingart et al., 2015 Yeomans et al., 2024

Examples


data("phone_offers")

DICE(phone_offers$message[1:10], parser="none")

## Not run: 

# Detect multiple cores automatically for parallel processing
DICE(phone_offers$message, num_mc_cores=parallel::detectCores())

# Connect to SpaCy installation for part-of-speech features
# THIS REQUIRES SPACY INSTALLATION OUTSIDE OF R
# For some machines, spacyr::spacy_install() will work, but please confirm before running
spacyr::spacy_initialize(python_executable = PYTHON_PATH)
DICE(phone_offers$message, parser="spacy")

## End(Not run)



[Package DICEM version 0.1.0 Index]