code: def prepare_ami(
      data_folder,
      manual_annot_folder,
      save_folder,
      ref_rttm_dir,
      meta_data_dir,
      split_type="full_corpus_asr",
      skip_TNO=True,
      mic_type="Lapel",
      vad_type="oracle",
      max_subseg_dur=3.0,
      overlap=1.5,
  ):
      """
      Prepares reference RTTM and JSON files for the AMI dataset.
  
      Arguments
      ---------
      data_folder : str
          Path to the folder where the original amicorpus is stored.
      manual_annot_folder : str
          Directory where the manual annotations are stored.
      save_folder : str
          The save directory in results.
      ref_rttm_dir : str
          Directory to store reference RTTM files.
      meta_data_dir : str
          Directory to store the meta data (json) files.
      split_type : str
          Standard dataset split. See ami_splits.py for more information.
          Allowed split_type: "scenario_only", "full_corpus" or "full_corpus_asr"
      skip_TNO: bool
          Skips TNO meeting recordings if True.
      mic_type : str
          Type of microphone to be used.
      vad_type : str
          Type of VAD. Kept for future when VAD will be added.
      max_subseg_dur : float
          Duration in seconds of a subsegments to be prepared from larger segments.
      overlap : float
          Overlap duration in seconds between adjacent subsegments
  
      Example
      -------
      >>> from recipes.AMI.ami_prepare import prepare_ami
      >>> data_folder = '/network/datasets/ami/amicorpus/'
      >>> manual_annot_folder = '/home/mila/d/dawalatn/nauman/ami_public_manual/'
      >>> save_folder = 'results/save/'
      >>> split_type = 'full_corpus_asr'
      >>> mic_type = 'Lapel'
      >>> prepare_ami(data_folder, manual_annot_folder, save_folder, split_type, mic_type)
      """
  
      # Meta files
      meta_files = [
          os.path.join(
              meta_data_dir, "ami_train." + mic_type + ".subsegs.json"
          ),
          os.path.join(
              meta_data_dir, "ami_dev." + mic_type + ".subsegs.json"
          ),
          os.path.join(
              meta_data_dir, "ami_eval." + mic_type + ".subsegs.json"
          ),
      ]
  
      # Create configuration for easily skipping data_preparation stage
      conf = {
          "data_folder": data_folder,
          "save_folder": save_folder,
          "ref_rttm_dir": ref_rttm_dir,
          "meta_data_dir": meta_data_dir,
          "split_type": split_type,
          "skip_TNO": skip_TNO,
          "mic_type": mic_type,
          "vad": vad_type,
          "max_subseg_dur": max_subseg_dur,
          "overlap": overlap,
          "meta_files": meta_files,
      }
  
      if not os.path.exists(save_folder):
          os.makedirs(save_folder)
  
      # Setting output option files.
      opt_file = "opt_ami_prepare." + mic_type + ".pkl"
  
      # Check if this phase is already done (if so, skip it)
      if skip(save_folder, conf, meta_files, opt_file):
          logger.info(
              "Skipping data preparation, as it was completed in previous run."
          )
          return
  
      msg = "\tCreating meta-data file for the AMI Dataset.."
      logger.debug(msg)
  
      # Get the split
      train_set, dev_set, eval_set = get_AMI_split(split_type)
  
      # Prepare RTTM from XML(manual annot) and store are groundtruth
      # Create ref_RTTM directory
      if not os.path.exists(ref_rttm_dir):
          os.makedirs(ref_rttm_dir)
  
      # Create reference RTTM files
      splits = ["train", "dev", "eval"]
      for i in splits:
          rttm_file = ref_rttm_dir + "/fullref_ami_" + i + ".rttm"
          if i == "train":
              prepare_segs_for_RTTM(
                  train_set,
                  rttm_file,
                  data_folder,
                  manual_annot_folder,
                  i,
                  skip_TNO,
              )
          if i == "dev":
              prepare_segs_for_RTTM(
                  dev_set,
                  rttm_file,
                  data_folder,
                  manual_annot_folder,
                  i,
                  skip_TNO,
              )
          if i == "eval":
              prepare_segs_for_RTTM(
                  eval_set,
                  rttm_file,
                  data_folder,
                  manual_annot_folder,
                  i,
                  skip_TNO,
              )
  
      # Create meta_files for splits
      meta_data_dir = meta_data_dir
      if not os.path.exists(meta_data_dir):
          os.makedirs(meta_data_dir)
  
      for i in splits:
          rttm_file = ref_rttm_dir + "/fullref_ami_" + i + ".rttm"
          meta_filename_prefix = "ami_" + i
          prepare_metadata(
              rttm_file,
              meta_data_dir,
              data_folder,
              meta_filename_prefix,
              max_subseg_dur,
              overlap,
              mic_type,
          )
  
      save_opt_file = os.path.join(save_folder, opt_file)
      save_pkl(conf, save_opt_file)
  
file_path: speechbrain/recipes/AMI/ami_prepare.py
imports: import os
  import logging
  import xml.etree.ElementTree
  import glob
  import json
  from ami_splits import get_AMI_split
  from speechbrain.dataio.dataio import load_pkl, save_pkl
label_desc: Use image node_id 1 for calling a global function with example usage: prepare_ami(data_folder, manual_annot_folder, save_folder, ref_rttm_dir, meta_data_dir, split_type, skip_TNO, mic_type, vad_type, max_subseg_dur, overlap) without return types