Detecting Politeness Features in Text

Detecting markers of politeness in English natural language. This package allows researchers to easily visualize and quantify politeness between groups of documents. This package combines prior research on the linguistic markers of politeness. We thank the Spencer Foundation, the Hewlett Foundation, and Harvard's Institute for Quantitative Social Science for support.

Politeness is a universal dimension of langauge (Lakoff, 1973; Brown & Levinson, 1987). In practically all communication, a speaker can choose to be more or less polite to their audience. In this package, we provide tools for researchers to measure the markers and effects of politeness in natural language.


You can install politeness directly, like so:


Many of the politeness features containted in this package use some part-of-speech tagging. We recommend SpaCy, which is simple to install through python and which has a convenient wrapper function for use through R, SpaCyR. If you do not have SpaCy installed you must do it outside of R first - otherwise, a reduced set of features (i.e. those that do not require part-of-speech tags) is provided by the package.


In the package we have included a dataset, phone_offers. It was collected from an experiment in which participants were told to write offers asking to buy a smartphone from a seller on Craigslist. We randomly manipulated their instructions so that their task was to write in a warm or tough style. The dataset includes the text of their messages, as well as the condition assignment.

#spacyr::spacy_initialize(python_executable = "PYTHON_PATH")
#politeness::politeness(phone_offers$message, parser="spacy")
                           split_levels = c("Warm","Tough"),
                           split_name = "Condition")


Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.8.5 by Mike Yeomans, 6 months ago

Browse source code at

Authors: Mike Yeomans , Alejandro Kantor , Dustin Tingley

Documentation:   PDF Manual  

MIT + file LICENSE license

Imports tm, quanteda, ggplot2, parallel, spacyr, textir, glmnet, data.table, stringr, stringi

Suggests knitr, rmarkdown, testthat

See at CRAN