NLP情绪:以肯定的方式使用否定词时会产生错误的结果 [英] NLP Sentiments: Giving wrong result when using negative word in positive way

查看:391
本文介绍了NLP情绪:以肯定的方式使用否定词时会产生错误的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用NodeJs情感库

问题在于,如果以肯定的方式使用否定词,则会给出错误的结果.

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);   

{得分:-3,可比较:-0.42857142857142855,令牌:['i', 'am','dying','to','eat','a','kitkat'],单词:['dying'],
正面:[],负面:['垂死']}

{ 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);

{得分:-3,可比性:-0.6,令牌:['your','internet', 'is','not','bad'],单词:['bad'],正数:[],负数: ['坏']}

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

推荐答案

如果您不想自己实现情感分析系统,而不想尝试使用其他库.但是,如果您有兴趣实施一个,这里有一个解决方案. 基本而言,情感分析系统使用两种方法来解决该问题. -基于词典的方法 -基于语料库的方法

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

您正在使用的库使用基于字典的简单算法.如果要使用更高级的系统,请使用情感词典,例如 SentiWordNet

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.

这篇关于NLP情绪:以肯定的方式使用否定词时会产生错误的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆