thisandagain / sentiment

AFINN-based sentiment analysis for Node.js.
MIT License
2.64k stars 311 forks source link

Multiword Sentiments #17

Closed manikumar-v closed 8 years ago

manikumar-v commented 9 years ago

Currently sentiment analyzer is not able to findout sentiments properly for multi-word like

"does not work": -3,

Below code is checking only one word at a time not multiple

var len = tokens.length;
    while (len--) { 
        var obj = tokens[len];
        var item = afinn[obj];
        if (!afinn.hasOwnProperty(obj)) continue;

        words.push(obj);
        if (item > 0) positive.push(obj);
        if (item < 0) negative.push(obj);

        score += item;
    }

Fixed the same in my code.

manikumar-v commented 9 years ago

Can I fix and contribute to the repository?

jeffthompson1971 commented 9 years ago

is this fix in base yet? Also, any chance we can modify the afinn file itself that the moduel uses so that don't have to do it programmatcially all the time. i'm using this for 'feedback' from agents on home showing (real estate) - gthere are no words for like 'smell', or 'odor' etc. I'd like to feed in a bunch of real-estate word/ and phrases like 'they did not like' etc. Can we do this ?

manikumar-v commented 9 years ago

Muliword - It is easily doable. I have the fix and it is working. If you need I can check-in.

On Sat, Jul 11, 2015, 10:21 PM Jeff Thompson notifications@github.com wrote:

is this fix in base yet? Also, any chance we can modify the afinn file itself that the moduel uses so that don't have to do it programmatcially all the time. i'm using this for 'feedback' from agents on home showing (real estate) - gthere are no words for like 'smell', or 'odor' etc. I'd like to feed in a bunch of real-estate word/ and phrases like 'they did not like' etc. Can we do this ?

— Reply to this email directly or view it on GitHub https://github.com/thisandagain/sentiment/issues/17#issuecomment-120643195 .

thisandagain commented 8 years ago

Tracking n-grams and negation in #23