From 845c6dd0c044e1eba785dcab5408da8f9fad973f Mon Sep 17 00:00:00 2001 From: jenz Date: Fri, 10 Feb 2023 16:55:47 +0100 Subject: [PATCH] tried fixing error messages that were reported --- .../src/main/java/FunctionLayer/Datahandler.java | 15 +++++++++++---- .../StanfordParser/SentimentAnalyzerTest.java | 11 +++++++++-- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/ArtificialAutism/src/main/java/FunctionLayer/Datahandler.java b/ArtificialAutism/src/main/java/FunctionLayer/Datahandler.java index 1bf79a03..199e721e 100644 --- a/ArtificialAutism/src/main/java/FunctionLayer/Datahandler.java +++ b/ArtificialAutism/src/main/java/FunctionLayer/Datahandler.java @@ -282,10 +282,15 @@ public class Datahandler { ArrayList stopWordLemma1 = stopWordLemmaHashMap.getOrDefault(str1, null); Integer PairCounter1 = PairCounterHashMap.getOrDefault(str1, null); + Annotation annotationStrPipeLine1 = pipelineAnnotationCache.get(str1); + Annotation annotationStrPipeLineSentiment1 = pipelineSentimentAnnotationCache.get(str1); + SentimentAnalyzerTest SMX = new SentimentAnalyzerTest(strF, str1, coreMaps1, coreMaps2, strAnno, - pipelineAnnotationCache.get(str1), strAnnoSentiment, - pipelineSentimentAnnotationCache.get(str1), coreDocument, coreDocumentAnnotationCache.get(str1), + //sometimes Annotation(str) returns null so in that case better use result of sentiment + annotationStrPipeLine1 == null ? annotationStrPipeLineSentiment1 : annotationStrPipeLine1, + strAnnoSentiment, + annotationStrPipeLineSentiment1, coreDocument, coreDocumentAnnotationCache.get(str1), tagger, gsf, classifier, tokenizeCounting, tokenizeCountingF, taggedWordListF, taggedWordList1, retrieveTGWListF, retrieveTGWList1, sentencesF, sentence1, sentencesSentimentF, sentenceSentiment1, treesF, trees1, @@ -710,9 +715,11 @@ public class Datahandler { } } } catch (InterruptedException e) { - throw new RuntimeException(e); + //throw new RuntimeException(e); + --pending; } catch (ExecutionException e) { - throw new RuntimeException(e); + //throw new RuntimeException(e); + --pending; } } diff --git a/ArtificialAutism/src/main/java/FunctionLayer/StanfordParser/SentimentAnalyzerTest.java b/ArtificialAutism/src/main/java/FunctionLayer/StanfordParser/SentimentAnalyzerTest.java index 188ebd14..76d93c4d 100644 --- a/ArtificialAutism/src/main/java/FunctionLayer/StanfordParser/SentimentAnalyzerTest.java +++ b/ArtificialAutism/src/main/java/FunctionLayer/StanfordParser/SentimentAnalyzerTest.java @@ -603,8 +603,15 @@ public class SentimentAnalyzerTest { for (final Tree sentenceConstituencyParse1 : sentenceConstituencyParseList1) { try { if (sentenceConstituencyParse1 != null && !sentenceConstituencyParse1.isEmpty()) { - Set constinuent1 = Tdiff.markDiff(sentenceConstituencyParse1, sentenceConstituencyParse2); - Set constinuent2 = Tdiff.markDiff(sentenceConstituencyParse2, sentenceConstituencyParse1); + + Set constinuent1 = null; + Set constinuent2 = null; + try { + constinuent1 = Tdiff.markDiff(sentenceConstituencyParse1, sentenceConstituencyParse2); + constinuent2 = Tdiff.markDiff(sentenceConstituencyParse2, sentenceConstituencyParse1); + } catch (Exception e) { + continue; + } ArrayList constiLabels = new ArrayList(); for (final Constituent consti : constinuent1) { for (final Constituent consti1 : constinuent2) {