Pyrouge安装测试结果为“FAILED(errors = 10)”

时间:2014-12-01 19:57:51

标签: python-2.7 module installation pypi summarization

在我在Stackoverflow上发布的上一个问题中,我询问了Pyrouge的安装问题。收到答案后,我申请了。从pypi installation steps,我做了

pip install pyrouge

然后(这里是我替换pypi原始步骤2的地方,

pyrouge_set_rouge_path.py /absolute/path/to/ROUGE-1.5.5/directory

我从stackoverflow收到了答案:

set pyrouge_set_rouge_path=C:\rouge

然后,我运行以下命令以确保正确安装:

python -m pyrouge.test

我应该收到以下输出:

Ran 10 tests in 3.753s
OK

但是得到了以下输出:

Ran 10 tests in 0.034s
FAILED (erros=10)

在上面我收到每次测试尝试的错误。

Error1: test_config_file (pyrouge.tests.Rouge155_test.PyrougeTest)

Error2: test_convert_summaries (pyrouge.tests.Rouge155_test.PyrougeTest)

Error3: test_evaluation (pyrouge.tests.Rouge155_test.PyrougeTest)

Error4: test_options (pyrouge.tests.Rouge155_test.PyrougeTest)

Error5: test_paths (pyrouge.tests.Rouge155_test.PyrougeTest)

Error6: test_rouge_for_plain_text (pyrouge.tests.Rouge155_test.PyrougeTest)

Error7: test_text_conversion (pyrouge.tests.Rouge155_test.PyrougeTest)

Error8: test_write_config (pyrouge.tests.Rouge155_test.PyrougeTest)

Error9: test_wrong_model_pattern (pyrouge.tests.Rouge155_test.PyrougeTest)

Error10: test_wrong_system_pattern (pyrouge.tests.Rouge155_test.PyrougeTest)

以下是详细的第一个和最后一个错误:

第一个错误: """

EEEEEEEEEE
======================================================================
ERROR: test_config_file (pyrouge.tests.Rouge155_test.PyrougeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\pyrouge\tests\Rouge155_test.py", line 138,
 in test_config_file
    rouge = Rouge155()
  File "C:\Python27\lib\site-packages\pyrouge\Rouge155.py", line 88, in __init__

    self.__set_rouge_dir(rouge_dir)
  File "C:\Python27\lib\site-packages\pyrouge\Rouge155.py", line 402, in __set_r
ouge_dir
    self._home_dir = self.__get_rouge_home_dir_from_settings()
  File "C:\Python27\lib\site-packages\pyrouge\Rouge155.py", line 416, in __get_r
ouge_home_dir_from_settings
    with open(self._settings_file) as f:
IOError: [Errno 2] No such file or directory: u'C:\\Users\\IQ\\AppData\\Roaming\
\pyrouge\\settings.ini'

"""

上次错误: """

ERROR: test_wrong_system_pattern (pyrouge.tests.Rouge155_test.PyrougeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\pyrouge\tests\Rouge155_test.py", line 59,
in test_wrong_system_pattern
    rouge = Rouge155()
  File "C:\Python27\lib\site-packages\pyrouge\Rouge155.py", line 88, in __init__

    self.__set_rouge_dir(rouge_dir)
  File "C:\Python27\lib\site-packages\pyrouge\Rouge155.py", line 402, in __set_r
ouge_dir
    self._home_dir = self.__get_rouge_home_dir_from_settings()
  File "C:\Python27\lib\site-packages\pyrouge\Rouge155.py", line 416, in __get_r
ouge_home_dir_from_settings
    with open(self._settings_file) as f:
IOError: [Errno 2] No such file or directory: u'C:\\Users\\IQ\\AppData\\Roaming\
\pyrouge\\settings.ini'

"""

我已打开目录:C:\ Users \ IQ \ AppData \ Roaming \ pyrouge \,但它是空的。 我想知道这是错的,以及如何解决它。

谢谢。

2 个答案:

答案 0 :(得分:1)

从您的初始问题的答案开始:

"假设工作ROUGE-1.5.5。安装"与您的pyrouge安装不对应。它引用了以下内容。 (也许你马上得到了,我没有) https://github.com/andersjo/pyrouge/tree/master/tools/ROUGE-1.5.5

pyrouge_set_rouge_path是一个脚本,而不是您必须设置的变量。 该脚本位于Python_PATH \ Scripts。 因此尝试类似的事情:

python Python_PATH\Scripts\pyrouge_set_rouge_path C:\rouge

或者,您可以使用以下内容在相应位置创建文件settings.ini:

[pyrouge settings]
home_dir = C:\rouge

其中C:\ rouge应该是文件ROUGE-1.5.5.pl

的位置

答案 1 :(得分:1)

您应首先按照this tutorial安装ROUGE-1.5.5。只需要安装两个命令,无需配置。请记住生成wordnet bd文件。通过运行

./WordNet-2.0-Exceptions/buildExeptionDB.pl ./WordNet-2.0-Exceptions ./smart_common_words.txt ./WordNet-2.0.exc.db

在数据目录下。

然后从source安装pyrouge。请记住注释掉会触发错误的打印行。

然后一切都会好起来的。