code: def make_splits(
      sph_file,
      stm_file,
      utt_save_folder,
      avoid_if_shorter_than,
  ):
      """
      This function splits the .sph Ted-talk recording into utterences based on the .stm annotation.
  
      Arguments
      ---------
      sph_file : str
          Path to the sph file containing Ted-talk recording.
      stm_file : str
          Path to the stm file containing Ted-talk annotation.
      utt_save_folder: str
          The folder stores the clipped individual utterences.
      avoid_if_shorter_than: int
          Any utterance shorter than this will be discarded.
      """
      # the annotation for JillSobuleMANHATTANINJANUARY_2006.sph is not useful
      if "JillSobuleMANHATTANINJANUARY_2006" in sph_file:
          logger.info(
              "JillSobuleMANHATTANINJANUARY_2006.sph is skipped"
          )
          return
  
      # load the annotation of the entire speech recording
      annotation_file = open(stm_file, "r")
      annotations = annotation_file.readlines()
  
      # load the original speech recording
      original_speech, sample_rate = torchaudio.load(sph_file)
  
      entry = []
  
      # process the annotation utterence by utterance
      for i, line in enumerate(annotations):
          line = line.strip("\n")
          line = line.split(" ")
          # parse the annotation
          talk_id = line[0]
          spk_id = line[2]
  
          # start and end point of the utterences in the recording
          start = float(line[3])
          end = float(line[4])
          duration = -start + end
          # we skip short utterences in case of CNN padding issues
          if duration < avoid_if_shorter_than:
              continue
  
          # transcriptions
          wrd_list = line[6:]
          if wrd_list[-1] == "":
              wrd_list = wrd_list[:-1]
          transcript = " ".join(wrd_list)
          if not transcript[-1].isalpha():
              transcript = transcript[:-1]
          transcript = transcript.replace(" 've", "'ve")
          transcript = transcript.replace(" 't", "'t")
          transcript = transcript.replace(" 'll", "'ll")
          transcript = transcript.replace(" 'd", "'d")
          transcript = transcript.replace(" 'm", "'m")
          transcript = transcript.replace(" 're", "'re")
          transcript = transcript.replace(" 's", "'s")
          # skip invalid transcriptions
          if (
              len(wrd_list) <= 1
              or transcript == "ignore_time_segment_in_scoring"
          ):
              continue
  
          # clip and save the current utterance
          clipped_save_path = os.path.join(
              utt_save_folder, talk_id + "-" + str(i) + ".wav"
          )
  
          # we avoid duplicated clip and save
          if not os.path.exists(clipped_save_path):
              start = float(line[3]) * sample_rate
              end = float(line[4]) * sample_rate
              curr_utt = original_speech[:, int(start) : int(end)]
              torchaudio.save(clipped_save_path, curr_utt, sample_rate)
          # append to the csv entry list
          csv_line = [
              f"{talk_id}-{str(i)}",
              str(duration),
              clipped_save_path,
              spk_id,
              transcript,
          ]
          entry.append(csv_line)
  
      return entry
  
file_path: speechbrain/recipes/Tedlium2/Tokenizer/tedlium2_prepare.py
imports: import os
  import csv
  import logging
  import torchaudio
  import functools
  from speechbrain.utils.parallel import parallel_map
label_desc: Use image node_id 1 for calling a global function with example usage: make_splits(sph_file, stm_file, utt_save_folder, avoid_if_shorter_than) and returns: entry