class_docstr: Transformer-based (duplex) decoder model for TN/ITN.
docstr: Setup covering grammars (if enabled).
  :param cfg: Configs of the decoder model.
code: def setup_cgs(self, cfg: DictConfig):
      """
      Setup covering grammars (if enabled).
      :param cfg: Configs of the decoder model.
      """
      self.use_cg = True
      self.neural_confidence_threshold = cfg.get(
          "neural_confidence_threshold", 0.99
      )
      self.n_tagged = cfg.get("n_tagged", 1)
      input_case = "cased"  # input_case is cased by default
      if (
          hasattr(self.tokenizer, "do_lower_case")
          and self.tokenizer.do_lower_case
      ):
          input_case = "lower_cased"
  
      if PYNINI_AVAILABLE:
          self.cg_normalizer = NormalizerWithAudio(
              input_case=input_case, lang=self.lang
          )
      else:
          self.cg_normalizer = None
          logging.warning(
              "`nemo_text_processing` is not installed, see https://github.com/NVIDIA/NeMo-text-processing for details"
          )
  
imports: import json
  import os
  from collections import defaultdict
  from math import ceil
  from typing import Dict, List, Optional, Union
  import torch
  from omegaconf import DictConfig
  from pytorch_lightning import Trainer
  from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, DataCollatorForSeq2Seq
  import nemo.collections.nlp.data.text_normalization.constants
  from nemo.collections.common.tokenizers.moses_tokenizers import MosesProcessor
  from nemo.collections.nlp.data.text_normalization import TextNormalizationTestDataset
  from nemo.collections.nlp.data.text_normalization.decoder_dataset import TarredTextNormalizationDecoderDataset, TextNormalizationDecoderDataset
  from nemo.collections.nlp.models.duplex_text_normalization.utils import get_formatted_string
  from nemo.collections.nlp.models.nlp_model import NLPModel
  from nemo.core.classes.common import PretrainedModelInfo, typecheck
  from nemo.core.neural_types import ChannelType, LabelsType, LossType, MaskType, NeuralType
  from nemo.utils import logging
label_desc: Use image node_id 4 for calling the DuplexDecoderModel obj's underlying member method code with example usage: obj.setup_cgs(cfg) without return types