annotate function causes crash sometimes to just exception handling it

This commit is contained in:
jenz 2023-02-14 12:29:40 +01:00
parent 933f849e7f
commit a38505f5e7

View File

@ -198,12 +198,16 @@ public class Datahandler {
private void createStrAnnotation(String str, StanfordCoreNLP stanfordCoreNLP, Boolean sentimentBool) { private void createStrAnnotation(String str, StanfordCoreNLP stanfordCoreNLP, Boolean sentimentBool) {
Annotation strAnno2 = new Annotation(str); Annotation strAnno2 = new Annotation(str);
strAnno2.compact(); strAnno2.compact();
try {
stanfordCoreNLP.annotate(strAnno2); stanfordCoreNLP.annotate(strAnno2);
if (sentimentBool) { if (sentimentBool) {
pipelineSentimentAnnotationCache.put(str, strAnno2); pipelineSentimentAnnotationCache.put(str, strAnno2);
} else { } else {
pipelineAnnotationCache.put(str, strAnno2); pipelineAnnotationCache.put(str, strAnno2);
} }
} catch (Exception e) {
System.out.println("stanfordcorenlp annotate failed" + e.getMessage());
}
} }
private SentimentAnalyzerTest getReponseFuturesHelper(String strF, String str1, StanfordCoreNLP stanfordCoreNLP, private SentimentAnalyzerTest getReponseFuturesHelper(String strF, String str1, StanfordCoreNLP stanfordCoreNLP,