You need to sign in or sign up before continuing.
Unverified Commit 362c33df authored by Leymore's avatar Leymore Committed by GitHub
Browse files

fix jieba rouge (#467)

parent d7ff933a
......@@ -30,6 +30,11 @@ class JiebaRougeEvaluator(BaseEvaluator):
metric = Rouge()
predictions = [' '.join(jieba.cut(i)) for i in predictions]
references = [' '.join(jieba.cut(i)) for i in references]
# avoid raising error when empty string encountered
predictions = [i if i else '__PREDPLACEHOLDER__' for i in predictions]
references = [i if i else '__REFRPLACEHOLDER__' for i in references]
score = metric.get_scores(predictions, references, avg=True)
return {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment