Learn R Programming

⚠️There's a newer version (0.9.4) of this package.Take me there.

Politeness

Politeness is a universal dimension of human communication (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.

Installation

You can install politeness from github using the devtools package, like so:

# install.packages("devtools")
devtools::install_github("myeomans/politeness")

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.

Example

In the package we have included a dataset, phone_offers, that was collected from an experiment in which participants were told to write offers asking to by 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.

data("phone_offers")

politeness::politeness(phone_offers$message)

# install.packages("spacyr")
spacyr::spacy_initialize(python_executable = PYTHON_PATH)
politeness::politeness(phone_offers$message, parser="spacy")

politeness::politenessPlot(politeness::politeness(phone_offers$message),
                           split=phone_offers$condition,
                           split_levels = c("Warm","Tough"),
                           split_name = "Condition")

Copy Link

Version

Install

install.packages('politeness')

Monthly Downloads

498

Version

0.2.2

License

MIT + file LICENSE

Maintainer

Mike Yeomans

Last Published

February 15th, 2018

Functions in politeness (0.2.2)

ctxpand

Contraction Expander
politenessProjection

Politeness projection
findPoliteTexts

Find polite text
positive_list

Positive Emotions List
hedge_list

Hedge Words List
negative_list

Negative Emotions List
spacyParser

Spacy Parser
slogodds

Variance-Weighted Log Odds
bowl_offers

Purchase offers for bowl
textcounter

Text Counter
cleantext

Clean Text
dictWrap

Dictionary Wrapper
politeness

Politeness Features
politenessPlot

Politeness plot
phone_offers

Purchase offers for phone
polite_dicts

Feature Dictionaries
feature_table

Table of Politeness Features