get_all_nrc: Run sentiment analysis on text containing emojis.

View source: R/get_all_nrc.R

get_all_nrcR Documentation

Run sentiment analysis on text containing emojis.

Description

Uses the NRC Emotion Lexicon and the [NRC Emoji Lexicon] to run sentiment analysis on texts containing emojis. Produces total scores on eight emotions (anger, anticipation, disgust, fear, joy, sadness, surprise, trust) and two sentiments (negative, positive), taking into account both words and emojis. Input can be either a character vector or a data frame containing emoji counts (e.g., from the count_emojis function).

Usage

get_all_nrc(text, emoji_counts = NULL)

Arguments

text

A character vector.

emoji_counts

An optional argument containing a data frame with nrow = number of elements in the input character vector and ncol = number of emojis currently supported by the package (see all_emojis). This data frame can be produced by the count_emojis function.

Value

Produces a data frame with scores for eight emotions (anger, anticipation, disgust, fear, joy, sadness, surprise, trust) and two sentiments (negative, positive). Each column represents an emotion or sentiment, and each row represents an item in the input character vector.

Author(s)

Rebecca Godard

References

Mohammad, S. M., & Turney, P. D. (2013). NRC emotion lexicon. National Research Council, Canada. [insert emoji reference here]

See Also

get_emoji_nrc()

Examples

get_all_nrc(c("I am feeling happy \U001f600", "I am feeling sad \U001f622"))
Note: Emojis are not supported by the software used to generate package manuals, so
the unicode character codes are used instead.

rjgodard/emojis documentation built on Nov. 29, 2024, 7:16 p.m.