# NOT RUN {
mytext <- c(
"I am not afraid of you",
NA,
"",
"I love it [not really]",
"I'm not angry with you",
"I hate it when you lie to me. It's so humiliating",
"I'm not happpy anymore. It's time to end it",
"She's a darn good friend to me",
"I went to the terrible store",
"There is hate and love in each of us",
"I'm no longer angry! I'm really experiencing peace but not true joy.",
paste("Out of the night that covers me, Black as the Pit from pole to",
"pole, I thank whatever gods may be For my unconquerable soul.",
"In the fell clutch of circumstance I have not winced nor cried",
"aloud. Under the bludgeonings of chance My head is bloody, but unbowed.",
"Beyond this place of wrath and tears Looms but the Horror of the",
"shade, And yet the menace of the years Finds, and shall find, me unafraid.",
"It matters not how strait the gate, How charged with punishments",
"the scroll, I am the master of my fate: I am the captain of my soul."
)
)
mytext2 <- get_sentences(mytext)
emotion(mytext2)
emo_words <- extract_emotion_terms(mytext2)
emo_words
emo_words$sentence
emo_words[, c('anger', 'anticipation', 'disgust', 'fear', 'joy', 'sadness', 'surprise', 'trust')]
attributes(emo_words)$counts
attributes(emo_words)$elements
## directly ona character string (not recommended: use `get_sentences` first)
extract_emotion_terms(mytext)
brady <- get_sentences(crowdflower_deflategate)
brady_emo <- extract_emotion_terms(brady)
brady_emo
attributes(brady_emo)$counts
attributes(brady_emo)$elements
# }
Run the code above in your browser using DataLab