code: def compare(key, score, label):
      # follow pause in xml
      customed_dic = load_customed_dic(args.customed_dic)
      tokenizer = build_tokenizer(
          token_type="phn",
          bpemodel=None,
          delimiter=None,
          space_symbol="<space>",
          non_linguistic_symbols=None,
          g2p_type=args.g2p,
      )
      index = 0
      val = []
      for i in range(len(score)):
          syb = score[i][2]
          if syb == "—":
              if index > len(label):
                  raise ValueError(
                      "Lyrics are longer than phones in {}".format(key)
                  )
              if (
                  index == len(label)
                  or label[index][2] != pre_phn
                  or (
                      label[index][2] == pre_phn
                      and pre_phn == tokenizer.g2p(score[i + 1][2])[0]
                  )
              ):
                  dur = (val[-1][1] - val[-1][0]) / 2
                  val.append((val[-1][0] + dur, val[-1][1]))
                  val[-1] = (val[-1][0], val[-1][0] + dur, pre_phn)
                  score[i].append(pre_phn)
                  continue
          # Translate syllable into phones through g2p
          phns = tokenizer.g2p(syb)
          # In some case, translation can be different
          if syb in customed_dic:
              phns = customed_dic[syb]
          score[i].append("_".join(phns))
          pre_phn = phns[-1]
          for p in phns:
              if index >= len(label):
                  raise ValueError(
                      "Lyrics are longer than phones in {}".format(key)
                  )
              elif label[index][2] == p:
                  val.append(label[index])
                  index += 1
              else:
                  raise ValueError(
                      "Mismatch in syllable [{}]->{} and {}-th phones '{}' in {}.".format(
                          syb, phns, index, label[index][2], key
                      )
                  )
      val_rest = []
      if index != len(label):
          val_rest = label[index:]
      return val, val_rest, score
  
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 5 for calling a global function with example usage: compare(key, score, label) and returns: val,  val_rest,  score