code: def prepare_common_voice(
      data_folder,
      save_folder,
      train_tsv_file=None,
      dev_tsv_file=None,
      test_tsv_file=None,
      accented_letters=False,
      language="en",
      skip_prep=False,
  ):
      """
      Prepares the csv files for the Mozilla Common Voice dataset.
      Download: https://voice.mozilla.org/en/datasets
      Arguments
      ---------
      data_folder : str
          Path to the folder where the original Common Voice dataset is stored.
          This path should include the lang: /datasets/CommonVoice/<language>/
      save_folder : str
          The directory where to store the csv files.
      train_tsv_file : str, optional
          Path to the Train Common Voice .tsv file (cs)
      dev_tsv_file : str, optional
          Path to the Dev Common Voice .tsv file (cs)
      test_tsv_file : str, optional
          Path to the Test Common Voice .tsv file (cs)
      accented_letters : bool, optional
          Defines if accented letters will be kept as individual letters or
          transformed to the closest non-accented letters.
      language: str
          Specify the language for text normalization.
      skip_prep: bool
          If True, skip data preparation.
      Example
      -------
      >>> from recipes.CommonVoice.common_voice_prepare import prepare_common_voice
      >>> data_folder = '/datasets/CommonVoice/en'
      >>> save_folder = 'exp/CommonVoice_exp'
      >>> train_tsv_file = '/datasets/CommonVoice/en/train.tsv'
      >>> dev_tsv_file = '/datasets/CommonVoice/en/dev.tsv'
      >>> test_tsv_file = '/datasets/CommonVoice/en/test.tsv'
      >>> accented_letters = False
      >>> duration_threshold = 10
      >>> prepare_common_voice( \
                   data_folder, \
                   save_folder, \
                   train_tsv_file, \
                   dev_tsv_file, \
                   test_tsv_file, \
                   accented_letters, \
                   language="en" \
                   )
      """
  
      if skip_prep:
          return
  
      # If not specified point toward standard location w.r.t CommonVoice tree
      if train_tsv_file is None:
          train_tsv_file = data_folder + "/train.tsv"
      else:
          train_tsv_file = train_tsv_file
  
      if dev_tsv_file is None:
          dev_tsv_file = data_folder + "/dev.tsv"
      else:
          dev_tsv_file = dev_tsv_file
  
      if test_tsv_file is None:
          test_tsv_file = data_folder + "/test.tsv"
      else:
          test_tsv_file = test_tsv_file
  
      # Setting the save folder
      if not os.path.exists(save_folder):
          os.makedirs(save_folder)
  
      # Setting ouput files
      save_csv_train = save_folder + "/train.csv"
      save_csv_dev = save_folder + "/dev.csv"
      save_csv_test = save_folder + "/test.csv"
  
      # If csv already exists, we skip the data preparation
      if skip(save_csv_train, save_csv_dev, save_csv_test):
          msg = "%s already exists, skipping data preparation!" % (
              save_csv_train
          )
          logger.info(msg)
  
          msg = "%s already exists, skipping data preparation!" % (
              save_csv_dev
          )
          logger.info(msg)
  
          msg = "%s already exists, skipping data preparation!" % (
              save_csv_test
          )
          logger.info(msg)
  
          return
  
      # Additional checks to make sure the data folder contains Common Voice
      check_commonvoice_folders(data_folder)
      # Creating csv files for {train, dev, test} data
      file_pairs = zip(
          [train_tsv_file, dev_tsv_file, test_tsv_file],
          [save_csv_train, save_csv_dev, save_csv_test],
      )
      for tsv_file, save_csv in file_pairs:
          create_csv(
              tsv_file,
              save_csv,
              data_folder,
              accented_letters,
              language,
          )
  
file_path: speechbrain/recipes/CommonVoice/ASR/CTC/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 1 for calling a global function with example usage: prepare_common_voice(data_folder, save_folder, train_tsv_file, dev_tsv_file, test_tsv_file, accented_letters, language, skip_prep) without return types