From 39c51c907b9d055505114b5b2a1902f28e02563c Mon Sep 17 00:00:00 2001 From: snigdha <snigdha@illinois.edu> Date: Wed, 14 Dec 2016 20:53:32 -0600 Subject: [PATCH] catching dep parser error --- .../edu/illinois/cs/cogcomp/SentimentHandler.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/edu/illinois/cs/cogcomp/SentimentHandler.java b/src/main/java/edu/illinois/cs/cogcomp/SentimentHandler.java index e099a37..6ec98e7 100644 --- a/src/main/java/edu/illinois/cs/cogcomp/SentimentHandler.java +++ b/src/main/java/edu/illinois/cs/cogcomp/SentimentHandler.java @@ -106,12 +106,16 @@ public class SentimentHandler { // is this word negated boolean isNeg = false; - if (considerNeg && (polarityBingLiu.length()!=0 || polarityMpqa.length()!=0)) { - if(depView==null){ - annotator.addView(ta, ViewNames.DEPENDENCY_STANFORD); - depView = ta.getView(ViewNames.DEPENDENCY_STANFORD); + try { + if (considerNeg && (polarityBingLiu.length() != 0 || polarityMpqa.length() != 0)) { + if (depView == null) { + annotator.addView(ta, ViewNames.DEPENDENCY_STANFORD); + depView = ta.getView(ViewNames.DEPENDENCY_STANFORD); + } + isNeg = isNegated(wordLemm, depView); } - isNeg = isNegated(wordLemm, depView); + }catch (Exception e){ + e.printStackTrace(); } // reverse polarity if negated -- GitLab