Reputation: 1051
I am using polarity
function from qdap
. There are few words that I want to add to dictionary as negative when said in combination. For instance.
"Pretty Bad"
The polarity score becomes neutral when this is sent into polarity function.
> polarity("Pretty Bad")
all total.sentences total.words ave.polarity sd.polarity stan.mean.polarity
1 all 1 2 0 NA NA
Because it considers pretty as good word and bad as bad one, hence the aggregate becomes neutral.
I want to get rid of this and want to add couple of custom words.
Upvotes: 0
Views: 492
Reputation: 499
To add words in dictionary use sentiment_frame and make your own lexicon. You can add more words as per your requirement. By default polarised words in key.pol is used. check ?polarity
library(qdap)
polarity("pretty bad")
# customised lexicon
positives = c("good","great")
negatives = c("bad","badly")
new_lexicon <- sentiment_frame(positives,negatives, pos.weights = 1, neg.weights = -1)
counts(polarity("pretty bad",polarity.frame = new_lexicon))
Upvotes: 1