code: def clean_label(
      _str: str, num_to_words: bool = True, langid="en"
  ) -> str:
      """
      Remove unauthorized characters in a string, lower it and remove unneeded spaces
      """
      replace_with_space = [
          char for char in '/?*",.:=?_{|}~¨«·»¡¿„…‧‹›≪≫!:;ː→'
      ]
      replace_with_blank = [char for char in '`¨´‘’“”`ʻ‘’“"‘”']
      replace_with_apos = [char for char in "‘’ʻ‘’‘"]
      _str = _str.strip()
      _str = _str.lower()
      for i in replace_with_blank:
          _str = _str.replace(i, "")
      for i in replace_with_space:
          _str = _str.replace(i, " ")
      for i in replace_with_apos:
          _str = _str.replace(i, "'")
      if num_to_words:
          if langid == "en":
              _str = convert_num_to_words(_str, langid="en")
          else:
              logging.warning(
                  "Currently support basic num_to_words in English only. Please use Text Normalization to convert other languages! Skipping!",
                  mode=LogMode.ONCE,
              )
  
      ret = " ".join(_str.split())
      return ret
  
file_path: NeMo/nemo/collections/asr/parts/utils/eval_utils.py
imports: import json
  from typing import Optional, Tuple, Union
  from torchmetrics.text import SacreBLEUScore
  from torchmetrics.text.rouge import ROUGEScore
  from nemo.collections.asr.metrics.wer import word_error_rate_detail
  from nemo.utils import logging
  from nemo.utils.nemo_logging import LogMode
label_desc: Use image node_id 2 for calling a global function with example usage: clean_label(_str, num_to_words, langid) and returns: ret