Dataset & evaluation script for ADL 2022 homework 3
git clone https://github.com/moooooser999/ADL22-HW3.git
cd ADL22-HW3
pip install -e tw_rouge
usage: eval.py [-h] [-r REFERENCE] [-s SUBMISSION]
optional arguments:
-h, --help show this help message and exit
-r REFERENCE, --reference REFERENCE
-s SUBMISSION, --submission SUBMISSION
Example:
python eval.py -r public.jsonl -s submission.jsonl
{
"rouge-1": {
"f": 0.21999419163162043,
"p": 0.2446195813913345,
"r": 0.2137398792982201
},
"rouge-2": {
"f": 0.0847583291303246,
"p": 0.09419044877345074,
"r": 0.08287844474014894
},
"rouge-l": {
"f": 0.21017939117006337,
"p": 0.25157090570020846,
"r": 0.19404349000921203
}
}
>>> from tw_rouge import get_rouge
>>> get_rouge('我是人', '我是一個人')
{'rouge-1': {'f': 0.7499999953125, 'p': 1.0, 'r': 0.6}, 'rouge-2': {'f': 0.33333332888888895, 'p': 0.5, 'r': 0.25}, 'rouge-l': {'f': 0.7499999953125, 'p': 1.0, 'r': 0.6}}
>>> get_rouge(['我是人'], [ '我是一個人'])
{'rouge-1': {'f': 0.7499999953125, 'p': 1.0, 'r': 0.6}, 'rouge-2': {'f': 0.33333332888888895, 'p': 0.5, 'r': 0.25}, 'rouge-l': {'f': 0.7499999953125, 'p': 1.0, 'r': 0.6}}
>>> get_rouge(['我是人'], ['我是一個人'], avg=False)
[{'rouge-1': {'f': 0.7499999953125, 'p': 1.0, 'r': 0.6}, 'rouge-2': {'f': 0.33333332888888895, 'p': 0.5, 'r': 0.25}, 'rouge-l': {'f': 0.7499999953125, 'p': 1.0, 'r': 0.6}}]