Closed sseetal closed 7 years ago
@sseetal Can you provide a little more info?
Thanks for getting back to me.
INPUT sentiment
For input "happy" (both locally and on server)
{ score: 3, comparative: 3, tokens: [ 'happy' ], words: [ 'happy' ], positive: [ 'happy' ], negative: [] }
For input "happy cat"
{ score: 3, comparative: 1.5, tokens: [ 'happy', 'cat' ], words: [ 'happy' ], positive: [ 'happy' ], negative: [] }
For Input "I am happy today"
{ score: 3, comparative: 0.75, tokens: [ 'i', 'am', 'happy', 'today' ], words: [ 'happy' ], positive: [ 'happy' ], negative: [] }
It was hard to find in the docs but all i really need is the range of values (Min and Max) for score and comparative. I thought comparative was between -1 and 1, but now I can't tell.
Just to add more context. We're using this to analyze comments left by people in a survey. The whole point is to have a score and an overall score. Ideally a score out of 100. But can't seem to figure out how to calculate a comparable score.
This issue includes a thread that covers some of the areas you are asking about including how "comparative score" works and how to scale / offset it.
TL;DR: Tokens are scored between -5 (highly negative) and 5 (highly positive) with 0 being "neutral". Comparative scores are simply SUM(tokens) / number of tokens. Details can be found in the AFINN whitepaper: http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6010
Sorry that the docs don't make this more clear. I'll file an issue now to make sure I don't forget to improve them. 😄
I have version 2.1.0 on both my computer and on a server. On my computer it works, on my server, I get the following
{ score: 3, comparative: 3, tokens: [ 'happy' ], words: [ 'happy' ], positive: [ 'happy' ], negative: [] }
{ score: -2, comparative: -2, tokens: [ 'sad' ], words: [ 'sad' ], positive: [], negative: [ 'sad' ] }
{ score: 0, comparative: 0, tokens: [ 'ok' ], words: [], positive: [], negative: [] }
Any thoughts?