code: def make_segment(
      file_id, labels, threshold=30, sil=["pau", "br", "sil"]
  ):
      segments = []
      segment = SegInfo()
      for i in range(len(labels)):
          label = labels[i]
          # fix errors in dataset
          # replace wrong phoneme with correct one
          if (
              "itako30" in file_id
              and label.label_id == "o"
              and i == len(labels) - 2
          ):
              label.label_id = "u"
          if label.label_id in sil:
              # replace wrong phoneme with correct one
              if (
                  "itako25" in file_id
                  and i < len(labels) - 1
                  and labels[i + 1].label_id == "N"
              ):
                  inter = (
                      float(label.start)
                      + (float(label.end) - float(label.start)) / 3
                  )
                  segment.add(label.start, inter, "j")
                  segment.add(inter, label.end, "a")
                  continue
              # remove rest
              if i < len(labels) - 1 and (
                  (
                      "itako09" in file_id
                      and labels[i + 4].label_id == "r"
                  )
                  or (
                      "itako48" in file_id
                      and labels[i + 4].label_id == "k"
                  )
              ):
                  labels[i + 1].start = label.start
                  continue
              if len(segment.segs) > 0:
                  segments.extend(segment.split(threshold=threshold))
                  segment = SegInfo()
              continue
          # add pause
          if "itako21" in file_id and (
              (label.label_id == "a" and labels[i - 1].label_id == "u")
              or (
                  label.label_id == "o"
                  and labels[i - 1].label_id in ["i", "e"]
                  and labels[i + 1].label_id == "o"
              )
              or (
                  label.label_id == "i"
                  and labels[i - 1].label_id == "o"
                  and labels[i - 2].label_id == "w"
              )
          ):
              segments.extend(segment.split(threshold=threshold))
              segment = SegInfo()
          # Add missing phoneme
          if (
              "itako27" in file_id
              and label.label_id == "i"
              and labels[i - 1].label_id == "s"
          ):
              inter = (
                  float(label.start)
                  + (float(label.end) - float(label.start)) / 2
              )
              segment.add(label.start, inter, "i")
              segment.add(inter, label.end, "i")
              continue
          segment.add(label.start, label.end, label.label_id)
  
      if len(segment.segs) > 0:
          segments.extend(segment.split(threshold=threshold))
  
      segments_w_id = {}
      id = 0
      for seg in segments:
          if len(seg) == 0:
              continue
          segments_w_id[pack_zero(file_id, id)] = seg
          id += 1
      return segments_w_id
  
file_path: espnet/egs2/itako/svs1/local/prep_segments.py
imports: import argparse
  import math
  import os
  import sys
label_desc: Use image node_id 3 for calling a global function with example usage: make_segment(file_id, labels, threshold, sil) and returns: segments_w_id