if (FALSE) {
library(magrittr)
# Get NRC emotions dataset from textdata package
nrc_emotion <- textdata::lexicon_nrc() %>%
dplyr::rename(token = word, dictionary = sentiment) %>%
dplyr::mutate(score = 1)
# set up some input text
text <- dplyr::tibble(body = c("I am so angry!", "I am angry.",
"I'm not angry.", "Your mother and I aren't angry, we're just disappointed."))
emotions <- tardis_multidict(input_text = text, text_column = "body",
dictionaries = nrc_emotion) %>%
dplyr::select(body, score_anger, score_sadness)
emotions
}
Run the code above in your browser using DataLab