diff --git a/src/utils/seq2seq.py b/src/utils/seq2seq.py index 53b12f38..cab7a919 100644 --- a/src/utils/seq2seq.py +++ b/src/utils/seq2seq.py @@ -46,7 +46,7 @@ class ComputeMetrics: hypothesis = list(jieba.cut(pred)) reference = list(jieba.cut(label)) - if len(" ".join(hypothesis).split()) == 0: + if len(" ".join(hypothesis).split()) == 0 or len(" ".join(reference).split()) == 0: result = {"rouge-1": {"f": 0.0}, "rouge-2": {"f": 0.0}, "rouge-l": {"f": 0.0}} else: rouge = Rouge()