Skip to content

Commit

Permalink
GoldStandardAnswerPrinter: Fix processing of no-gold-standard questions
Browse files Browse the repository at this point in the history
  • Loading branch information
pasky committed Jun 6, 2016
1 parent 5ffddf9 commit 200674e
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected void output(QuestionInfo qi, double procTime,
qi.getQuestionText(),
Double.toString(score),
Integer.toString(rank), Integer.toString(nranks),
qi.getAnswerPattern(), aMatch,
qi.getAnswerPattern() != null ? qi.getAnswerPattern() : "", aMatch,
Integer.toString(qi.getPassE_scored()),
Integer.toString(qi.getPassE_gsscored()),
Integer.toString(qi.getPassE_picked()),
Expand All @@ -99,7 +99,7 @@ public synchronized void process(JCas jcas) throws AnalysisEngineProcessExceptio
}

QuestionInfo qi = JCasUtil.selectSingle(questionView, QuestionInfo.class);
Pattern ap = Pattern.compile(qi.getAnswerPattern(), Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);
Pattern ap = qi.getAnswerPattern() != null ? Pattern.compile(qi.getAnswerPattern(), Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE) : null;
double procTime = (System.currentTimeMillis() - qi.getProcBeginTime()) / 1000.0;

FSIndex idx = answerHitlist.getJFSIndexRepository().getIndex("SortedAnswers");
Expand All @@ -116,7 +116,7 @@ public synchronized void process(JCas jcas) throws AnalysisEngineProcessExceptio
if (i < topListLen) {
toplist[i] = text + ":" + answer.getConfidence();
}
if (match < 0 && ap.matcher(text).find()) {
if (match < 0 && ap != null && ap.matcher(text).find()) {
match = i;
matchText = text;
}
Expand Down

0 comments on commit 200674e

Please sign in to comment.