class_docstr: Summarization Metrics
  
  This class computes the following standard summarization metrics
  
  1. Rouge (1,2,L)
  2. Extractiveness (coverage, density, novel n-grams)
  3. Compression
  4. Faithfulness (SummaC)
code: def evaluate_generation(
      self,
      adapter_spec: AdapterSpec,
      request_state: RequestState,
      metric_service: MetricService,
      eval_cache_path: str,
  ) -> List[Stat]:
      refs: List[str] = [
          self._remove_braces(ref.output.text)
          for ref in request_state.instance.references
      ]
      inp: str = self._remove_braces(request_state.instance.input.text)
  
      assert request_state.result is not None
      pred: str = self._remove_braces(
          request_state.result.completions[0].text.strip()
      )
  
      result: List[Stat] = []
  
      try:
          if self.humaneval is None:
              self.humaneval = self._load_humaneval(eval_cache_path)
  
          # get human evaluation scores if they exist
          model_name = adapter_spec.model.replace("/", "_")
          for metric_name in ["faithfulness", "relevance", "coherence"]:
              val = self.humaneval[
                  (
                      metric_name,
                      model_name,
                      request_state.instance.id,
                      pred,
                  )
              ]
              result.append(
                  Stat(MetricName(f"HumanEval-{metric_name}")).add(
                      float(val)
                  )
              )
      except KeyError:
          pass
      except ValueError:
          pass  # HumanEval not available for this task
  
      try:
          # get qafacteval scores if they exist
          if self.qa_fact_eval is None:
              self._load_qafacteval(eval_cache_path)
          assert self.qa_fact_eval is not None
          model_name = adapter_spec.model.replace("/", "_")
          val = self.qa_fact_eval[model_name][
              (request_state.instance.id, pred)
          ]
          result.append(Stat(MetricName("QAFactEval")).add(float(val)))
      except KeyError:
          pass
      except ValueError:
          pass  # QAFactEval not available for this task
  
      # Compute rouge metrics
      result.extend(
          [
              Stat(MetricName(name)).add(float(val))
              for name, val in self._compute_rouge(refs, pred).items()
          ]
      )
  
      # Compute data stats
      result.extend(
          [
              Stat(MetricName(name)).add(float(val))
              for name, val in self._compute_data_stats(
                  inp, pred
              ).items()
          ]
      )
  
      # Compute faithfulness metric(s)
      if self.compute_faithfulness:
          result.extend(
              [
                  Stat(MetricName(name)).add(float(val))
                  for name, val in self._compute_faithfulness_scores(
                      inp, pred
                  ).items()
              ]
          )
  
      # Compute BERTScore
      if self.compute_bertscore:
          result.extend(
              [
                  Stat(MetricName(name)).add(float(val))
                  for name, val in self._compute_bert_score(
                      refs, pred
                  ).items()
              ]
          )
  
      return result
  
imports: import json
  import pandas
  import numpy
  import os
  import pickle
  import spacy
  from typing import List, Dict, Optional
  from collections import defaultdict
  from helm.benchmark.adaptation.scenario_state import ScenarioState
  from helm.benchmark.adaptation.request_state import RequestState
  from helm.benchmark.adaptation.adapter_spec import AdapterSpec
  from helm.common.hierarchical_logger import hlog
  from helm.common.general import ensure_file_downloaded
  from .metric import Metric, MetricResult
  from .metric_name import MetricName
  from .metric_service import MetricService
  from .basic_metrics import get_rouge_function
  from .statistic import Stat
  from .summac.model_summac import SummaCZS
  from bert_score import BERTScorer
label_desc: Use image node_id 10 for calling the SummarizationMetric obj's underlying member method code with example usage: obj.evaluate_generation(adapter_spec, request_state, metric_service, eval_cache_path) and returns: result