If Matecat Post-Editing Score fails, evaluation is not aborted
@@ -349,6 +349,7 @@ class MatecatScore(Score):
return (document_lines, reference_lines) if len(reference_lines) > 0 else (None, None)
def calculate(self, document, reference):
+ try:
scores = []
with open(reference) as reference_input:
@@ -362,6 +363,8 @@ class MatecatScore(Score):
scores += self._get_score(document_lines, reference_lines)
return reduce(lambda x, y: x + y, scores) / len(scores)
+ except:
+ return 'ERROR'
class _evaluate_logger:
@@ -403,6 +406,10 @@ class _evaluate_logger:
result = scores[i]
if result.error is None:
+ value = getattr(result, field)
+ if isinstance(value, basestring):
+ text = value
+ else:
text = '%.2f' % (getattr(result, field) * 100)
if i == 0:
text += ' (Winner)'
