code: def corpus_bleu(
      list_of_references,
      hypotheses,
      max_order=4,
      lowercase=False,
      smooth=False,
      return_all=True,
  ):
      """Computes corpus-level BLEU score.
  
      Args:
          list_of_references: A list of lists of references for each hypothesis.
              Each reference can be either a list of string tokens, or a string
              containing tokenized tokens separated with whitespaces.
              List can also be numpy array.
          hypotheses: A list of hypothesis sentences.
              Each hypothesis can be either a list of string tokens, or a
              string containing tokenized tokens separated with whitespaces.
              List can also be numpy array.
          lowercase (bool): If `True`, lowercase reference and hypothesis tokens.
          max_order (int): Maximum n-gram order to use when computing BLEU score.
          smooth (bool): Whether or not to apply (Lin et al. 2004) smoothing.
          return_all (bool): If `True`, returns BLEU and all n-gram precisions.
  
      Returns:
          If :attr:`return_all` is `False` (default), returns a float32
          BLEU score.
  
          If :attr:`return_all` is `True`, returns a list of float32 scores:
          `[BLEU] + n-gram precisions`, which is of length :attr:`max_order` + 1.
      """
      list_of_references = compat_as_text(list_of_references)
      hypotheses = compat_as_text(hypotheses)
  
      matches_by_order = [0] * max_order
      possible_matches_by_order = [0] * max_order
      reference_length = 0
      hyperthsis_length = 0
      for references, hyperthsis in zip(list_of_references, hypotheses):
          reference_length += min(len(r) for r in references)
          hyperthsis_length += len(hyperthsis)
  
          merged_ref_ngram_counts = collections.Counter()
          for reference in references:
              reference = _maybe_str_to_list(reference)
              if lowercase:
                  reference = _lowercase(reference)
              merged_ref_ngram_counts |= _get_ngrams(
                  reference, max_order
              )
  
          hyperthsis = _maybe_str_to_list(hyperthsis)
          if lowercase:
              hyperthsis = _lowercase(hyperthsis)
          hyperthsis_ngram_counts = _get_ngrams(hyperthsis, max_order)
  
          overlap = hyperthsis_ngram_counts & merged_ref_ngram_counts
          for ngram in overlap:
              matches_by_order[len(ngram) - 1] += overlap[ngram]
          for order in range(1, max_order + 1):
              possible_matches = len(hyperthsis) - order + 1
              if possible_matches > 0:
                  possible_matches_by_order[
                      order - 1
                  ] += possible_matches
  
      precisions = [0] * max_order
      for i in range(0, max_order):
          if smooth:
              precisions[i] = (matches_by_order[i] + 1.0) / (
                  possible_matches_by_order[i] + 1.0
              )
          else:
              if possible_matches_by_order[i] > 0:
                  precisions[i] = (
                      float(matches_by_order[i])
                      / possible_matches_by_order[i]
                  )
              else:
                  precisions[i] = 0.0
  
      if min(precisions) > 0:
          p_log_sum = sum(
              (1.0 / max_order) * math.log(p) for p in precisions
          )
          geo_mean = math.exp(p_log_sum)
      else:
          geo_mean = 0
  
      ratio = float(hyperthsis_length) / reference_length
  
      if ratio > 1.0:
          bp = 1.0
      else:
          try:
              bp = math.exp(1 - 1.0 / ratio)
          except ZeroDivisionError:
              bp = math.exp(1 - 1.0 / (ratio + 1e-8))
  
      bleu = geo_mean * bp
  
      if return_all:
          return [bleu * 100] + [p * 100 for p in precisions]
      else:
          return bleu * 100
  
imports: import collections
  import math
  from texar.tf.utils.dtypes import compat_as_text, is_str
label_desc: Use image node_id 5 for calling a global function with example usage: corpus_bleu(list_of_references, hypotheses, max_order, lowercase, smooth, return_all) and returns: unknown, unknown