I have been trying to use the ROUGE Perl toolkit to evaluate one of my research projects but have been finding it really hard to get proper documentation on its usage. So I decided to piece together some information that may be helpful to others. Actually, I learnt the basics of using ROUGE from the MEAD documentation! If you have successfully installed ROUGE and need to set up the evaluation mechanism, read on. If you need information on how to install ROUGE, go through the README file in the the ROUGE package. Basically, the trick is in the successful installation of the perl modules. If you need to understand at a high level how ROUGE works as a metric, you can read this article.
First off, to evaluate a summarization system you have two types of summaries. One is the system generated summaries that is referred to as ‘peer summaries’ and then you have the reference summaries or gold standard summaries known as ‘model summaries’. Reference summaries are usually written by humans and it has been shown that using multiple reference summaries yields in more reliable ROUGE scores than using just one reference summary. Note that ROUGE can handle any number of peer summaries (if generated by multiple systems) and any number of model summaries. All you have to really do, is specify all of this in an xml file.
New! Edit 2016 – Java Based ROUGE: For those who cannot get the perl version to work on Windows or your Linux Machine, you can use ROUGE 2.0 implemented in Java with Unicode support and full documentation. You can also request inclusion of new measures that you are proposing into this code base once your work is accepted at a conference/journal.
To get started, create a directory structure as folllows anywhere on your system:
- models/ —- contains all reference summaries that will be used for evaluation. Each file can be identified by the the the set of documents for which the summary was generated. Say, a summary was generated for document set 3, by human 2. Then the file name can be something like human2_doc3.html
- systems/ — contains all system generated summaries. Each file can be identified by the id of the system and the set of documents for which the summary was generated. Say, a summary was generated for document set 3, by system 1. Then the file name can be something like system1_doc3.html.
- settings.xml — This file is the core file that specifies which peer summaries should use which model summaries for evaluation. Detailed explanation as below.
How to format settings.xml ?
Here I will only explain the basic syntax for formatting the core settings file. I am assuming that this file will be generated using some script so the formatting is really important. To learn how to format the system and model files look at the examples in <ROUGE_HOME>/sample-test/SL2003 or check out the samples below.
- The file should typically start with:
- Then, for each summarization task you need to enclose it between these tags:
- Within this enclosure you need to specify where to find the model and peer summaries. So make sure to include these tags:
<MODEL-ROOT> parent_dir_to_model_files </MODEL-ROOT>
<PEER-ROOT> parent_dir_to_peer_files </PEER-ROOT>
- Followed by:
<INPUT-FORMAT TYPE="SEE"> </INPUT-FORMAT>
- For each summarization task, we need to specify the system summaries and the reference summaries to evaluate against. Here is an example:<PEERS> – list of system generated summaries for the same task
<P ID=”1″>1.html</P> — system 1’s summary found in 1.html
<P ID=”2″>2.html</P> — system 2’s summary found in 2.html
<M ID=”0″>0.html</M> — reference summary 1 for this task is in 0.html
<M ID=”1″>1.html</M> — reference summary 2 for this task is in 1.html
For the next summarization task, repeat from point 2. Finally, finish by closing the XML tag with
How to format my model / peer summaries ?
The format that I use, is usually html. I am not sure if other formats are supported.The same format is used for both your reference/model/gold standard summaries and your peer summaries/system summaries. You may have to generate this using a script. Each summary will have its own file and each sentence from each summary will have to be on its own line. You may thus have to segment your summaries (if not already segmented). Here is an example of a model summary in a format that ROUGE understands. It has 3 sentences, as indicated by the id.
<a name=”1″></a> <a href=”#1″ id=1>This unit is generally quite accurate. </a>
<a name=”2″></a> <a href=”#2″ id=2>Set-up and usage are considered to be very easy. </a>
<a name=”3″></a> <a href=”#3″ id=3>The maps can be updated, and tend to be reliable.</a> </body>
Where to obtain gold-standard/model summaries ?
Well this really depends on your application. If you have a handful of documents that you need to summarize, then, just get your peers to write summaries for you. About 3-5 would be a good number in my opinion. Just give the summary writers very general instructions and make sure you influence them in no way. If you have a large number of documents to summarize you could consider using an online workforce like Amazon’s Mechanical Turk.
How to run my evaluation tasks ?
Once you have prepared the system summaries, model summaries and settings file as described above, its actually pretty straightforward. Here is an example:
./ROUGE-1.5.5.pl -e data -f A -a -x -s -m -2 -4 -u < your-project-name>/settings.xml
This example is to evaluate using ROUGE-SU4
- -e specifies the location of the data directory that comes with ROUGE. This is mandatory, because it contains the stop-words files within it.
- -a specifies which systems you want to evaluate
- -m specifies the usage of stemming
- -2 -4 -u says use ROUGE SU with a skip-bigrams of 4 and also compute unigram scores
- -x is to say that you do not want ROUGE-L to be computed (this is computed by default)
To get a list of adjustable parameters, just run ./ROUGE-1.5.5.pl without any parameters.
How do I analyze my ROUGE scores?
ROUGE produces output in a format that cannot be easily analyzed.You have to essentially write a script to parse the results into a format suitable to you. I have written a perl script to parse the results into a CSV format. It allows you to visualize and analyze your results in Open Office or Excel. All you need to do is pipe all your ROUGE results to a text file and provide that as input to the perl script. Download the tool here.
Jackknifing with ROUGE
Jackknifing is typically used when human summaries need to be comparable with system generated ones. This is assuming you have multiple human (reference/model) summaries. ROUGE used to internally implement jackknifing, but this was removed as of version 1.5.5. I do not know the rationale for this but if you need to implement it its pretty simple.
Say you have K reference summaries, you compute ROUGE scores over K sets of K-1 reference summaries. Which means, you leave out one reference summary each time. If you are attempting to compute human performance, then the reference summary that you leave out, will temporarily be your ‘system’ or ‘peer’ summary. Once you have the K ROUGE scores, you just need to average it to get the final ROUGE score. The Rouge2CSV perl tool, will help you combine and average these scores if you pipe all your ROUGE results to one file.
I am Having WordNet Exceptions
The Wordnet stuff seems to be a problem that a lot of people run into. You essentially need to build a link to the WordNet exception. This was the solution given by Chin Yew Lin :
./buildExeptionDB.pl . exc WordNet-2.0.exc.db
ln -s WordNet-2.0-Exceptions/WordNet
Where do I find latest version of ROUGE?
Basics of ROUGE : ROUGE: A Package for Automatic Evaluation of Summaries
More questions ?
- For installation/perl exceptions and details on ROUGE please contact the owner Chin Yew Lin
- For questions related to this tutorial, you can contact me