Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adversative conjunctions cause neutrality when used with a negator #80

Closed
ashleywysocki opened this issue Mar 30, 2018 · 3 comments
Closed

Comments

@ashleywysocki
Copy link

ashleywysocki commented Mar 30, 2018

I noticed when analyzing a sentence like "But I'm not happy" (sentiment: 0) that it differs from "I'm not happy" (sentiment: -0.4330127) by making it a neutral statement. However, in my understanding of adversative conjunctions, they should amplify the current clause which should make "But I'm not happy" more negative. I tested some other negator words (didn't, isn't, etc) and when those are used before the polarized word, adding an adversative conjunction like "but" always makes the sentiment score become 0. I looked at the underlying code but couldn't figure out what the issue is so while I can neutralize the adversative weight for now, I was hoping there could be a fix to this at some point.

@trinker
Copy link
Owner

trinker commented Mar 31, 2018 via email

@ashleywysocki
Copy link
Author

Yes, it's very simple really.

test_sentences <- c("I'm not happy", "But I'm not happy", "I didn't like it", "But I didn't like it") test_sentences_sentiment <- sentiment(test_sentences)

@trinker
Copy link
Owner

trinker commented Apr 10, 2018

I see what you mean. I'll have a look when I get development time for sentimentr unless someone provides a pull request in the eman time:

library(sentimentr)

test_sentences <- c(
    "I'm not happy", 
    "But I'm not happy", 
    "I didn't like it", 
    "But I didn't like it",
    "I like it", 
    "But I like it",
    "I hate it", 
    "But I hate it"
)


test_sentences_sentiment <- sentiment(test_sentences)

data.frame(text=test_sentences, test_sentences_sentiment)

                  text element_id sentence_id word_count  sentiment
1        I'm not happy          1           1          3 -0.4330127
2    But I'm not happy          2           1          4  0.0000000
3     I didn't like it          3           1          4 -0.2500000
4 But I didn't like it          4           1          5  0.0000000
5            I like it          5           1          3  0.2886751
6        But I like it          6           1          4  0.6200000
7            I hate it          7           1          3 -0.4330127
8        But I hate it          8           1          4 -0.9300000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants