CoderPat / structured-neural-summarization

A repository with the code for the paper with the same title
MIT License
74 stars 26 forks source link

Which Rouge package was used? #22

Closed shandou closed 5 years ago

shandou commented 5 years ago

The train_and_eval.py code errored out upon the following line:

from rouge import Rouge
...
def compute_rouge(predictions, targets):
    predictions = [" ".join(prediction).lower() for prediction in predictions]
    predictions = [prediction if prediction else "EMPTY" for prediction in predictions]
    targets = [" ".join(target).lower() for target in targets]
    targets = [target if target else "EMPTY" for target in targets]
    rouge = Rouge()
# Error 1: reports all kwargs as unexpected
#    scores = rouge.get_scores(hyps=predictions, refs=targets, avg=True)
    scores = rouge.get_scores(predictions, targets)
# Error 2: scores should have been a list of nested dictionaries
#    return scores['rouge-2']['f']
    return scores[0]['rouge-2']['f']

I am using a rouge library installed from https://github.com/pltrdy/rouge, and although the outputs are largely similar, I can see the API differences. Would you mind pointing me to the correct rouge library? Thanks a lot!

ioana-blue commented 5 years ago

That's why a list or requirements would be nice...

This worked for me: https://pypi.org/project/rouge/

So simply:

pip install rouge