class_docstr: A class for tracking BLEU (https://www.aclweb.org/anthology/P02-1040.pdf).
  Arguments
  ---------
  merge_words: bool
      Whether to merge the successive words to create sentences.
  Example
  -------
  >>> bleu = BLEUStats()
  >>> i2l = {0: 'a', 1: 'b'}
  >>> bleu.append(
  ...     ids=['utterance1'],
  ...     predict=[[0, 1, 1]],
  ...     targets=[[[0, 1, 0]], [[0, 1, 1]], [[1, 1, 0]]],
  ...     ind2lab=lambda batch: [[i2l[int(x)] for x in seq] for seq in batch],
  ... )
  >>> stats = bleu.summarize()
  >>> stats['BLEU']
  0.0
docstr: Add stats to the relevant containers.
  * See MetricStats.append()
  Arguments
  ---------
  ids : list
      List of ids corresponding to utterances.
  predict : torch.tensor
      A predicted output, for comparison with the target output
  targets : list
      list of references (when measuring BLEU, one sentence could have more
                          than one target translation).
  ind2lab : callable
      Callable that maps from indices to labels, operating on batches,
      for writing alignments.
docstr_tok: ["Add","stats","to","the","relevant","containers",".","*","See","MetricStats.append","(",")","Arguments","--","--","--","--","-","ids",":","list","List","of","ids","corresponding","to","utterances",".","predict",":","torch.tensor","A","predicted","output",",","for","comparison","with","the","target","output","targets",":","list","list","of","references","(","when","measuring","BLEU",",","one","sentence","could","have","more","than","one","target","translation",")",".","ind2lab",":","callable","Callable","that","maps","from","indices","to","labels",",","operating","on","batches",",","for","writing","alignments","."]
code: def append(
      self,
      ids,
      predict,
      targets,
      ind2lab=None,
  ):
      """Add stats to the relevant containers.
      * See MetricStats.append()
      Arguments
      ---------
      ids : list
          List of ids corresponding to utterances.
      predict : torch.tensor
          A predicted output, for comparison with the target output
      targets : list
          list of references (when measuring BLEU, one sentence could have more
                              than one target translation).
      ind2lab : callable
          Callable that maps from indices to labels, operating on batches,
          for writing alignments.
      """
      self.ids.extend(ids)
  
      if ind2lab is not None:
          predict = ind2lab(predict)
          targets = [ind2lab(t) for t in targets]
  
      if self.merge_words:
          predict = merge_words(predict)
          targets = [merge_words(t) for t in targets]
  
      self.predicts.extend(predict)
      if self.targets is None:
          self.targets = targets
      else:
          assert len(self.targets) == len(targets)
          for i in range(len(self.targets)):
              self.targets[i].extend(targets[i])
  
imports: from speechbrain.utils.metric_stats import MetricStats
label_desc: Use image node_id 2 for calling the BLEUStats obj's underlying member method code with example usage: obj.append(ids, predict, targets, ind2lab) without return types