code: def create_csv(
      orig_tsv_file,
      csv_file,
      data_folder,
      accented_letters=False,
      language="en",
  ):
      """
      Creates the csv file given a list of wav files.
      Arguments
      ---------
      orig_tsv_file : str
          Path to the Common Voice tsv file (standard file).
      data_folder : str
          Path of the CommonVoice dataset.
      accented_letters : bool, optional
          Defines if accented letters will be kept as individual letters or
          transformed to the closest non-accented letters.
      Returns
      -------
      None
      """
  
      # Check if the given files exists
      if not os.path.isfile(orig_tsv_file):
          msg = "\t%s doesn't exist, verify your dataset!" % (
              orig_tsv_file
          )
          logger.info(msg)
          raise FileNotFoundError(msg)
  
      # We load and skip the header
      loaded_csv = open(orig_tsv_file, "r").readlines()[1:]
      nb_samples = len(loaded_csv)
  
      msg = "Preparing CSV files for %s samples ..." % (str(nb_samples))
      logger.info(msg)
  
      # Adding some Prints
      msg = "Creating csv lists in %s ..." % (csv_file)
      logger.info(msg)
  
      # Process and write lines
      total_duration = 0.0
  
      line_processor = functools.partial(
          process_line,
          data_folder=data_folder,
          language=language,
          accented_letters=accented_letters,
      )
  
      # Stream into a .tmp file, and rename it to the real path at the end.
      csv_file_tmp = csv_file + ".tmp"
  
      with open(csv_file_tmp, mode="w", encoding="utf-8") as csv_f:
          csv_writer = csv.writer(
              csv_f,
              delimiter=",",
              quotechar='"',
              quoting=csv.QUOTE_MINIMAL,
          )
  
          csv_writer.writerow(
              ["ID", "duration", "wav", "spk_id", "wrd"]
          )
  
          for row in parallel_map(line_processor, loaded_csv):
              if row is None:
                  continue
  
              total_duration += row.duration
              csv_writer.writerow(
                  [
                      row.snt_id,
                      str(row.duration),
                      row.mp3_path,
                      row.spk_id,
                      row.words,
                  ]
              )
  
      os.replace(csv_file_tmp, csv_file)
  
      # Final prints
      msg = "%s successfully created!" % (csv_file)
      logger.info(msg)
      msg = "Number of samples: %s " % (str(len(loaded_csv)))
      logger.info(msg)
      msg = "Total duration: %s Hours" % (
          str(round(total_duration / 3600, 2))
      )
      logger.info(msg)
  
file_path: speechbrain/recipes/CommonVoice/common_voice_prepare.py
imports: from dataclasses import dataclass
  import os
  import csv
  import re
  import logging
  import torchaudio
  import unicodedata
  import functools
  from speechbrain.utils.parallel import parallel_map
  from speechbrain.dataio.dataio import read_audio_info
label_desc: Use image node_id 4 for calling a global function with example usage: create_csv(orig_tsv_file, csv_file, data_folder, accented_letters, language) without return types