我想为以下句子(推文)找到一个情感分析结果:
在今天#Boeing的转机之后,$SPX正朝着自11月以来最好的周涨幅前进,由飞速发展的#tech股票领衔!
通过一些NLP情感预测的实验,我得到了以下代码:
val pipeline = { val props = new Properties() props.setProperty("annotators", "tokenize, ssplit, pos, lemma, parse, sentiment") props.setProperty("outputFormat", "json") new StanfordCoreNLP(props)}val text = "After today's turnaround by #Boeing , the $SPX is heading for the best weekly gain since November led by #tech stocks that are flying!"val annotation: Annotation = pipeline.process(text)val sentences = annotation.get(classOf[CoreAnnotations.SentencesAnnotation])pipeline.annotate(annotation)println(JSONOutputter.jsonPrint(sentences.head.get(classOf[SentimentCoreAnnotations.SentimentAnnotatedTree]))
然而,结果返回的是负面情感,这与直觉和实时演示http://nlp.stanford.edu:8080/sentiment/rntnDemo.html(正面情感,概率40%)的结果相反。
我在这里遗漏了什么?
回答:
词形还原器在典型的NLP流程中通常是可选的。必须在包含和不包含流程中各种组件的情况下进行外在/内在评估。尝试去掉词形还原器并添加命名实体识别(NER)。