class_docstr: Computes BLEU Score.
class_docstr_tok: ["Computes","BLEU","Score","."]
docstr: Accumulator is the running total of 'stats' of type np.ndarray.
  
  'stats' semantics are preserved here from the wrapped implementation.
  stats = [hyp_len, ref_len, correct, total] where
  hyp_len = number of unigrams (words) in the hypothesis
  ref_len = number of unigrams (words) in the reference
    Note, ending punctuation (periods, exclamation points, etc.) count as
    their own unigram.
    For example, 'Google.' has 2 unigrams: 'Google' and '.'
  correct[n - 1] = number of matching n-grams for n > 0
    correct[0] = number of matching unigrams
    correct[1] = number of matching bigrams
    ...
  total[n - 1] = (
      max(number of n-grams in hyp, number of n-grams in ref) for n > 0
  )
    total[] follows same pattern as correct[]
  
  Args: None.
  
  Returns:
    'stats' list of all zeros.
docstr_tok: ["Accumulator","is","the","running","total","of","'stats","'","of","type","np.ndarray",".","'stats","'","semantics","are","preserved","here","from","the","wrapped","implementation",".","stats","=","[","hyp_len",",","ref_len",",","correct",",","total","]","where","hyp_len","=","number","of","unigrams","(","words",")","in","the","hypothesis","ref_len","=","number","of","unigrams","(","words",")","in","the","reference","Note",",","ending","punctuation","(","periods",",","exclamation","points",",","etc",".",")","count","as","their","own","unigram",".","For","example",",","'Google",".","'","has","2","unigrams",":","'Google","'","and","'",".","'","correct","[","n","-","1","]","=","number","of","matching","n-grams","for","n",">","0","correct","[","0","]","=","number","of","matching","unigrams","correct","[","1","]","=","number","of","matching","bigrams","...","total","[","n","-","1","]","=","(","max","(","number","of","n-grams","in","hyp",",","number","of","n-grams","in","ref",")","for","n",">","0",")","total","[","]","follows","same","pattern","as","correct","[","]","Args",":","None",".","Returns",":","'stats","'","list","of","all","zeros","."]
code: def create_accumulator(self):
      """Accumulator is the running total of 'stats' of type np.ndarray.
  
      'stats' semantics are preserved here from the wrapped implementation.
      stats = [hyp_len, ref_len, correct, total] where
      hyp_len = number of unigrams (words) in the hypothesis
      ref_len = number of unigrams (words) in the reference
        Note, ending punctuation (periods, exclamation points, etc.) count as
        their own unigram.
        For example, 'Google.' has 2 unigrams: 'Google' and '.'
      correct[n - 1] = number of matching n-grams for n > 0
        correct[0] = number of matching unigrams
        correct[1] = number of matching bigrams
        ...
      total[n - 1] = (
          max(number of n-grams in hyp, number of n-grams in ref) for n > 0
      )
        total[] follows same pattern as correct[]
  
      Args: None.
  
      Returns:
        'stats' list of all zeros.
      """
      return np.zeros(self.stats_len, dtype=int)
  
file_path: model-analysis/tensorflow_model_analysis/metrics/bleu.py
imports: from typing import Dict, Iterable, Optional
  import apache_beam
  import numpy
  import sacrebleu
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.proto import config_pb2
label_desc: Use image node_id 2 for calling the _BleuCombiner obj's underlying member method code with example usage: obj.create_accumulator() and returns: np