Learn R Programming

SentimentAnalysis (version 1.1-0)

ruleSentiment: Sentiment score

Description

Sentiment score defined as the difference between positive and negative word counts divided by the total number of words.

Usage

ruleSentiment(dtm, d)

Arguments

dtm
Document-term matrix
d
Dictionary of type SentimentDictionaryBinary

Value

Sentiment score in the range of -1 to 1.

Details

Given the number of positive words \(P\) and the number of negative words \(N\). Further, let \(T\) denote the total number of words in that document. Then, the sentiment ratio is defined as $$\frac{P+N}{T}$$. Here, it uses the entries negativeWords and positiveWords of the SentimentDictionaryBinary.