class_docstr: Calculate CER and WER for transducer models.
  
  Args:
      decoder: Decoder module.
      joint_network: Joint Network module.
      token_list: List of token units.
      sym_space: Space symbol.
      sym_blank: Blank symbol.
      nstep: Maximum number of symbol expansions at each time step w/ mAES.
      report_cer: Whether to compute CER.
      report_wer: Whether to compute WER.
class_docstr_tok: ["Calculate","CER","and","WER","for","transducer","models",".","Args",":","decoder",":","Decoder","module",".","joint_network",":","Joint","Network","module",".","token_list",":","List","of","token","units",".","sym_space",":","Space","symbol",".","sym_blank",":","Blank","symbol",".","nstep",":","Maximum","number","of","symbol","expansions","at","each","time","step","w\/","mAES",".","report_cer",":","Whether","to","compute","CER",".","report_wer",":","Whether","to","compute","WER","."]
docstr: Construct an ErrorCalculatorTransducer object.
docstr_tok: ["Construct","an","ErrorCalculatorTransducer","object","."]
code: def __init__(
      self,
      decoder: AbsDecoder,
      joint_network: JointNetwork,
      token_list: List[int],
      sym_space: str,
      sym_blank: str,
      nstep: int = 2,
      report_cer: bool = False,
      report_wer: bool = False,
  ) -> None:
      """Construct an ErrorCalculatorTransducer object."""
      super().__init__()
  
      # (b-flo): Since the commit #8c9c851 we rely on the mAES algorithm for
      # validation instead of the default algorithm.
      #
      # With the addition of k2 pruned transducer loss, the number of emitted symbols
      # at each timestep can be restricted during training. Performing an unrestricted
      # (/ unconstrained) decoding without regard to the training conditions can lead
      # to huge performance degradation. It won't be an issue with mAES and the user
      # can now control the number of emitted symbols during validation.
      #
      # Also, under certain conditions, using the default algorithm can lead to a long
      # decoding procedure due to the loop break condition. Other algorithms,
      # such as mAES, won't be impacted by that.
      self.beam_search = BeamSearchTransducer(
          decoder=decoder,
          joint_network=joint_network,
          beam_size=2,
          search_type="maes",
          nstep=nstep,
          score_norm=False,
      )
  
      self.decoder = decoder
  
      self.token_list = token_list
      self.space = sym_space
      self.blank = sym_blank
  
      self.report_cer = report_cer
      self.report_wer = report_wer
  
file_path: espnet/espnet2/asr_transducer/error_calculator.py
imports: from typing import List, Optional, Tuple
  import torch
  from espnet2.asr_transducer.beam_search_transducer import BeamSearchTransducer
  from espnet2.asr_transducer.decoder.abs_decoder import AbsDecoder
  from espnet2.asr_transducer.joint_network import JointNetwork
label_desc: Use image node_id 1 to create a new ErrorCalculator object  with example: obj = ErrorCalculator(decoder, joint_network, token_list, sym_space, sym_blank, nstep, report_cer, report_wer)