code: def gen_indexed_sentence_collection(
      InFile_PaperTitleAbs_bySentence, OutFileName, word2idx
  ):
      print(
          "loading file {0}...".format(
              os.path.basename(InFile_PaperTitleAbs_bySentence)
          )
      )
      with open(
          InFile_PaperTitleAbs_bySentence,
          "r",
          encoding="utf-8",
          newline="\r\n",
      ) as rd, open(
          OutFileName, "w", encoding="utf-8", newline="\r\n"
      ) as wt:
          _cnt = 0
          _t0 = time.time()
          while True:
              line = rd.readline()
              if not line:
                  break
              _cnt += 1
              if _cnt % 10000 == 0:
                  print(
                      "\rloading line: {0}, time elapses: {1:.1f}s".format(
                          _cnt, time.time() - _t0
                      ),
                      end=" ",
                  )
              words = line.strip("\r\n").split("\t")
              paperid, category, position, sentence, fieldOfStudy = (
                  words[0],
                  words[1],
                  int(words[2]),
                  words[3],
                  words[4],
              )
  
              if not sentence:
                  continue
              tokens = sentence.split(" ")
              word_idx = [add2dict(token, word2idx) for token in tokens]
              wt.write(list2string(word_idx, " ") + "\n")
  
imports: import codecs
  import pickle
  import time
  import os
  from datetime import datetime
  import random
  import numpy
  import math
  from multiprocessing import Process
  from utils.general import *
  from utils.data_helper import *
label_desc: Use image node_id 5 for calling a global function with example usage: gen_indexed_sentence_collection(InFile_PaperTitleAbs_bySentence, OutFileName, word2idx) without return types