code: def create_csv(
      save_folder,
      wav_lst,
      text_dict,
      split,
      select_n_sentences,
  ):
      """
      Create the dataset csv file given a list of wav files.
  
      Arguments
      ---------
      save_folder : str
          Location of the folder for storing the csv.
      wav_lst : list
          The list of wav files of a given data split.
      text_dict : list
          The dictionary containing the text of each sentence.
      split : str
          The name of the current data split.
      select_n_sentences : int, optional
          The number of sentences to select.
  
      Returns
      -------
      None
      """
      # Setting path for the csv file
      csv_file = os.path.join(save_folder, split + ".csv")
  
      # Preliminary prints
      msg = "Creating csv lists in  %s..." % (csv_file)
      logger.info(msg)
  
      csv_lines = [["ID", "duration", "wav", "spk_id", "wrd"]]
  
      snt_cnt = 0
      # Processing all the wav files in wav_lst
      for wav_file in wav_lst:
          snt_id = wav_file.split("/")[-1].replace(".wav", "")
          spk_id = snt_id.split("_")[-1]
          wrds = text_dict[snt_id]
  
          duration = torchaudio.info(wav_file).num_frames / SAMPLERATE
  
          csv_line = [
              snt_id,
              str(duration),
              wav_file,
              spk_id,
              str(" ".join(wrds.split())),
          ]
  
          #  Appending current file to the csv_lines list
          csv_lines.append(csv_line)
          snt_cnt = snt_cnt + 1
  
          if snt_cnt == select_n_sentences:
              break
  
      # Writing the csv_lines
      with open(csv_file, mode="w") as csv_f:
          csv_writer = csv.writer(
              csv_f,
              delimiter=",",
              quotechar='"',
              quoting=csv.QUOTE_MINIMAL,
          )
  
          for line in csv_lines:
              csv_writer.writerow(line)
  
      # Final print
      msg = "%s successfully created!" % (csv_file)
      logger.info(msg)
  
file_path: speechbrain/recipes/KsponSpeech/ASR/transformer/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 2 for calling a global function with example usage: create_csv(save_folder, wav_lst, text_dict, split, select_n_sentences) without return types