2
$\begingroup$

Edited:

I want to get a sentiment score of various sentences and I've tried coming up with an equation that could satisfy the conditions that are inherent to each sentence (It's estimated mood as well as a probability of each mood) that are determined by a 3rd part service. The value I want to get - the score - gets its value from these 2 conditions or variables - the mood with 3 states (either positive, neutral, negative) and a probability for each (0.0 - 1.0), which gives the score a possible range from 0 - 100. I added the score values in myself, so they aren't an exact science, but the ranges worked out to be 0-39 for negative moods, 40-60 for neutral moods, and up to 100 for positive moods, as a continuum. I'm hoping to get something like the following that will make the scores roughly similar to those set out below:

score = mood * probability * (some kind of weighting) 

Rough score values:

if mood == positive && probability > 0.94    score = 100 elsif    mood == positive && probability > 0.89    score = 96 elsif    mood == positive && probability > 0.84    score = 92 elsif    mood == positive && probability > 0.79    score = 88 elsif    mood == positive && probability > 0.74    score = 86 elsif    mood == positive && probability > 0.69    score = 84 elsif    mood == positive && probability > 0.64    score = 82 elsif    mood == positive && probability > 0.59    score = 80 elsif    mood == positive && probability > 0.54    score = 78 elsif    mood == positive && probability > 0.49    score = 76 elsif    mood == positive && probability > 0.44    score = 74 elsif    mood == positive && probability > 0.39    score = 72 elsif    mood == positive && probability > 0.34    score = 70 elsif    mood == positive && probability > 0.29    score = 68 elsif    mood == positive && probability > 0.24    score = 66 elsif    mood == positive && probability > 0.19    score = 64 elsif    mood == positive && probability > 0.14    score = 62 elsif    mood == positive && probability > 0    score = 60 elsif    mood == neutral && probability > 0.94    score = 59 elsif   mood == neutral && probability > 0.89   score = 58 elsif   mood == neutral && probability > 0.84   score = 57 elsif   mood == neutral && probability > 0.79   score = 56 elsif   mood == neutral && probability > 0.74   score = 55 elsif   mood == neutral && probability > 0.69   score = 53 elsif   mood == neutral && probability > 0.64   score = 52 elsif   mood == neutral && probability > 0.59   score = 51 elsif   mood == neutral && probability > 0.54   score = 50 elsif   mood == neutral && probability > 0.49   score = 49 elsif   mood == neutral && probability > 0.44   score = 48 elsif   mood == neutral && probability > 0.39   score = 47 elsif   mood == neutral && probability > 0.34   score = 46 elsif   mood == neutral && probability > 0.29   score = 45 elsif   mood == neutral && probability > 0.24   score = 43 elsif   mood == neutral && probability > 0.19   score = 42 elsif   mood == neutral && probability > 0.14   score = 41 elsif   mood == neutral && probability > 0   score = 40 elsif   mood == negative && probability > 0.94   score = 39 elsif   mood == negative && probability > 0.89   score = 38 elsif   mood == negative && probability > 0.84   score = 36 elsif   mood == negative && probability > 0.79   score = 34 elsif   mood == negative && probability > 0.74   score = 32 elsif   mood == negative && probability > 0.69   score = 30 elsif   mood == negative && probability > 0.64   score = 28 elsif   mood == negative && probability > 0.59   score = 26 elsif   mood == negative && probability > 0.54   score = 24 elsif   mood == negative && probability > 0.49   score = 22 elsif   mood == negative && probability > 0.44   score = 20 elsif   mood == negative && probability > 0.39   score = 18 elsif   mood == negative && probability > 0.34   score = 16 elsif   mood == negative && probability > 0.29   score = 14 elsif   mood == negative && probability > 0.24   score = 12 elsif   mood == negative && probability > 0.19   score = 10 elsif   mood == negative && probability > 0.14   score = 8 else   mood == negative && probability > 0   score = 3 end   
  • 0
    It would be helpful to provide more information about what you are trying to achieve. There are any number of formulae that can satisfy the equations. (Also, why the downvotes?)2012-01-24
  • 0
    Will edit in some information.2012-01-24
  • 0
    Hint, make a table with 3 columns : positive, neutral and negative, then make as many rows as the values of probability , now looking at each row should make it easy to see how the values change in horizantal and vertical axis, so it becomes easier to see the effect both variables on the result. Method 2 : look up the Lagrange interpolation for 2 variables for a sledge hammer approach.2012-01-24
  • 0
    @Arjang the fist option isn't very much more concise then what I have. As for your second option, you'd have to spell it out because it went straight over my head.2012-01-24
  • 0
    @Simpleton : have you looked up Lagrange interpolation for one variable? If yes then the idea is the same but your case is for 2 variables, that's all I am trying to say.2012-01-25

0 Answers 0