Install Rouge and Pyrouge for python 2.7 (conda virtual env) on Linux 64

Who to complain to about this terrible package???? Its official website was down, its bugs and exceptions are famous, and its python wrapper code has errors...But everyone  use it for summarization tasks. Not cool at all.

忍不住吐槽,Rouge,一個連官網都關閉了的,純靠遺產繼承的,超級史詩級爛尾工程,還那麼多人用.....

pyrouge安裝了之後報錯居然改代碼搞定的,你特麼沒弄好就別發佈行不行?


Install Rouge and Pyrouge


Step 1: Create a new conda virtual env

conda create -n py27env python=2.7 pip

source activate py27env

# use " source deactivate" to deactivate the env


Step 2: Install pyrouge by conda from 3rd party

conda install -c auto pyrouge


Step 3: Download ROUGE-1.5.5 from its closed website by using a time machine (ask Einstein or go to Github), then copy ROUGE-1.5.5 to ~/rouge_path

cp RELEASE-1.5.5 ~/rouge/


Step 4: Set ROUGE path for pyrouge

pyrouge_set_rouge_path ~/rouge/RELEASE-1.5.5


Step 5: Install plugins for ROUGE-1.5.5

sudo cpan App::cpanminus

sudo cpanm XML::DOM


Step 6: Deal with Wordnet exceptions for ROUGE-1.5.5 (f**k)

cd ~/rouge/RELEASE-1.5.5/data/WordNet-2.0-Exceptions/

./buildExeptionDB.pl . exc WordNet-2.0.exc.db

cd ../

ln -s WordNet-2.0-Exceptions/WordNet-2.0.exc.db WordNet-2.0.exc.db


Step 7: Deal with test code errors for pyrouge (f**k AGAIN!)

In Rouge155_test.py file, you should modify two lines (refhttps://stackoverflow.com/a/41382391):

vi ~/.anaconda3/envs/py27env/lib/python2.7/site-packages/pyrouge/tests/Rouge155_test.py

modify

"pyrouge_evaluate_plain_text_files.py -m {} -s {} -sfp "

to

"pyrouge_evaluate_plain_text_files -m {} -s {} -sfp "

And, modify

"pyrouge_write_config_file.py -m {m} -s {s} " 

to

"pyrouge_write_config_file -m {m} -s {s} " 


Step 8: Run test until "OK" appears.

>python -m pyrouge.test

Ran 10 tests in 10.583s


OK

Done. 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章