Search code examples
pythonnlprouge

What can I call out a portion of the result return from Rouge?


Beginner here that needs help!

Tried googling but not much info

What should i do if I only want to return only the set of digits in rouge-l?

enter image description here


Solution

  • I don't think rouge package allows it but you can just format the output:

    formatted_scores = [{key: {k: "{0:.2f}".format(v) for k, v in value.items()} for key, value in s.items()} for s in scores]
    print(formatted_scores)
    

    [{'rouge-1': {'f': '0.67', 'p': '0.67', 'r': '0.67'}, 'rouge-2': {'f': '0.50', 'p': '0.50', 'r': '0.50'}, 'rouge-l': {'f': '0.67', 'p': '0.67', 'r': '0.67'}}]