4

R 3.4.3, using qdap::polarity(), I'm wondering if there is a way to have an amplifier apply to a negated word instead of the actual word itself. In the example below, "love" is the positive word, "didn't" is the negation word, and "definitely" is the amplification word. I want to have phrase "a" have a more negative polarity score, but it appears "definitely" is amplifying "love" and not "didn't love".

library(qdap)
text <- c("definitely didn't love", "didn't love", "love")
phrase <- c("a", "b", "c")
df <- data.frame(phrase, text)
polarity(df$text, df$phrase)

  phrase total.sentences total.words ave.polarity sd.polarity stan.mean.polarity
1      a               1           3       -0.115          NA                 NA
2      b               1           2       -0.707          NA                 NA
3      c               1           1        1.000          NA                 NA

Thanks in advance, -jt

A5C1D2H2I1M1N2O1R2T1
  • 190,393
  • 28
  • 405
  • 485
JimmyT
  • 1,099
  • 4
  • 10
  • 15
  • If you use the `SentimentAnalysis` package, you may get what you want. `foo <- analyzeSentiment(df$text); foo` gives me 0.33, 0.5, and 1.0 for `SentimentQDAP` in the output. – jazzurro Dec 13 '17 at 03:15
  • unfortunately, SentimentQDAP is just treating "definitely" as a neutral word and lowering the score for the third word. "monkey didn't love" would give me the same score. – JimmyT Dec 13 '17 at 04:35
  • I see. Hope someone can help you out. – jazzurro Dec 13 '17 at 04:41
  • 1
    The answer is no. – Tyler Rinker Dec 13 '17 at 22:03
  • 1
    Thanks Tyler...I'll provide a little more detailed explanation in the answer, please let me know if I don't explain this properly. – JimmyT Dec 14 '17 at 20:44

1 Answers1

1

This is not the way qdqp::polarity works. The valence words can amplify, deamplify, or negate/reverse the tagged polarized word only. For example, the phrase "definitely didn't love" from the question above contains <amplifier> <negator> <polarized word>. The negator "didn't", reverses the positively polarized word "love". The amplifier "definitely" amplifies the positive polarized word "love". It does not amplify the negated "didn't love".

JimmyT
  • 1,099
  • 4
  • 10
  • 15