installing pyrouge gets error in ubuntu

9.4k views Asked by At

i wants to install pyrouge in Ubuntu for the purpose of text summarization evaluation. i use the instructions in this.

first i wrote pip install pyrouge then i must write this command: pyrouge_set_rouge_path /absolute/path/to/ROUGE-1.5.5/directory.

In my system i wrote:

pyrouge_set_rouge_path /home/afsharizadeh/anaconda3/lib/python3.6/site-packages/pyrouge

and get this:

Exception: Cannot set data directory because the path /home/afsharizadeh/anaconda3/lib/python3.6/site-packages/pyrouge/data does not exist.

and also

pyrouge_set_rouge_path /home/afsharizadeh/pyrouge-0.1.0/pyrouge

and get this:

Exception: Cannot set data directory because the path /home/afsharizadeh/pyrouge-0.1.0/pyrouge/data does not exist.

and also

pyrouge_set_rouge_path /home/afsharizadeh/pyrouge-0.1.0/pyrouge/test

and get this:

Exception: ROUGE binary not found at /home/afsharizadeh/pyrouge-0.1.0/pyrouge/test/ROUGE-1.5.5.pl. Please set the correct path by running pyrouge_set_rouge_path /path/to/rouge/home.

i know that similar questions about this problem, was asked in stack overflow but i cant solve my problem because i don't know at all what is meant by this expression "ROUGE path". what is meant by "path to ROUGE-1.5.5"?

i know i have two directories about pyrouge. one of them is this path: ~/anaconda3/lib/python3.6/site-packages/pyrouge and the other is the directory that i was downloaded it from site. this path is: ~/pyrouge-0.1.0. this directory has three other directories whit names: bin, pyrouge, pyrouge.egg-info.

based on this page i wrote in this format:

set pyrouge_set_rouge_path=/home/afsharizadeh/anaconda3/lib/python3.6/site-packages/pyroug

after this kind of format,no errors appear but when after that i type:

python -m pyrouge.test 

i get this error:

Exception: Cannot set data directory because the path /home/afsharizadeh/anaconda3/lib/python3.6/site-packages/pyroug/data does not exist.

---------------------------------------------------------------------- Ran 11 tests in 0.592s

FAILED (errors=9)

what should i do?

3

There are 3 answers

3
Mahsa On BEST ANSWER

Using the latest version of pyrouge on Github repo, the issue was solved. For this purpose, I replaced the following commands:

pip install pyrouge
pyrouge_set_rouge_path /absolute/path/to/ROUGE-1.5.5/directory
python -m pyrouge.test

with these commands:

git clone https://github.com/bheinzerling/pyrouge
cd pyrouge
python setup.py install
pyrouge_set_rouge_path /absolute/path/to/ROUGE-1.5.5/directory
python -m pyrouge.test

After doing this, Everything goes Okay and I get this successful message of testing:

Ran 11 tests in 6.322s
OK

UPDATE: Note that you need to install the official version of ROUGE metric to get pyrouge working.

0
athar Sefid On

you need the following packages in CentOS:

sudo yum install "perl(XML::LibXML)"

yum install perl-DB_File

1
Astariul On

All the steps to follow (only for Linux):

Step 1 : Install Pyrouge from source (not from pip)

git clone https://github.com/bheinzerling/pyrouge
cd pyrouge
pip install -e .

Step 2 : Install official ROUGE script

git clone https://github.com/andersjo/pyrouge.git rouge

Step 3 : Point Pyrouge to official rouge script

pyrouge_set_rouge_path ~/pyrouge/rouge/tools/ROUGE-1.5.5/

The path given to pyrouge should be absolute path !

Step 4 : Install libxml parser

As mentioned in this issue, you need to install libxml parser :

sudo apt-get install libxml-parser-perl

Step 5 : Regenerate the Exceptions DB

As mentioned in this issue, you need to regenerate the Exceptions DB :

cd rouge/tools/ROUGE-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

Step 6 : Run the tests

python -m pyrouge.test

You should see :

Ran 11 tests in 6.322s
OK