首页 文章

斯坦福情绪分析偏向负面?

提问于
浏览
1

我正在对现有的情绪分析器应用程序进行一些研究 . 我目前正在研究Stanford CoreNlp / Sentiment Analysis 3.8.0以及我在测试数据中注意到的预测似乎偏向负面 . 以下是一些回到负面的例子:

  • 纽约是我最终想要完成教学生涯的地方,而且机会太好了,无法拒绝 . - 否定

  • 我理解成为一名有效且有影响力的老师是一种责任,但我渴望在课前,课时和课余时间提出,以确保我是学生的可用资源 . - 否定

  • 从我个人的经验来看,我在课堂上学到了很多必要的生活技能,而我最有影响力的老师是我的激励者和支持者 . - 否定

我检查过,只有一种可能的模型可供使用(所以我认为没有任何杠杆推动那里 - 我不想训练模型) . 我可以使用一个不同的/更好的(可能是?)POS,这可能会给我一个不同的预测,但我有点神秘,因为我读到的关于斯坦福大学图书馆的所有博客/评论都是积极的,我的结果非常糟糕 . 我错过了什么吗?

代码:

Properties props = new Properties();
    props.setProperty("annotators", "tokenize, ssplit, parse, sentiment");
    StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
    Annotation document = pipeline.process(text);
    pipeline.annotate(document);

    List<CoreMap> sentences = document.get(CoreAnnotations.SentencesAnnotation.class);
    int mainSentiment=0; int longest = 0;
    SimpleMatrix matrix = null;
    for (CoreMap sentence : sentences) {
        String s_sentiment = sentence.get(SentimentCoreAnnotations.SentimentClass.class);

        Tree tree = sentence
                .get(SentimentCoreAnnotations.SentimentAnnotatedTree.class);
        int sentiment = RNNCoreAnnotations.getPredictedClass(tree);
        matrix = RNNCoreAnnotations.getPredictions(tree);

        System.out.println(sentence);
        System.out.println(sentiment + "-" +s_sentiment + "\t" + matrix.elementMaxAbs());
    }

分数的可能值:0非常负1负2中立3正4非常正

如果您在 生产环境 应用程序中使用此库,您是否可以找到可靠的结果来驱动它的操作?谢谢!

1 回答

  • 0

    首先,从版本3.3.1开始,不仅有一个模型作为参数传递给the option sentiment.model而是两个(遗憾的是,这似乎在网站的任何地方都没有提到):

    • 四级模型(非常消极,负面,中性,正面,非常正面) edu/stanford/nlp/models/sentiment/sentiment.ser.gz

    • 两级模型(负面,中性,正面) edu/stanford/nlp/models/sentiment/sentiment.binary.ser.gz

    这不是标准模型集的一部分,而是the additional models-english model;为了使用它,你需要获得它,这可以更好地记录 . 适当的Maven工件依赖性将是

    <dependency>
            <groupId>edu.stanford.nlp</groupId>
            <artifactId>stanford-corenlp</artifactId>
            <version>${stanford-corenlp.version}</version>
            <classifier>models-english</classifier>
            <scope>runtime</scope>
    </dependency>
    

    their 2013 paper中所述,他们使用电影评论语料库来创建他们的模型,而且这种数据很可能不是用于分析您所使用的语言的类型:例如,looking for too good to refuse in their corpus gives no results at all尽管它是相对常见的术语 .

    我自己也尝试使用他们预先训练过的模型来分析会话语言的结果,这些结果既不差但又不惊人:只是创建正面和负面模式列表并在我的文本中查找它们的准确性是与使用情绪分析仪没有显着差异 .

相关问题