code: def merge_repeats(path, idx_to_token_map):
      i1, i2 = 0, 0
      segments = []
      while i1 < len(path):
          while i2 < len(path) and path[i1] == path[i2]:
              i2 += 1
          segments.append(
              Segment(idx_to_token_map[path[i1]], i1, i2 - 1)
          )
          i1 = i2
      return segments
  
file_path: fairseq/examples/mms/data_prep/align_utils.py
imports: import re
  import os
  import torch
  import tempfile
  import math
  from dataclasses import dataclass
  from torchaudio.models import wav2vec2_model
label_desc: Use image node_id 3 for calling a global function with example usage: merge_repeats(path, idx_to_token_map) and returns: segments