class_docstr: This is a classification model that selects the best heteronym option out of possible dictionary entries.
  Supports only heteronyms, no OOV.
code: def _process_sentence(
      self,
      text: str,
      start_end: List[List[int]],
      predictions: List[str],
  ):
      text_with_heteronym_replaced = ""
      last_idx = 0
      for heteronym_idx, cur_start_end in enumerate(start_end):
          cur_start, cur_end = cur_start_end
          cur_pred = predictions[heteronym_idx]
  
          if (
              self.wordid_to_phonemes is None
              or cur_pred not in self.wordid_to_phonemes
          ):
              cur_pred = f"[{cur_pred}]"
          else:
              cur_pred = self.wordid_to_phonemes[cur_pred]
              # to use mixed grapheme format as an input for a TTS model, we need to have vertical bars around phonemes
              cur_pred = "".join([f"|{p}|" for p in cur_pred])
  
          text_with_heteronym_replaced += (
              text[last_idx:cur_start] + cur_pred
          )
          last_idx = cur_end
      if last_idx < len(text):
          text_with_heteronym_replaced += text[last_idx:]
      return text_with_heteronym_replaced
  
imports: import json
  import os
  from typing import List, Optional
  import torch
  from hydra.utils import instantiate
  from omegaconf import DictConfig
  from pytorch_lightning import Trainer
  from nemo.collections.common.losses import CrossEntropyLoss
  from nemo.collections.nlp.metrics.classification_report import ClassificationReport
  from nemo.collections.nlp.modules.common import TokenClassifier
  from nemo.collections.nlp.parts.utils_funcs import tensor2list
  from nemo.collections.tts.g2p.data.heteronym_classification import HeteronymClassificationDataset
  from nemo.collections.tts.g2p.utils import get_heteronym_spans, get_wordid_to_phonemes, read_wordids
  from nemo.core.classes.common import PretrainedModelInfo
  from nemo.utils import logging
label_desc: Use image node_id 11 for calling the HeteronymClassificationModel obj's underlying member method code with example usage: obj._process_sentence(text, start_end, predictions) and returns: text_with_heteronym_replaced