code: def read_wikihomograph_file(
      file: str,
  ) -> Tuple[List[str], List[List[int]], List[str], List[str]]:
      """
      Reads .tsv file from WikiHomograph dataset,
      e.g. https://github.com/google-research-datasets/WikipediaHomographData/blob/master/data/eval/live.tsv
  
      Args:
          file: path to .tsv file
      Returns:
          sentences: Text.
          start_end_indices: Start and end indices of the homograph in the sentence.
          heteronyms: Target heteronyms for each sentence
          word_ids: Word_ids corresponding to each heteronym, i.e. label.
      """
      excluded_sentences = 0
      sentences = []
      start_end_indices = []
      heteronyms = []
      word_ids = []
      with open(file, "r", encoding="utf-8") as f:
          tsv_file = csv.reader(f, delimiter="\t")
          for i, line in enumerate(tsv_file):
              if i == 0:
                  continue
              heteronym, wordid, sentence, start, end = line
              start, end = int(start), int(end)
              sentence, start, end = correct_wikihomograph_data(
                  sentence, start, end
              )
  
              heteronym_span = sentence[start:end]
              if heteronym_span.lower() != heteronym:
                  if sentence.lower().count(heteronym) == 1:
                      start = sentence.lower().index(heteronym)
                      end = start + len(heteronym)
                      heteronym_span = sentence[start:end].lower()
                      assert heteronym == heteronym_span.lower()
                  else:
                      excluded_sentences += 1
                      raise ValueError(
                          f"heteronym {heteronym} != heteronym_span {heteronym_span} in {sentence}"
                      )
  
              heteronyms.append(heteronym)
              start_end_indices.append([start, end])
              sentences.append(sentence)
              word_ids.append(wordid)
  
      return sentences, start_end_indices, heteronyms, word_ids
  
file_path: NeMo/scripts/dataset_processing/g2p/export_wikihomograph_data_to_manifest.py
imports: import csv
  import json
  from argparse import ArgumentParser
  from glob import glob
  from typing import List, Tuple
  from tqdm import tqdm
label_desc: Use image node_id 2 for calling a global function with example usage: read_wikihomograph_file(file) and returns: sentences,  start_end_indices,  heteronyms,  word_ids