code: def extract_and_split_text_from_manifest(
      input_name: str,
      output_name: str,
      field_name: str = "pred_text",
      len_in_words: int = 16,
      step_in_words: int = 8,
  ) -> None:
      """Extract text of the specified field in nemo manifest and split it into fragments (possibly with intersection).
      The result is saved to a text file with two columns: short_sent \t full_sent.
      This is useful if we want to process shorter sentences and then apply the results to the original long sentence.
      Args:
          input_name: input nemo manifest,
          output_name: output text file,
          field_name: name of json field from which we extract the sentence text,
          len_in_words: maximum number of words in a fragment,
          step_in_words: on how many words we move at each step.
      For example, if the len_in_words=16 and step_in_words=8 the fragments will be intersected by half.
      """
      short2full_sent = set()
      with open(input_name, "r", encoding="utf-8") as f:
          for line in f:
              record = json.loads(line.strip())
              sent = record[field_name]
              if "  " in sent:
                  raise ValueError("found multiple space in: " + sent)
              words = sent.split()
              for i in range(0, len(words), step_in_words):
                  short_sent = " ".join(words[i : i + len_in_words])
                  short2full_sent.add((short_sent, sent))
  
      with open(output_name, "w", encoding="utf-8") as out:
          for short_sent, full_sent in short2full_sent:
              out.write(short_sent + "\t" + full_sent + "\n")
  
imports: import json
  import math
  import random
  import re
  from collections import defaultdict, namedtuple
  from typing import Dict, List, Set, Tuple, Union
  import numpy
  from numba import jit
label_desc: Use image node_id 14 for calling a global function with example usage: extract_and_split_text_from_manifest(input_name, output_name, field_name, len_in_words, step_in_words) without return types