multilang-sentiment
multilang-sentiment copied to clipboard
comparativeScore is not consistent with previous versions
Hi @marcellobarile, first of all thanks for sharing this library. I'm wondering if there has been a breaking change in how comparativeScore
is being calculated.
This line seems to be in conflict with how the comparative score is being described in readme.md
:
https://github.com/marcellobarile/multilang-sentiment/blob/fa4103bb523e2f3d31648926b1696749fcfb1183/lib/index.js#L200-L203
As per your documentation, shouldn't this fundamentally be:
const comparativeScore = score / tokens.length;
For example, under the Usage section in readme.md
:
var r1 = sentiment('Cats are stupid.', 'en');
console.dir(r1); // Score: -2, Comparative: -0.666
If we run the current Comparative result on those three words, we get -2.6665, which as your code has done, added positiveOverNegativeScore
to the mix (i.e. -2 added to the original Comparative score of -0.666).