class_docstr: Calculate BLEU for ST and MT models during training.
  
  :param y_hats: numpy array with predicted text
  :param y_pads: numpy array with true (target) text
  :param char_list: vocabulary list
  :param sym_space: space symbol
  :param sym_pad: pad symbol
  :param report_bleu: report BLUE score if True
docstr: Construct an ErrorCalculator object.
code: def __init__(self, char_list, sym_space, sym_pad, report_bleu=False):
      """Construct an ErrorCalculator object."""
      super(ErrorCalculator, self).__init__()
      self.char_list = char_list
      self.space = sym_space
      self.pad = sym_pad
      self.report_bleu = report_bleu
      if self.pad in self.char_list:
          self.idx_blank = self.char_list.index(self.pad)
      else:
          # for OpenAI Whisper model, which doesn't use <blank> token
          self.idx_blank = None
      if self.space in self.char_list:
          self.idx_space = self.char_list.index(self.space)
      else:
          self.idx_space = None
  
file_path: espnet/espnet/nets/e2e_mt_common.py
imports: from itertools import groupby
  import nltk
  import numpy
label_desc: Use image node_id 1 to create a new ErrorCalculator object from inherited base classes: object with example: obj = ErrorCalculator(char_list, sym_space, sym_pad, report_bleu)