NLP Sentiments: Giving wrong result when using negative word in positive way

给你一囗甜甜゛ 提交于 2019-12-25 08:33:59

问题


I am using NodeJs to create my application with the help of sentiment lib

The problem is that it is giving wrong results when a negative word is used in a positive manner.

var sentiment = require('sentiment');

var result = sentiment('I am dying to eat a kitkat!');
console.dir(result);   

{ score: -3, comparative: -0.42857142857142855, tokens: [ 'i', 'am', 'dying', 'to', 'eat', 'a', 'kitkat' ], words: [ 'dying' ],
positive: [], negative: [ 'dying' ] }

///or

result = sentiment('your internet is not bad', knowladgeBase);
console.dir(result);

{ score: -3, comparative: -0.6, tokens: [ 'your', 'internet', 'is', 'not', 'bad' ], words: [ 'bad' ], positive: [], negative: [ 'bad' ] }


回答1:


if you don't want to implement a sentiment analysis system by yourself than try using another library. But if you are interested in implementing one, here is a solution. In a basic manner, sentiment analysis systems use two approaches to solve the problem. - Lexicon-based approaches - corpus-based approaches

The library you are using, uses a simple lexicon-based algorithm. If you want to have a more advanced system use a sentiment lexicon such as SentiWordNet or SenticNet together with Part-Of-Speech (POS) tagging. You can find negative and positive words. Then use some simple rules. - If a negative word has came with a negative verb, the statement is positive. - If a negative word has came with a positive verb, the statement is negative. - If a positive word has came with a positive verb, the statement is positive. - If a positive word has came with a negative verb, the statement is negative.



来源:https://stackoverflow.com/questions/41479406/nlp-sentiments-giving-wrong-result-when-using-negative-word-in-positive-way

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!