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")
      if os.path.exists(csv_file):
          logger.info(
              "Csv file %s already exists, not recreating." % csv_file
          )
          return
  
      # Preliminary prints
      msg = "Creating csv lists in  %s..." % (csv_file)
      logger.info(msg)
  
      csv_lines = [["ID", "duration", "wav", "spk_id", "wrd"]]
  
      snt_cnt = 0
      line_processor = functools.partial(
          process_line, text_dict=text_dict
      )
      # Processing all the wav files in wav_lst
      # FLAC metadata reading is already fast, so we set a high chunk size
      # to limit main thread CPU bottlenecks
      for row in parallel_map(line_processor, wav_lst, chunk_size=8192):
          csv_line = [
              row.snt_id,
              str(row.duration),
              row.file_path,
              row.spk_id,
              row.words,
          ]
  
          # Appending current file to the csv_lines list
          csv_lines.append(csv_line)
  
          snt_cnt = snt_cnt + 1
  
          # parallel_map guarantees element ordering so we're OK
          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/LibriSpeech/quantization/librispeech_prepare.py
imports: import os
  import csv
  import random
  from collections import Counter
  from dataclasses import dataclass
  import functools
  import logging
  from speechbrain.utils.data_utils import download_file, get_all_files
  from speechbrain.dataio.dataio import load_pkl, save_pkl, merge_csvs, read_audio_info
  from speechbrain.utils.parallel import parallel_map
label_desc: Use image node_id 5 for calling a global function with example usage: create_csv(save_folder, wav_lst, text_dict, split, select_n_sentences) without return types