samuelam commited on
Commit
10593b4
1 Parent(s): fa72a9a

Update evaluation/evaluator.py

Browse files
Files changed (1) hide show
  1. evaluation/evaluator.py +5 -0
evaluation/evaluator.py CHANGED
@@ -77,6 +77,11 @@ def fix_prediction(prediction, gold_answer, evaluator):
77
 
78
  def question_scorer(prediction, gold_answer):
79
 
 
 
 
 
 
80
  answer_list = [x for x in gold_answer.split("\n") if len(x.strip()) > 0] if type(gold_answer) != list else gold_answer
81
  gold_answer, evaluator = parse_answer(answer_list)
82
  prediction, run_eval = fix_prediction(prediction, gold_answer, evaluator)
 
77
 
78
  def question_scorer(prediction, gold_answer):
79
 
80
+ try:
81
+ prediction = json.loads(prediction)
82
+ except:
83
+ prediction = prediction
84
+
85
  answer_list = [x for x in gold_answer.split("\n") if len(x.strip()) > 0] if type(gold_answer) != list else gold_answer
86
  gold_answer, evaluator = parse_answer(answer_list)
87
  prediction, run_eval = fix_prediction(prediction, gold_answer, evaluator)