code: def get_info_from_partitions(
      input_midi: str, partitions: List[Tuple[float, float]]
  ) -> Tuple[
      List[List[str]],
      List[List[str]],
      List[List[float]],
      List[List[float]],
      List[List[int]],
  ]:
      midi_data = pretty_midi.PrettyMIDI(input_midi)
      current_partition = 0
      text = [[]]
      phonemes = [[]]
      pitches = [[]]
      note_durations = [[]]
      phn_durations = [[]]
      is_slur = [[]]
  
      notes = midi_data.instruments[0].notes
      note_index = 0
      word_index = 0
      # for lyric in midi_data.lyrics:
      while word_index < len(midi_data.lyrics):
          lyric = midi_data.lyrics[word_index]
          assert lyric.time > partitions[current_partition][0]
          if lyric.time > partitions[current_partition][1]:
              text.append([])
              phonemes.append([])
              pitches.append([])
              note_durations.append([])
              phn_durations.append([])
              is_slur.append([])
              current_partition += 1
              assert lyric.time > partitions[current_partition][0]
              assert lyric.time < partitions[current_partition][1]
  
          if lyric.text == "?" or lyric.text == "-":
              phonemes[-1].append(phonemes[-1][-1])
              is_slur[-1].append(1)
              pitches[-1].append(pitches[-1][-1])
              note_durations[-1].append(note_durations[-1][-1])
              phn_durations[-1].append(phn_durations[-1][-1])
          else:
              if "#" in lyric.text:
                  word, id = lyric.text.split("#")
                  if id == "1":
                      text[-1].append(word)
                      phn_list = split_pinyin(word)
                      phonemes[-1].extend(phn_list)
                      is_slur[-1].extend([0] * len(phn_list))
              # Note(yueqian): The English logic is not correct yet
              # elif check_en(lyric.text):
              #     text[-1].append(lyric.text)
              #     phn_list = [lyric.text]
              #     phonemes[-1].append(lyric.text)
              #     is_slur[-1].append(0)
              else:
                  text[-1].append(lyric.text)
                  phn_list = split_pinyin(lyric.text)
                  phonemes[-1].extend(phn_list)
                  is_slur[-1].extend([0] * len(phn_list))
              current_word_pitch = []
              current_word_duration = []
              # get all the notes from note_index to the end of the next lyric time
              if word_index == len(midi_data.lyrics) - 1:
                  while note_index < len(notes):
                      note = midi_data.instruments[0].notes[note_index]
                      current_word_pitch.append(note.pitch)
                      note_duration = note.end - note.start
                      current_word_duration.append(note_duration)
                      note_index += 1
              else:
                  while (
                      note_index < len(notes)
                      and notes[note_index].start
                      < midi_data.lyrics[word_index + 1].time
                  ):
                      note = midi_data.instruments[0].notes[note_index]
                      current_word_pitch.append(note.pitch)
                      note_duration = note.end - note.start
                      current_word_duration.append(note_duration)
                      note_index += 1
  
              # if the len(phn_list) = len(current_word_pitch),
              # then we can just assign the pitches to the phonemes
              if len(phn_list) == len(current_word_pitch):
                  pitches[-1].extend(current_word_pitch)
                  note_durations[-1].extend(current_word_duration)
                  phn_durations[-1].extend(current_word_duration)
              # if the len(phn_list) < len(current_word_pitch),
              # then we need to assign the rest of the pitches to the last phoneme
              elif len(phn_list) < len(current_word_pitch):
                  pitches[-1].extend(current_word_pitch)
                  note_durations[-1].extend(current_word_duration)
                  phn_durations[-1].extend(current_word_duration)
                  phonemes[-1].extend(
                      [phonemes[-1][-1]]
                      * (len(current_word_pitch) - len(phn_list))
                  )
                  is_slur[-1].extend(
                      [1] * (len(current_word_pitch) - len(phn_list))
                  )
              # if the len(phn_list) > len(current_word_pitch),
              # then we need to assign the rest of the phonemes to the last pitch
              else:
                  pitches[-1].extend(current_word_pitch)
                  note_durations[-1].extend(current_word_duration)
                  phn_durations[-1].extend(current_word_duration)
                  pitches[-1].extend(
                      [current_word_pitch[-1]]
                      * (len(phn_list) - len(current_word_pitch))
                  )
                  note_durations[-1].extend(
                      [current_word_duration[-1]]
                      * (len(phn_list) - len(current_word_pitch))
                  )
                  phn_durations[-1][-1] = current_word_duration[-1] / (
                      len(phn_list) - len(current_word_pitch) + 1
                  )
                  phn_durations[-1].extend(
                      [phn_durations[-1][-1]]
                      * (len(phn_list) - len(current_word_pitch))
                  )
          word_index += 1
  
      for i in range(len(phonemes)):
          if not (
              len(phonemes[i])
              == len(pitches[i])
              == len(note_durations[i])
              == len(is_slur[i])
              == len(phn_durations[i])
          ):
              # If the lengths are not equal, print the lengths for debugging
              print(f"Length mismatch in partition {i}:")
              print(f"  Phonemes: {len(phonemes[i])}, {phonemes}")
              print(f"  Pitches: {len(pitches[i])}, {pitches}")
              print(
                  f"  Note Durations: {len(note_durations[i])}",
                  note_durations,
              )
              print(
                  f"  Phoneme Durations: {len(phn_durations[i])}",
                  phn_durations,
              )
              print(f"  Is Slur: {len(is_slur[i])}", is_slur)
              raise ValueError("Length mismatch in partition.")
  
      return (
          text,
          phonemes,
          pitches,
          note_durations,
          phn_durations,
          is_slur,
      )
  
imports: import argparse
  import glob
  import logging
  import os
  import re
  import shutil
  import subprocess
  import wave
  from typing import List, TextIO, Tuple
  import miditoolkit
  import numpy
  from local.pinyin_dict import PINYIN_DICT
  from tqdm import tqdm
  from espnet2.fileio.score_scp import SingingScoreWriter
label_desc: Use image node_id 9 for calling a global function with example usage: get_info_from_partitions(input_midi, partitions) and returns: text,  phonemes,  pitches,  note_durations,  phn_durations,  is_slur