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 __init__(self, task: str, device: str = "cpu"):
      self.rouge_fns = {
          "rouge_1": get_rouge_function("rouge1"),
          "rouge_2": get_rouge_function("rouge2"),
          "rouge_l": get_rouge_function("rougeL"),
      }
      # Download en_core_web_sm before importing DataStatsMetric to
      # avoid triggering a bug in DataStatsMetric that raises
      # `NameError: name 'stderr' is not defined`
      if not spacy.util.is_package("en_core_web_sm"):
          spacy.cli.download("en_core_web_sm")  # type: ignore
      from summ_eval.data_stats_metric import DataStatsMetric
  
      self.data_stats_metric = DataStatsMetric()
      self.task: str = task
      self.qa_fact_eval: Optional[Dict] = None
      self.humaneval: Optional[Dict] = None
  
      if device == "cpu":
          self.compute_faithfulness = False
          self.compute_bertscore = False
      else:
          self.compute_bertscore = True
          self.bert_scorer = BERTScorer(
              model_type="microsoft/deberta-large-mnli",
              lang="en",
              rescale_with_baseline=True,
              device=device,
          )
          # Need GPU for faithfulness metrics since they are model-based.
          self.compute_faithfulness = True
          self.summac = SummaCZS(
              granularity="sentence",
              model_name="vitc",
              imager_load_cache=False,
              device=device,
          )
  
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 1 to create a new SummarizationMetric object from inherited base classes: Metric with example: obj = SummarizationMetric(task, device)