code: def generate_vocab(
      data_path, text_vocab_path, label_vocab_path, min_freq
  ):
      text_vocab = {}
      label_vocab = {}
      file_list = ["train.txt", "dev.txt", "test.txt"]
      for f in file_list:
          file_name = data_path + f
          with open(file_name, "r") as f:
              for line in f.readlines():
                  text = line.strip().split("\t")[1]
                  labels = line.strip().split("\t")[0]
                  for w in text.split(" "):
                      if w in text_vocab:
                          text_vocab[w] += 1
                      else:
                          text_vocab[w] = 1
                  for t in labels.split(" "):
                      if t in label_vocab:
                          label_vocab[t] += 1
                      else:
                          label_vocab[t] = 1
      text_vocab_file = open(text_vocab_path, "w")
      label_vocab_file = open(label_vocab_path, "w")
      text_vocab_file.write("<pad>" + "\t" + "0" + "\n")
      text_vocab_file.write("<s>" + "\t" + "1" + "\n")
      text_vocab_file.write("</s>" + "\t" + "2" + "\n")
      text_vocab_file.write("<unk>" + "\t" + "3" + "\n")
      text_vocab_file.write("<sos>" + "\t" + "4" + "\n")
      text_vocab_file.write("<eos>" + "\t" + "5" + "\n")
      text_vocab = sorted(
          text_vocab.items(), key=lambda x: x[1], reverse=True
      )
      label_vocab = sorted(
          label_vocab.items(), key=lambda x: x[1], reverse=True
      )
      idx = 6
      for word, count in text_vocab:
          if count >= min_freq:
              text_vocab_file.write(word + "\t" + str(idx) + "\n")
              idx += 1
      idx = 0
      for label, count in label_vocab:
          label_vocab_file.write(label + "\t" + str(idx) + "\n")
          idx += 1
      logging.info("finish generate vocab!")
  
label_desc: Use image node_id 1 for calling a global function with example usage: generate_vocab(data_path, text_vocab_path, label_vocab_path, min_freq) without return types