code: def prepare_ksponspeech(
      data_folder,
      save_folder,
      tr_splits=[],
      dev_splits=[],
      te_splits=[],
      select_n_sentences=None,
      merge_lst=[],
      merge_name=None,
      skip_prep=False,
  ):
      """
      This class prepares the csv files for the KsponSpeech dataset.
  
      Arguments
      ---------
      data_folder : str
          Path to the folder where the original KsponSpeech dataset is stored.
      tr_splits : list
          List of train splits to prepare from ['train', 'dev', 'eval_clean',
          'eval_other'].
      dev_splits : list
          List of dev splits to prepare from ['dev'].
      te_splits : list
          List of test splits to prepare from ['eval_clean','eval_other'].
      save_folder : str
          The directory where to store the csv files.
      select_n_sentences : int
          Default : None
          If not None, only pick this many sentences.
      merge_lst : list
          List of KsponSpeech splits (e.g, eval_clean, eval_other) to
          merge in a singe csv file.
      merge_name: str
          Name of the merged csv file.
      skip_prep: bool
          If True, data preparation is skipped.
  
  
      Example
      -------
      >>> data_folder = 'datasets/KsponSpeech'
      >>> tr_splits = ['train']
      >>> dev_splits = ['dev']
      >>> te_splits = ['eval_clean']
      >>> save_folder = 'KsponSpeech_prepared'
      >>> prepare_ksponspeech(data_folder, save_folder, tr_splits, dev_splits, \
                              te_splits)
      """
  
      if skip_prep:
          return
      data_folder = data_folder
      splits = tr_splits + dev_splits + te_splits
      save_folder = save_folder
      select_n_sentences = select_n_sentences
      conf = {
          "select_n_sentences": select_n_sentences,
      }
  
      # Other variables
      # Saving folder
      if not os.path.exists(save_folder):
          os.makedirs(save_folder)
  
      save_opt = os.path.join(save_folder, OPT_FILE)
  
      # Check if this phase is already done (if so, skip it)
      if skip(splits, save_folder, conf):
          logger.info(
              "Skipping preparation, completed in previous run."
          )
          return
      else:
          logger.info("Data_preparation...")
  
      # Additional checks to make sure the data folder contains ksponspeech
      check_ksponspeech_folders(data_folder, splits)
  
      # parse trn file
      all_texts = {}
      for split_index in range(len(splits)):
          split = splits[split_index]
          dirlist = split2dirs(split)
          wav_lst = []
          for dir in dirlist:
              wav_lst += get_all_files(
                  os.path.join(data_folder, dir), match_and=[".wav"]
              )
  
          trnpath = os.path.join(data_folder, split + ".trn")
          text_dict = text_to_dict(trnpath)
          all_texts.update(text_dict)
  
          if select_n_sentences is not None:
              n_sentences = select_n_sentences[split_index]
          else:
              n_sentences = len(wav_lst)
  
          create_csv(
              save_folder,
              wav_lst,
              text_dict,
              split,
              n_sentences,
          )
  
      # Merging csv file if needed
      if merge_lst and merge_name is not None:
          merge_files = [
              split_kspon + ".csv" for split_kspon in merge_lst
          ]
          merge_csvs(
              data_folder=save_folder,
              csv_lst=merge_files,
              merged_csv=merge_name,
          )
  
      # saving options
      save_pkl(conf, save_opt)
  
file_path: speechbrain/recipes/KsponSpeech/ksponspeech_prepare.py
imports: import csv
  import logging
  import os
  import re
  import torchaudio
  from speechbrain.dataio.dataio import load_pkl, merge_csvs, save_pkl
  from speechbrain.utils.data_utils import get_all_files
label_desc: Use image node_id 1 for calling a global function with example usage: prepare_ksponspeech(data_folder, save_folder, tr_splits, dev_splits, te_splits, select_n_sentences, merge_lst, merge_name, skip_prep) without return types