diff --git a/ArtificialAutism/src/main/java/FunctionLayer/StanfordParser/SentimentAnalyzerTest.java b/ArtificialAutism/src/main/java/FunctionLayer/StanfordParser/SentimentAnalyzerTest.java index 8b0f28a9..6b254390 100644 --- a/ArtificialAutism/src/main/java/FunctionLayer/StanfordParser/SentimentAnalyzerTest.java +++ b/ArtificialAutism/src/main/java/FunctionLayer/StanfordParser/SentimentAnalyzerTest.java @@ -887,7 +887,7 @@ public class SentimentAnalyzerTest { if (sentenceConstituencyParse2 != null && !sentenceConstituencyParse2.isEmpty()) { for (CoreLabel LBW : sentenceConstituencyParse1.taggedLabeledYield()) { for (CoreLabel LBW1 : sentenceConstituencyParse2.taggedLabeledYield()) { - if (LBW.lemma().equals(LBW1.lemma())) { + if (LBW.lemma() != null && LBW1.lemma() != null && LBW.lemma().equals(LBW1.lemma())) { boolean found = false; for (String str : filerTreeContent) { if (str.equals(LBW.lemma())) { @@ -895,7 +895,7 @@ public class SentimentAnalyzerTest { break; } } - if (!found) { + if (!found && LBW.lemma() != null) { filerTreeContent.add(LBW.lemma()); runCount1++; } @@ -2151,9 +2151,11 @@ public class SentimentAnalyzerTest { for (CoreLabel token : tokensSentiment) { Set stopWords = StopAnalyzer.ENGLISH_STOP_WORDS_SET; Set stopWordsCustom = StopwordAnnotator.getStopWordList(customStopWordList, true); - String lemma = token.lemma().toLowerCase(); - if (stopWords.contains(lemma) || stopWordsCustom.contains(lemma)) { - arrs.add(lemma); + if (token.lemma() != null) { + String lemma = token.lemma().toLowerCase(); + if (stopWords.contains(lemma) || stopWordsCustom.contains(lemma)) { + arrs.add(lemma); + } } } return arrs;