code: def _compute(
      self,
      predictions=None,
      references=None,
      reduced=True,
      min_len=2,
      max_len=5,
      return_match_count=False,
      return_match_fraction_by_pred_length=False,
      **kwargs,
  ):
      # if only one reference is provided make sure we still use list of lists
      if isinstance(references[0], str):
          references = [[ref] for ref in references]
      references_per_prediction = len(references[0])
      if any(
          len(refs) != references_per_prediction for refs in references
      ):
          raise ValueError(
              "Quip requires the same number of references for each prediction"
          )
      # transformed_references = [[refs[i] for refs in references] for i in range(references_per_prediction)]
  
      if reduced:
          punc = """"!"#$%&()*+,-./:;<=>?@[\\]^_{|}~"""
  
          for predi, pred in enumerate(predictions):
              pred = pred.translate(
                  str.maketrans(punc, " " * len(punc))
              ).strip()
              predictions[predi] = " ".join(
                  [x for x in pred.split() if x not in self.set_common]
              )
  
          for refi, refl in enumerate(references):
              for refj, ref in enumerate(refl):
                  ref = ref.translate(
                      str.maketrans(punc, " " * len(punc))
                  ).strip()
                  references[refi][refj] = " ".join(
                      [
                          x
                          for x in ref.split()
                          if x not in self.set_common
                      ]
                  )
  
      from nltk.util import everygrams
      from utils import flatten_list
  
      pred_ngrams = set(
          flatten_list(
              [
                  list(
                      everygrams(
                          x.split(), min_len=min_len, max_len=max_len
                      )
                  )
                  for x in predictions
              ]
          )
      )
      ref_ngrams = set(
          flatten_list(
              [
                  [
                      list(
                          everygrams(
                              y.split(),
                              min_len=min_len,
                              max_len=max_len,
                          )
                      )
                      for y in z
                  ]
                  for z in references
              ]
          )
      )
      residual = pred_ngrams.difference(ref_ngrams)
      if return_match_count:
          return len(pred_ngrams) - len(residual)
      else:
          if not return_match_fraction_by_pred_length:
              # Score = 0.0: No match
              # Score = 1.0: Perfect match
              return 1.0 - len(residual) / len(pred_ngrams)
          else:
              # FIXME: only works with 1 prediction
              nmatches = len(pred_ngrams) - len(residual)
              return min(1.0, nmatches / len(predictions[0].split()))
  
file_path: h2ogpt/metrics/quip.py
imports: import os
  import datasets
  import pandas
  import sacrebleu
  from packaging import version
  from sacrebleu import CHRF
  import string
  import evaluate
label_desc: Use image node_id 3 for calling the Quip obj's underlying member method code with example usage: obj._compute(predictions, references, reduced, min_len, max_len, return_match_count, return_match_fraction_by_pred_length) and returns: unknown, unknown, min