Learn R Programming

SentimentAnalysis (version 1.1-0)

SentimentDictionaryWeighted: Create a sentiment dictionary of words linked to a score

Description

This routine creates a new object of type SentimentDictionaryWeighted that contains a number of words, each linked to a continuous score (i.e. weight) for specifying its polarity. The scores can later be interpreted as a linear model

Usage

SentimentDictionaryWeighted(words, scores, idf = rep(1, length(words)),
  intercept = 0)

Arguments

words
is collection (vector) of different words as strings
scores
are the corresponding socres or weights denoting the word's polarity
idf
provide further details on the frequency of words in the corpus as an additional source for normalization
intercept
is an optional parameter for shifting the zero level (default: 0)

Value

Returns a new object of type SentimentDictionaryWordlist

References

Pr\"ollochs and Feuerriegel (2015). Generating Domain-Specific Dictionaries Using Bayesian Learning. 23rd European Conference on Information Systems (ECIS 2015).

See Also

SentimentDictionary

Examples

Run this code
# generate dictionary (based on linear model)
d <- SentimentDictionaryWeighted(c("increase", "decrease", "exit"),
                                 c(+1, -1, -10),
                                 rep(NA, 3))
summary(d)
# alternative call
d <- SentimentDictionaryWeighted(c("increase", "decrease", "exit"),
                                 c(+1, -1, -10))
summary(d)
# alternative call
d <- SentimentDictionary(c("increase", "decrease", "exit"),
                         c(+1, -1, -10),
                         rep(NA, 3))
summary(d)                                

Run the code above in your browser using DataLab