code: def make_segment(
      xml_writer,
      file_id,
      labels,
      threshold=30,
      sil=["pau", "br", "sil"],
  ):
      xml_reader = SingingScoreReader(
          os.path.join(args.scp, "score.scp")
      )
      segments = []
      segment = SegInfo()
      for i in range(len(labels)):
          # remove unlabeled part
          if "08" in file_id and i < 135:
              continue
          label = labels[i]
          if label.label_id in sil:
              if len(segment.segs) > 0:
                  segments.extend(segment.split(threshold=threshold))
                  segment = SegInfo()
              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:
          while len(seg) > 0:
              key = pack_zero(file_id, id)
              score = xml_reader[key]
              val, seg, notes = compare(key, score["note"], seg)
              segments_w_id[key] = val
              score["note"] = notes
              score["item_list"].append("phn")
              xml_writer[key] = score
              id += 1
      return segments_w_id
  
file_path: espnet/egs2/kiritan/svs1/local/prep_segments.py
imports: import argparse
  import math
  import os
  import sys
  from espnet2.fileio.score_scp import SingingScoreReader, SingingScoreWriter
  from espnet2.text.build_tokenizer import build_tokenizer
label_desc: Use image node_id 3 for calling a global function with example usage: make_segment(xml_writer, file_id, labels, threshold, sil) and returns: segments_w_id