code: def create_lexicon_and_oov_csv(all_texts, data_folder, save_folder):
      """
      Creates lexicon csv files useful for training and testing a
      grapheme-to-phoneme (G2P) model.
  
      Arguments
      ---------
      all_text : dict
          Dictionary containing text from the librispeech transcriptions
      data_folder : str
          Path to the folder where the original LibriSpeech dataset is stored.
      save_folder : str
          The directory where to store the csv files.
      Returns
      -------
      None
      """
      # If the lexicon file does not exist, download it
      lexicon_url = (
          "http://www.openslr.org/resources/11/librispeech-lexicon.txt"
      )
      lexicon_path = os.path.join(
          save_folder, "librispeech-lexicon.txt"
      )
  
      if not os.path.isfile(lexicon_path):
          logger.info(
              "Lexicon file not found. Downloading from %s."
              % lexicon_url
          )
          download_file(lexicon_url, lexicon_path)
  
      # Get list of all words in the transcripts
      transcript_words = Counter()
      for key in all_texts:
          transcript_words.update(all_texts[key].split("_"))
  
      # Get list of all words in the lexicon
      lexicon_words = []
      lexicon_pronunciations = []
      with open(lexicon_path, "r") as f:
          lines = f.readlines()
          for line in lines:
              word = line.split()[0]
              pronunciation = line.split()[1:]
              lexicon_words.append(word)
              lexicon_pronunciations.append(pronunciation)
  
      # Create lexicon.csv
      header = "ID,duration,char,phn\n"
      lexicon_csv_path = os.path.join(save_folder, "lexicon.csv")
      with open(lexicon_csv_path, "w") as f:
          f.write(header)
          for idx in range(len(lexicon_words)):
              separated_graphemes = [c for c in lexicon_words[idx]]
              duration = len(separated_graphemes)
              graphemes = " ".join(separated_graphemes)
              pronunciation_no_numbers = [
                  p.strip("0123456789")
                  for p in lexicon_pronunciations[idx]
              ]
              phonemes = " ".join(pronunciation_no_numbers)
              line = (
                  ",".join(
                      [str(idx), str(duration), graphemes, phonemes]
                  )
                  + "\n"
              )
              f.write(line)
      logger.info("Lexicon written to %s." % lexicon_csv_path)
  
      # Split lexicon.csv in train, validation, and test splits
      split_lexicon(save_folder, [98, 1, 1])
  
file_path: speechbrain/recipes/LibriSpeech/self-supervised-learning/wav2vec2/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 2 for calling a global function with example usage: create_lexicon_and_oov_csv(all_texts, data_folder, save_folder) without return types