bheinzerling / pyrouge

A Python wrapper for the ROUGE summarization evaluation package
MIT License
250 stars 71 forks source link

WordNet-2.0.exc.db error. #8

Closed eduOS closed 7 years ago

eduOS commented 7 years ago

I get stuck by this error for two days,,,

2017-07-19 11:57:28,358 [MainThread  ] [INFO ]  Set ROUGE home directory to /home/eduOS/software/ROUGE-1.5.5.
Cannot open exception db file for reading: /home/eduOS/software/ROUGE-1.5.5/data/WordNet-2.0.exc.db
Traceback (most recent call last):
  File "cal_rouge.py", line 53, in <module>
    results_dict = rouge_eval(rd, dd)
  File "cal_rouge.py", line 22, in rouge_eval
    rouge_results = r.convert_and_evaluate()
  File "/usr/local/lib/python2.7/dist-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 "/usr/local/lib/python2.7/dist-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 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '[u'/home/eduOS/software/ROUGE-1.5.5/ROUGE-1.5.5.pl', '-e', '/home/eduOS/software/ROUGE-1.5.5/data', '-c', '95', '-2', '-1', '-U', '-r', '1000', '-n', '4', '-w', '1.2', '-a', u'-m', u'/tmp/tmpmV_cZG/rouge_conf.xml']' returned non-zero exit status 2

And I have also tried the pyrouge from andersjo, but its API is different. How can I tackle this problem? What's going on here? I have tried to delete the file but cannot find it there.

eduOS commented 7 years ago

And here is the test error:

ERROR: test_rouge_for_plain_text (pyrouge.tests.Rouge155_test.PyrougeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pyrouge-0.1.3-py2.7.egg/pyrouge/tests/Rouge155_test.py", line 173, in test_rouge_for_plain_text
    pyrouge_output = check_output_clean(pyrouge_command.split())
  File "/usr/local/lib/python2.7/dist-packages/pyrouge-0.1.3-py2.7.egg/pyrouge/tests/Rouge155_test.py", line 17, in <lambda>
    check_output_clean = lambda c: check_output(c).decode("UTF-8").strip()
  File "/usr/lib/python2.7/subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '[u'pyrouge_evaluate_plain_text_files', u'-m', u'data/models_plain', u'-s', u'data/systems_plain', u'-sfp', u'D(\\d+).M.100.T.A', u'-mfp', u'D#ID#.M.100.T.[A-Z]', u'-id', u'1']' returned non-zero exit status 1

----------------------------------------------------------------------
Ran 11 tests in 1.435s

FAILED (errors=3)
eduOS commented 7 years ago

I solved it after reading this article, which reads that:

Error Handling

If you encounter following error message when you use pythonrouge

Cannot open exception db file for reading: /home/pythonrouge/pythonrouge/RELEASE-1.5.5/data/WordNet-2.0.exc.db

you can run pythonrouge by doing following.

cd pythonrouge/RELEASE-1.5.5/data/
rm WordNet-2.0.exc.db
./WordNet-2.0-Exceptions/buildExeptionDB.pl ./WordNet-2.0-Exceptions ./smart_common_words.txt ./WordNet-2.0.exc.db

I just run the command to generate the db file.

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

Under the data directory.

Franck-Dernoncourt commented 7 years ago

Or, if on Microsoft Windows:

Remove RELEASE-1.5.5\data\WordNet-2.0.exc.db, then from cmd.exe:

cd RELEASE-1.5.5\data\
perl WordNet-2.0-Exceptions/buildExeptionDB.pl ./WordNet-2.0-Exceptions ./smart_common_words.txt ./WordNet-2.0.exc.db