class_docstr: ASR Transducer Task definition.
class_docstr_tok: ["ASR","Transducer","Task","definition","."]
docstr: Build pre-processing function.
  
  Args:
      cls: ASRTransducerTask object.
      args: Task arguments.
      train: Training mode.
  
  Return:
      : Callable pre-processing function.
docstr_tok: ["Build","pre-processing","function",".","Args",":","cls",":","ASRTransducerTask","object",".","args",":","Task","arguments",".","train",":","Training","mode",".","Return",":",":","Callable","pre-processing","function","."]
code: def build_preprocess_fn(
      cls, args: argparse.Namespace, train: bool
  ) -> Optional[
      Callable[[str, Dict[str, np.array]], Dict[str, np.ndarray]]
  ]:
      """Build pre-processing function.
  
      Args:
          cls: ASRTransducerTask object.
          args: Task arguments.
          train: Training mode.
  
      Return:
          : Callable pre-processing function.
  
      """
      assert check_argument_types()
  
      if args.use_preprocessor:
          retval = CommonPreprocessor(
              train=train,
              token_type=args.token_type,
              token_list=args.token_list,
              bpemodel=args.bpemodel,
              non_linguistic_symbols=args.non_linguistic_symbols,
              text_cleaner=args.cleaner,
              g2p_type=args.g2p,
              rir_scp=args.rir_scp
              if hasattr(args, "rir_scp")
              else None,
              rir_apply_prob=args.rir_apply_prob
              if hasattr(args, "rir_apply_prob")
              else 1.0,
              noise_scp=args.noise_scp
              if hasattr(args, "noise_scp")
              else None,
              noise_apply_prob=args.noise_apply_prob
              if hasattr(args, "noise_apply_prob")
              else 1.0,
              noise_db_range=args.noise_db_range
              if hasattr(args, "noise_db_range")
              else "13_15",
              speech_volume_normalize=args.speech_volume_normalize
              if hasattr(args, "rir_scp")
              else None,
          )
      else:
          retval = None
  
      assert check_return_type(retval)
      return retval
  
imports: import argparse
  import logging
  import os
  from typing import Callable, Collection, Dict, List, Optional, Tuple
  import numpy
  import torch
  from typeguard import check_argument_types, check_return_type
  from espnet2.asr.frontend.abs_frontend import AbsFrontend
  from espnet2.asr.frontend.default import DefaultFrontend
  from espnet2.asr.frontend.windowing import SlidingWindow
  from espnet2.asr.specaug.abs_specaug import AbsSpecAug
  from espnet2.asr.specaug.specaug import SpecAug
  from espnet2.asr_transducer.decoder.abs_decoder import AbsDecoder
  from espnet2.asr_transducer.decoder.mega_decoder import MEGADecoder
  from espnet2.asr_transducer.decoder.rnn_decoder import RNNDecoder
  from espnet2.asr_transducer.decoder.rwkv_decoder import RWKVDecoder
  from espnet2.asr_transducer.decoder.stateless_decoder import StatelessDecoder
  from espnet2.asr_transducer.encoder.encoder import Encoder
  from espnet2.asr_transducer.espnet_transducer_model import ESPnetASRTransducerModel
  from espnet2.asr_transducer.joint_network import JointNetwork
  from espnet2.layers.abs_normalize import AbsNormalize
  from espnet2.layers.global_mvn import GlobalMVN
  from espnet2.layers.utterance_mvn import UtteranceMVN
  from espnet2.tasks.abs_task import AbsTask
  from espnet2.text.phoneme_tokenizer import g2p_choices
  from espnet2.train.class_choices import ClassChoices
  from espnet2.train.collate_fn import CommonCollateFn
  from espnet2.train.preprocessor import CommonPreprocessor
  from espnet2.train.trainer import Trainer
  from espnet2.utils.get_default_kwargs import get_default_kwargs
  from espnet2.utils.nested_dict_action import NestedDictAction
  from espnet2.utils.types import float_or_none, int_or_none, str2bool, str_or_none
label_desc: Use image node_id 3 for calling the ASRTransducerTask obj's underlying member method code with example usage: obj.build_preprocess_fn(cls, args, train) and returns: retval