-
Notifications
You must be signed in to change notification settings - Fork 310
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
Smiple Question #107
Comments
The comparative score is simply:
That string results in the following: {
score: 1,
comparative: 0.1111111111111111,
tokens: [
'i',
'love',
'cats',
'but',
'i',
'am',
'allergic',
'to',
'them'
],
words: [
'allergic',
'love'
],
positive: [
'love'
],
negative: [
'allergic'
]
} Each token has a range between
This approach leaves you with a mid-point of
So – to answer your question – you can scale and offset the comparative score (
|
Thank you very much! That was both fast and precisely detailed 👍. And just so that I am clear. Taking the example you gave "I love cats, but I am allergic to them." would be:
And the value I am after would be 51.11%. Where 5 would be the maximum AFINN value. Or is there a way to compute this value (max AFINN value) for all comparative scores? |
Yes. That's correct. The maximum AFINN value is always function scale (score) {
return (score + 5) * 100;
}
var result = scale(sentiment('I like cats').comparative); but I would recommend diving into JS to get a better sense of the possibilities: |
Ahh yes, Mr Crockford (read that one already :)). Your awesome thanks! I will be able to build out the functionality, I'm not to shabby at Javascript. And that function will work for all possibilities, including negatives, and neutral values? |
Yup. You can give it a try yourself to see how it works in all scenarios. |
Cool – thanks again! |
This is a very sweet project!
I would like to know how can I convert the comparative value to a whole number (percentage 100), where 100 is the most positive, 50 is neutral and 0 is most negative?
This can also be out of 10.
The text was updated successfully, but these errors were encountered: