happyorsad: Sentiment scores a string

Description Usage Arguments Value Examples

Description

happyorsad sentiment-scores a string of text. It uses the AFINN sentiment scoring. It assigns a value to each recognized word or emoticon in the string and returns the sum.

Usage

1
happyorsad(string, language = "da")

Arguments

string:

a text string

language:

"en" for english, "da" for danish, "emoticon" for emoticons.

Value

The function returns the sum of sentiment.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# Examples of sentiment scoring

library(happyorsad)

# Score danish words
string_da <- 'Hvis ikke det er det mest afskyelige elendige flueknepperi...'
happyorsad(string_da, "da")

# Score english words
string_en <- 'This is utterly excellent!'
happyorsad(string_en, "en")

# Score emoticons
string_emoticon <- 'I saw that yesterday :)'
happyorsad(string_emoticon, "emoticon")

56north/happyorsad documentation built on May 5, 2019, 11:26 a.m.