我在做一个关于文本摘要的实验。在得到解码句和参考句后,我使用pyrouge来获得胭脂得分,python代码如下:
from pyrouge import Rouge155
r=Rouge155()
r.model_filename_pattern = '#ID#——reference.txt'
r.system_filename_pattern = '(\d+)_decoded.txt'
r.model_dir = '/home/test/reference'
r.system_dir = '/home/test/decoded'
rouge_results = r.convert_and_evaluate()
print rouge_results
output_dict = r.output_to_dict(output)
但它似乎不起作用,它报告了一个subprocess.CalledProcessError
和
以下是具体的错误信息:
Traceback (most recent call last):
File "rouge.py", line 28, in <module>
rouge_results = r.convert_and_evaluate()
File "/home/username/env/local/lib/python2.7/site-packages/pyrouge-0.1.3.py2.7.egg/pyrouge/Rouge155.py", line 364, in convert_and_evaluate
rouge_output = self.evaluate(system_id, rouge_args)
File "/home/username/env/local/lib/python2.7/site-packages/pyrouge-0.1.3.py2.7.egg/pyrouge/Rouge155.py", line 339, in evaluate
rouge_output = check_output(command).decode("UTF-8")
File "/usr/lib/python2.7/subprocess.py", line 574, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '[u'/home/username/env/ROUGE/RELEASE-1.5.5/ROUGE-1.5.5.pl', '-e', '/home/username/env/ROUGE/RELEASE-1.5.5/data', '-c', '95','-2', '-1', '-U', '-r', '1000', '-n','4','-w','1.2','-a',u'-m', u' /tmp/tmpG9VKo9/rouge_conf.xml']' returned non-zero exit status 255
有人遇到过这种问题吗?谢谢你的建议!非常感谢!在
我发现这个问题是由参考句中的}引起的。我删除了这些符号,最后得到了胭脂的分数。在
<s>
和{相关问题 更多 >
编程相关推荐