我想通过否定检测来改进我的情感分析。我正在使用教授强调的词袋方法实现情感分析,这就是为什么我还没有使用CoreNLP的情感注释器。然而,我注意到它有一个问题。
给出一句话,“我对他们并不失望”,我希望,在最坏的情况下,从情感注释器和我自己的词袋实现中,都会有一个中立的情绪,或者是弱积极的情绪。情感注释器将这句话报告为否定。
I: PRP Neutral
'm: VBP Neutral
not: RB Negative
disappointed: VBN Negative
in: IN Neutral
them: PRP Neutral
.: . Neutral
Negative
1最后两行显示了句子的情感标签和数字情感得分。
如何提高情感注释器获得正确结果的机会,以及如何使用CoreNLP来检测所显示的否定、句子之间的否定以及多个句子之间对实体的引用(看起来就像coref和dcoref注释器)?
此外,潜在的有用之处是摆脱停用的单词。引理注释器似乎负责词干处理,但是哪个注释器会阻止单词?
发布于 2019-09-16 02:56:53
如果使用natlog注释器,则每个令牌都将标记一个NaturalLogicAnnotations.PolarityAnnotation。因此,否定的单词将具有down的极性。
package edu.stanford.nlp.examples;
import edu.stanford.nlp.ling.*;
import edu.stanford.nlp.naturalli.*;
import edu.stanford.nlp.pipeline.*;
import java.util.*;
public class NaturalLogicExample {
public static String text = "I'm not disappointed in them.";
public static void main(String[] args) {
// set up pipeline properties
Properties props = new Properties();
// set the list of annotators to run
props.setProperty("annotators", "tokenize,ssplit,pos,lemma,ner,parse,natlog");
// build pipeline
StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
// create a document object
CoreDocument document = new CoreDocument(text);
// annnotate the document
pipeline.annotate(document);
for (CoreLabel token : document.tokens()) {
System.out.println(String.format("%s\t%s", token.word(),
token.get(NaturalLogicAnnotations.PolarityAnnotation.class)));
}
}
}https://stackoverflow.com/questions/57940020
复制相似问题