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,11 +198,15 @@ public class Datahandler {
private void createStrAnnotation(String str, StanfordCoreNLP stanfordCoreNLP, Boolean sentimentBool) {
Annotation strAnno2 = new Annotation(str);
strAnno2.compact();
stanfordCoreNLP.annotate(strAnno2);
if (sentimentBool) {
pipelineSentimentAnnotationCache.put(str, strAnno2);
} else {
pipelineAnnotationCache.put(str, strAnno2);
try {
stanfordCoreNLP.annotate(strAnno2);
if (sentimentBool) {
pipelineSentimentAnnotationCache.put(str, strAnno2);
} else {
pipelineAnnotationCache.put(str, strAnno2);
}
} catch (Exception e) {
System.out.println("stanfordcorenlp annotate failed" + e.getMessage());
}
}