class_docstr: Recall-Oriented Understudy for Gisting Evaluation (ROUGE)
  
  ROUGE is a metric for measuring the quality of summaries. It is based on calculating the recall
  between ngrams in the predicted summary and a set of reference summaries. See [Lin,
  "ROUGE: A Package For Automatic Evaluation Of Summaries", 2004]
  (https://api.semanticscholar.org/CorpusID:964287).
  
  # Parameters
  
  ngram_size : `int`, optional (default = `2`)
      ROUGE scores are calculate for ROUGE-1 .. ROUGE-`ngram_size`
  exclude_indices : `Set[int]`, optional (default = `None`)
      Indices to exclude when calculating ngrams. This should usually include
      the indices of the start, end, and pad tokens.
class_docstr_tok: ["Recall-Oriented","Understudy","for","Gisting","Evaluation","(","ROUGE",")","ROUGE","is","a","metric","for","measuring","the","quality","of","summaries",".","It","is","based","on","calculating","the","recall","between","ngrams","in","the","predicted","summary","and","a","set","of","reference","summaries",".","See","[","Lin",",","''","ROUGE",":","A","Package","For","Automatic","Evaluation","Of","Summaries","''",",","2004","]","(","https",":","\/\/api.semanticscholar.org\/CorpusID:964287",")",".","#","Parameters","ngram_size",":","`","int","`",",","optional","(","default","=","`","2","`",")","ROUGE","scores","are","calculate","for","ROUGE-1","..","ROUGE-","`","ngram_size","`","exclude_indices",":","`","Set","[","int","]","`",",","optional","(","default","=","`","None","`",")","Indices","to","exclude","when","calculating","ngrams",".","This","should","usually","include","the","indices","of","the","start",",","end",",","and","pad","tokens","."]
docstr: # Parameters
  
  reset : `bool`, optional (default = `False`)
      Reset any accumulators or internal state.
  
  # Returns
  
  Dict[str, float]:
      A dictionary containing `ROUGE-1` .. `ROUGE-ngram_size` scores.
docstr_tok: ["#","Parameters","reset",":","`","bool","`",",","optional","(","default","=","`","False","`",")","Reset","any","accumulators","or","internal","state",".","#","Returns","Dict","[","str",",","float","]",":","A","dictionary","containing","`","ROUGE-1","`","..","`","ROUGE-ngram_size","`","scores","."]
code: def get_metric(self, reset: bool = False) -> Dict[str, float]:
      """
      # Parameters
  
      reset : `bool`, optional (default = `False`)
          Reset any accumulators or internal state.
  
      # Returns
  
      Dict[str, float]:
          A dictionary containing `ROUGE-1` .. `ROUGE-ngram_size` scores.
      """
  
      metrics = {}
  
      # ROUGE-N
      # Recall
      metrics.update(
          {
              f"ROUGE-{i}_R": self._metric_mean(
                  self._total_rouge_n_recalls[i]
              )
              for i in range(1, self._ngram_size + 1)
          }
      )
  
      # Precision
      metrics.update(
          {
              f"ROUGE-{i}_P": self._metric_mean(
                  self._total_rouge_n_precisions[i]
              )
              for i in range(1, self._ngram_size + 1)
          }
      )
  
      # F1
      metrics.update(
          {
              f"ROUGE-{i}_F1": self._metric_mean(
                  self._total_rouge_n_f1s[i]
              )
              for i in range(1, self._ngram_size + 1)
          }
      )
  
      # ROUGE-L
      # F1
      metrics["ROUGE-L"] = self._metric_mean(self._total_rouge_l_f1)
  
      if reset:
          self.reset()
  
      return metrics
  
file_path: allennlp/allennlp/training/metrics/rouge.py
imports: from collections import defaultdict
  from typing import Tuple, Dict, Set, Optional
  import torch
  from allennlp.training.metrics.metric import Metric
  from allennlp.nn.util import dist_reduce_sum
label_desc: Use image node_id 8 for calling the ROUGE obj's underlying member method code with example usage: obj.get_metric(reset) and returns: metrics