NLP 否定检测和停用词
NLP Negation detection and Stop Words
我想通过否定检测改进我的情绪分析。我正在使用教授强调的词袋方法实施情绪分析,因此我还没有使用 CoreNLP 的情绪注释器。但是,我发现它有问题。
鉴于句子 "I'm not disappointed in them",我预计,在最坏的情况下,情绪注释器和我自己的词袋实现都会产生中性情绪或弱积极情绪。情绪注释器将此句子报告为负面。
I: PRP Neutral
'm: VBP Neutral
not: RB Negative
disappointed: VBN Negative
in: IN Neutral
them: PRP Neutral
.: . Neutral
Negative
1
最后两行显示句子的情感标签和数字情感分数。
我如何提高情绪注释器获得正确结果的机会,以及我如何使用 CoreNLP 来检测否定,如显示的内容、跨句子的否定以及跨多个句子对实体的引用(这看起来像 coref 和dcoref 注释器)?
此外,删除停用词可能很有用。词条注释器似乎负责词干提取,但哪个注释器负责停用词?
如果您使用 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)));
}
}
}
我想通过否定检测改进我的情绪分析。我正在使用教授强调的词袋方法实施情绪分析,因此我还没有使用 CoreNLP 的情绪注释器。但是,我发现它有问题。
鉴于句子 "I'm not disappointed in them",我预计,在最坏的情况下,情绪注释器和我自己的词袋实现都会产生中性情绪或弱积极情绪。情绪注释器将此句子报告为负面。
I: PRP Neutral
'm: VBP Neutral
not: RB Negative
disappointed: VBN Negative
in: IN Neutral
them: PRP Neutral
.: . Neutral
Negative
1
最后两行显示句子的情感标签和数字情感分数。
我如何提高情绪注释器获得正确结果的机会,以及我如何使用 CoreNLP 来检测否定,如显示的内容、跨句子的否定以及跨多个句子对实体的引用(这看起来像 coref 和dcoref 注释器)?
此外,删除停用词可能很有用。词条注释器似乎负责词干提取,但哪个注释器负责停用词?
如果您使用 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)));
}
}
}