Skip to content

Commit

Permalink
fix rouge score
Browse files Browse the repository at this point in the history
  • Loading branch information
hiyouga committed Jul 6, 2023
1 parent 687b7ef commit 559fe75
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/seq2seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __call__(self, eval_preds: Sequence[Union[np.ndarray, Tuple[np.ndarray]]]) -
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()
Expand Down

0 comments on commit 559fe75

Please sign in to comment.