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 disambiguate_manifest(
      self,
      manifest,
      output_manifest: str,
      grapheme_field: str = "text_graphemes",
      batch_size: int = 4,
      num_workers: int = 0,
      wordid_to_phonemes_file: Optional[str] = None,
  ):
      all_preds = self._disambiguate(
          manifest=manifest,
          batch_size=batch_size,
          num_workers=num_workers,
          grapheme_field=grapheme_field,
      )
  
      self.set_wordid_to_phonemes(wordid_to_phonemes_file)
  
      with open(manifest, "r", encoding="utf-8") as f_in, open(
          output_manifest, "w", encoding="utf-8"
      ) as f_preds:
          for idx, line in enumerate(f_in):
              line = json.loads(line)
              start_end = line["start_end"]
              if len(start_end) > 0 and isinstance(start_end[0], int):
                  start_end = [start_end]
  
              text_with_heteronym_replaced = self._process_sentence(
                  text=line[grapheme_field],
                  start_end=start_end,
                  predictions=all_preds[idx],
              )
  
              line["pred_text"] = text_with_heteronym_replaced
              line["pred_wordid"] = all_preds[idx]
              f_preds.write(json.dumps(line, ensure_ascii=False) + "\n")
  
      logging.info(f"Predictions save at {output_manifest}")
      return all_preds
  
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 14 for calling the HeteronymClassificationModel obj's underlying member method code with example usage: obj.disambiguate_manifest(manifest, output_manifest, grapheme_field, batch_size, num_workers, wordid_to_phonemes_file) and returns: all_preds