负面情绪中的关键词使用情绪分析(斯坦福德NLP)
我的要求是阅读输入文本并进行情绪分析。如果情绪分析是负面的,我应该只得到上下文中使用的负面关键词 下面是实现情绪分析的代码片段: String tweet=电影最差; 属性道具=新属性; //props.putpos.model,D:\Stanford\u API's\english-left3words-distsim.tagger; props.setPropertyannotators、tokenize、ssplit、pos、引理、解析、情绪负面情绪中的关键词使用情绪分析(斯坦福德NLP),nlp,stanford-nlp,sentiment-analysis,Nlp,Stanford Nlp,Sentiment Analysis,我的要求是阅读输入文本并进行情绪分析。如果情绪分析是负面的,我应该只得到上下文中使用的负面关键词 下面是实现情绪分析的代码片段: String tweet=电影最差; 属性道具=新属性; //props.putpos.model,D:\Stanford\u API's\english-left3words-distsim.tagger; props.setPropertyannotators、tokenize、ssplit、pos、引理、解析、情绪 pipeline = new Sta
pipeline = new StanfordCoreNLP(props);
int mainSentiment = 0;
if (tweet != null && tweet.length() > 0) {
int longest = 0;
Annotation annotation = pipeline.process(tweet);
for (CoreMap sentence : annotation.get(CoreAnnotations.SentencesAnnotation.class))
{
Tree tree = sentence.get(SentimentCoreAnnotations.AnnotatedTree.class);
int sentiment = RNNCoreAnnotations.getPredictedClass(tree);
SimpleMatrix sd= RNNCoreAnnotations.getNodeVector(tree);
System.out.println("---sentiment----"+sd.negative().eig());
//System.out.println("---sd.get(0)----"+sd.get(0));
String partText = sentence.toString();
if (partText.length() > longest)
{
mainSentiment = sentiment;
longest = partText.length();
}
}
}
如果情绪分析是否定的,请建议我如何从句子中获得关键词?你想要斯坦福nlp的具体答案吗?我猜它使用RNN进行情感分类。我怀疑是否有直截了当的方法来获得否定词。想想看,如果你的句子是“电影一点也不好”,它把这归类为负面,但你没有负面的词。如果你还好的话,也许你可以试试简单的弓形分类法,只需检查每个句子中3个最重的单词,看看它看起来如何。我知道这是最基本的东西,但它可能会根据你的用例而工作。张贴你想要什么类型的关键字的例子…输入将是一个段落,其中将有关于问题的完整信息。我多次打电话给客户服务部,但没有人提供有关解决方案的完整信息。主题:呼叫中心