我试图使用CoreNLP(Java)对大量产品评论进行情感分析。总的来说,我发现分析的准确性非常好。从我阅读的内容来看,我使用的模型最初是使用电影评论(我认为)创建的,因此它不是100%适合分析产品评论。我想知道最好的方法去“提高”我的分析的准确性。“增强”CoreNLP情感分析结果
我在想的主要是除了产品评论的文字之外,我还有用户提供的星级评分。值范围从1-5,其中1星是最低的。我希望有一种方法可以在生成情感分数时考虑星级评分,因为它更准确地反映了用户对特定产品的感受。 CoreNLP中的情绪分析评分有没有一种方法可以最好地具有星级评分因子?我的分析代码看起来是这样的:
List<ProductReview> reviews = this.reviewRepository.findAll();
for (ProductReview review : reviews) {
Properties props = new Properties();
props.setProperty("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref, sentiment");
props.put("ner.model", "edu/stanford/nlp/models/ner/english.all.3class.distsim.crf.ser.gz");
StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
int starRating = review.getStarRating();
String reviewText = review.getTitle() + " : " + review.getReviewText();
if (!StringUtils.isEmpty(reviewText)) {
int longest = 0;
int mainSentiment = 0;
Annotation annotation = pipeline.process(reviewText);
String sentimentStr = null;
List<CoreMap> sentences = annotation.get(CoreAnnotations.SentencesAnnotation.class);
for (CoreMap sentence : sentences) {
Tree sentimentTree = sentence.get(SentimentCoreAnnotations.SentimentAnnotatedTree.class);
int sentiment = RNNCoreAnnotations.getPredictedClass(sentimentTree) - 2;
String partText = sentence.toString();
if (partText.length() > longest) {
mainSentiment = sentiment;
sentimentStr = sentence.get(SentimentCoreAnnotations.SentimentClass.class);
longest = partText.length();
}
}
}
}
我怎么能最好纳入星级评定(或其他信息,如票上最有用的商品评论等)成CoreNLP正在执行的分析?这是我必须分开做的事吗?或者有没有办法将其他数据直接纳入情绪分析引擎?