I am working on finding the sentiment of some text. Right now I am using a python library called VADER that for each sentence it gives me back the probability that a specific phrase is positive, negative, or neutral. The library itself gives you a sentiment compound but for my application, the default implementation is not working good so I have to develop my personal compound.

My question is there a way that given the following information: length of the sentence, probability of positive, probability of neutral, probability of negative I can calculate a general probability of the sentiment of the phrase? This value later will be standardized between -1 and 1.

For example, the sentence "There are some great sets to await; nevertheless I'm really disappointed about us still not getting a TV broadcast van a post van and a pisten bully" the library gives me these probabilities 'neg': 0.188, 'neu': 0.655, 'pos': 0.157.

My logic would say that the sentence is neutral or slightly negative.

I have tried to use the formula of probabilities of three events occurring together but I am not sure about it.

  • $\begingroup$ The probabilities always sums to 1 because your 3 events are mutually exclusive (pos,neu,neg). If you truly want to go back to only 2 outcomes: (pos,neg), you can simply assume that whenever it is neu, is it actually 1/2 pos 1/2 neg. Thus your new pos = pos +neu/2 and neg = neg +neu/2 $\endgroup$ – Romain Mar 31 at 21:20
  • $\begingroup$ What I want to have as an output is a number that considers all three probabilities. One idea that came to my mind was sentiment = -1*p(neg)+1*(pos)+0*p(neu) but in this way, I will not consider the neutral $\endgroup$ – Ibrahim Apr 1 at 9:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.