code: def match_swbd1(text):
      """
      Clean transcripts in the Switchboard-1 training data.
      The transformations we do are:
       - remove laughter markings, e.g. [LAUGHTER-STORY] -> STORY
       - Remove partial-words, e.g. -[40]1K becomes -1K and -[AN]Y IY becomes -Y
      Also, curly braces, which appear to be used for "nonstandard"
      words or non-words, are removed, e.g. {WOLMANIZED} -> WOLMANIZED
  
      This is similar to Kaldi's swbd1_map_words.pl.
  
      Parameters
      ----------
      text : str
          Input text from the Switchboard-1 training data.
  
      Returns
      -------
       A string containing the cleaned sentence.
      """
      tokens = text.split()
      parsed_tokens = []
      for token in tokens:
          # e.g. [LAUGHTER-STORY] -> STORY; elem 1 and 3 relate to preserving trailing "-"
          m = re.match(
              r"(|-)^\[LAUGHTER-(.+)\](|-)$", token, flags=re.IGNORECASE
          )
          token = "".join(m.group(1, 2, 3)) if m else token
  
          # e.g. [IT'N/ISN'T] -> IT'N
          # Note: 1st part may include partial-word stuff, which we process further below,
          # e.g. [LEM[GUINI]-/LINGUINI]
          m = re.match(r"^\[(.+)/.+\](|-)$", token)
          token = "".join(m.group(1, 2)) if m else token
  
          # e.g. -[AN]Y -> -Y
          m = re.match(r"^(|-)\[[^][]+\](.+)$", token)
          token = "-" + m.group(2) if m else token
  
          # e.g. AB[SOLUTE]- -> AB-;
          m = re.match(r"^(.+)\[[^][]+\](|-)$", token)
          token = "".join(m.group(1, 2)) if m else token
  
          # e.g. EX[SPECIALLY]-/ESPECIALLY] -> EX
          m = re.match(r"([^][]+)\[.+\]$", token)
          token = m.group(1) if m else token
  
          # e.g. {YUPPIEDOM} -> YUPPIEDOM
          m = re.match(r"^\{(.+)\}$", token)
          token = m.group(1) if m else token
  
          # e.g. AMMU[N]IT- -> AMMU-IT
          m = re.match(r"(\w+)\[([^][])+\](\w+)", token)
          token = m.group(1) + "-" + m.group(3) if m else token
  
          # e.g. THEM_1 -> THEM
          token = re.sub(r"_\d+$", "", token)
          parsed_tokens.append(token)
      return " ".join(parsed_tokens)
  
imports: import re
  import csv
  import logging
  import os
  from collections import defaultdict
  from speechbrain.dataio.dataio import merge_csvs
  from speechbrain.utils.data_utils import download_file, get_all_files
label_desc: Use image node_id 8 for calling a global function with example usage: match_swbd1(text) and returns: str