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): ...@@ -30,6 +30,11 @@ class JiebaRougeEvaluator(BaseEvaluator):
metric = Rouge() metric = Rouge()
predictions = [' '.join(jieba.cut(i)) for i in predictions] predictions = [' '.join(jieba.cut(i)) for i in predictions]
references = [' '.join(jieba.cut(i)) for i in references] 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) score = metric.get_scores(predictions, references, avg=True)
return { 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