code: def prepare_switchboard(
      data_folder,
      save_folder,
      splits=None,
      split_ratio=None,
      merge_lst=None,
      merge_name=None,
      skip_prep=False,
      add_fisher_corpus=False,
      max_utt=300,
  ):
      """
      Main function for Switchboard data preparation.
  
      Parameters
      ----------
      data_folder : str
          Path to the folder where the Switchboard (and Fisher) datasets are stored.
          Note that the Fisher data must be stored (or at least symlinked)
          to the same location.
      save_folder : str
          The directory to store the outputs generated by this script.
      splits : list
          A list of data splits you want to obtain from the Switchboard dataset.
          This would be usually ["train", "dev"] since the "test" set is generated
          separately using the Hub5/eval2000 portion of the Switchboard corpus.
          The default split is into a ["train", "dev"] portion based on
          the split_ratio argument.
      split_ratio : list
          List containing the portions you want to allocate to
          each of your data splits e.g. [90, 10]. The default is [90, 10].
      merge_lst : list
          This allows you to merge some (or all) of the data splits you specified
          (e.g. ["train", "dev"]) into a single file. The default is [], i.e. no merging.
      merge_name : str
          Name of the merged csv file.
      skip_prep : bool
          If True, data preparation is skipped.
      add_fisher_corpus : bool
          If True, a separate csv file called "train_lm.csv" will be created containing
          the Switchboard training data and the Fisher corpus transcripts.
          The "train_lm.csv" file can be used instead of the regular "train.csv" file
          for LM and Tokenizer training.
          Note that this requires the Fisher corpus (part 1 and part 2)
          to be downloaded in your data_folder location.
      max_utt : int
          Remove excess utterances once they appear  more than a specified
          number of times with the same transcription, in a data set.
          This is useful for removing utterances like "uh-huh" from training.
  
      Example
      -------
      >>> data_folder = "/nfs/data/ldc"
      >>> save_folder = "swbd_data"
      >>> splits = ["train", "dev"]
      >>> split_ratio = [90, 10]
      >>> prepare_switchboard(data_folder, save_folder, splits, split_ratio, add_fisher_corpus=True)
      """
      if merge_lst is None:
          merge_lst = []
      if split_ratio is None:
          split_ratio = [90, 10]
      if splits is None:
          splits = ["train", "dev"]
      if skip_prep:
          logger.info("Data preparation skipped manually via hparams")
          return
  
      filenames = []
      for split in splits:
          filenames.append(
              os.path.join(save_folder, str(split + ".csv"))
          )
      if add_fisher_corpus:
          filenames.append(os.path.join(save_folder, "train_lm.csv"))
      filenames.append(os.path.join(save_folder, "test.csv"))
  
      if skip(*filenames):
          logger.info(
              "Preparation completed in previous run, skipping."
          )
          return
  
      swbd_train_lines = swbd1_data_prep(
          data_folder,
          save_folder,
          splits,
          split_ratio,
          add_fisher_corpus=add_fisher_corpus,
          max_utt=max_utt,
      )
  
      # Merging csv file if needed
      maybe_merge_files(merge_name, merge_lst)
  
      # Prepare eval2000 testset
      eval2000_data_prep(data_folder, save_folder)
  
      if add_fisher_corpus:
          fisher_lines = fisher_data_prep(data_folder, save_folder)
          # fisher_lines already contains a header, so we don't need to add one here
          combined_lines = fisher_lines + swbd_train_lines
  
          csv_file = os.path.join(save_folder, "train_lm.csv")
          # We set max_utt to a large number, so all utterances will be included in train_lm.csv
          # Note that the Kaldi recipe also doesn't care about a maximum utterance number in the
          # LM training corpus.
          write_csv(
              csv_file, combined_lines, utt_id_idx=1, max_utt=999999999
          )
  
      logger.info("Switchboard data preparation finished.")
  
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 1 for calling a global function with example usage: prepare_switchboard(data_folder, save_folder, splits, split_ratio, merge_lst, merge_name, skip_prep, add_fisher_corpus, max_utt) without return types