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