code: def make_acronym_map(save_folder, lexicon_file, acronym_map_file):
      """
      Create mappings that can be used to convert acronyms in the Switchboard corpus
      into acronyms using the Fisher corpus convention.
  
      Examples we want to convert:
      IBM to i._b._m.
      BBC to b._b._c.
      BBCs to b._b._c.s
  
      This is what Kaldi's format_acronyms_dict.py does.
  
      Parameters
      ----------
      save_folder : str
          Folder to store the acronym map on disk
      lexicon_file : str
          Path to the sw-ms98-dict.text file
      acronym_map_file : str
          File to store the acronym map in
  
      Returns
      -------
      Two dictionaries mapping from swbd acronyms to acronyms according to the Fisher corpus convention.
      The first dict contains all entries, the other has the letter I removed.
      """
  
      # Taken from https://github.com/kaldi-asr/kaldi/blob/master/egs/swbd/s5c/local/MSU_single_letter.txt
      msu_single_letter = [
          "A ey",
          "B b iy",
          "C s iy",
          "D d iy",
          "E iy",
          "F eh f",
          "G jh iy",
          "H ey ch",
          "I ay",
          "J jh ey",
          "K k ey",
          "L eh l",
          "M eh m",
          "N eh n",
          "O ow",
          "P p iy",
          "Q k y uw",
          "R aa r",
          "S eh s",
          "T t iy",
          "U y uw",
          "V v iy",
          "W d ah b ax l y uw",
          "X eh k s",
          "Y w ay",
          "Z z iy",
      ]
  
      fin_lex = (
          prepare_lexicon(
              lexicon_file, os.path.join(save_folder, "lexicon.txt")
          )
          + msu_single_letter
      )
      logger.info(
          f"Prepared Swbd1 + MSU single letter lexicon with {len(fin_lex)} entries"
      )
      fout_map = open(acronym_map_file, "w")
  
      # Initialise single letter dictionary
      dict_letter = {}
      for single_letter_lex in msu_single_letter:
          items = single_letter_lex.split()
          dict_letter[items[0]] = single_letter_lex[
              len(items[0]) + 1 :
          ].strip()
  
      for lex in fin_lex:
          items = lex.split()
          word = items[0]
          lexicon = lex[len(items[0]) + 1 :].strip()
          # find acronyms from words with only letters and '
          pre_match = re.match(
              r"^[A-Za-z]+$|^[A-Za-z]+\'s$|^[A-Za-z]+s$", word
          )
          if pre_match:
              # find if words in the form of xxx's is acronym
              if word[-2:] == "'s" and (
                  lexicon[-1] == "s" or lexicon[-1] == "z"
              ):
                  actual_word = word[:-2]
                  actual_lexicon = lexicon[:-2]
                  acronym_lexicon = ""
                  for w in actual_word:
                      acronym_lexicon = (
                          acronym_lexicon + dict_letter[w.upper()] + " "
                      )
                  if acronym_lexicon.strip() == actual_lexicon:
                      acronym_mapped = ""
                      acronym_mapped_back = ""
                      for w in actual_word[:-1]:
                          acronym_mapped = (
                              acronym_mapped + w.lower() + "._"
                          )
                          acronym_mapped_back = (
                              acronym_mapped_back + w.lower() + " "
                          )
                      acronym_mapped = (
                          acronym_mapped
                          + actual_word[-1].lower()
                          + ".'s"
                      )
                      acronym_mapped_back = (
                          acronym_mapped_back
                          + actual_word[-1].lower()
                          + "'s"
                      )
                      fout_map.write(
                          word
                          + "\t"
                          + acronym_mapped
                          + "\t"
                          + acronym_mapped_back
                          + "\n"
                      )
  
              # find if words in the form of xxxs is acronym
              elif word[-1] == "s" and (
                  lexicon[-1] == "s" or lexicon[-1] == "z"
              ):
                  actual_word = word[:-1]
                  actual_lexicon = lexicon[:-2]
                  acronym_lexicon = ""
                  for w in actual_word:
                      acronym_lexicon = (
                          acronym_lexicon + dict_letter[w.upper()] + " "
                      )
                  if acronym_lexicon.strip() == actual_lexicon:
                      acronym_mapped = ""
                      acronym_mapped_back = ""
                      for w in actual_word[:-1]:
                          acronym_mapped = (
                              acronym_mapped + w.lower() + "._"
                          )
                          acronym_mapped_back = (
                              acronym_mapped_back + w.lower() + " "
                          )
                      acronym_mapped = (
                          acronym_mapped
                          + actual_word[-1].lower()
                          + ".s"
                      )
                      acronym_mapped_back = (
                          acronym_mapped_back
                          + actual_word[-1].lower()
                          + "'s"
                      )
                      fout_map.write(
                          word
                          + "\t"
                          + acronym_mapped
                          + "\t"
                          + acronym_mapped_back
                          + "\n"
                      )
  
              # find if words in the form of xxx (not ended with 's or s) is acronym
              elif word.find("'") == -1 and word[-1] != "s":
                  acronym_lexicon = ""
                  for w in word:
                      acronym_lexicon = (
                          acronym_lexicon + dict_letter[w.upper()] + " "
                      )
                  if acronym_lexicon.strip() == lexicon:
                      acronym_mapped = ""
                      acronym_mapped_back = ""
                      for w in word[:-1]:
                          acronym_mapped = (
                              acronym_mapped + w.lower() + "._"
                          )
                          acronym_mapped_back = (
                              acronym_mapped_back + w.lower() + " "
                          )
                      acronym_mapped = (
                          acronym_mapped + word[-1].lower() + "."
                      )
                      acronym_mapped_back = (
                          acronym_mapped_back + word[-1].lower()
                      )
                      fout_map.write(
                          word
                          + "\t"
                          + acronym_mapped
                          + "\t"
                          + acronym_mapped_back
                          + "\n"
                      )
  
      fout_map.close()
  
      # Load acronym map for further processing
      fin_map = open(acronym_map_file, "r")
      dict_acronym = {}
      dict_acronym_noi = {}  # Mapping of acronyms without I, i
      for pair in fin_map:
          items = pair.split("\t")
          dict_acronym[items[0]] = items[1]
          dict_acronym_noi[items[0]] = items[1]
      fin_map.close()
      del dict_acronym_noi["I"]
      del dict_acronym_noi["i"]
  
      return dict_acronym, dict_acronym_noi
  
imports: import re
  import csv
  import logging
  import os
  from collections import defaultdict
  from speechbrain.dataio.dataio import merge_csvs
  from speechbrain.utils.data_utils import download_file, get_all_files
label_desc: Use image node_id 13 for calling a global function with example usage: make_acronym_map(save_folder, lexicon_file, acronym_map_file) and returns: dict_acronym,  dict_acronym_noi