code: def build_crflstm_corpus(split, cfg):
      assert split in ["train", "dev", "test"]
      processor = NerProcessor()
      if split == "train":
          examples = processor.get_train_examples(
              os.path.join(utils.get_original_cwd(), cfg.data_dir)
          )
          word2id = {}
          label2id = {}
          id2label = {}
          for example in examples:
              textlist = example.text_a.split(" ")
              labellist = example.label
              for text in textlist:
                  if text not in word2id:
                      word2id[text] = len(word2id)
              for label in labellist:
                  if label not in label2id:
                      label2id[label] = len(label2id)
                      id2label[len(label2id) - 1] = label
          word2id["<unk>"] = len(word2id)
          word2id["<pad>"] = len(word2id)
          with open(
              os.path.join(
                  utils.get_original_cwd(),
                  cfg.data_dir,
                  cfg.model_vocab_path,
              ),
              "wb",
          ) as outp:
              pickle.dump(word2id, outp)
              pickle.dump(label2id, outp)
              pickle.dump(id2label, outp)
          return examples, word2id, label2id, id2label
  
      elif split == "dev":
          examples = processor.get_dev_examples(
              os.path.join(utils.get_original_cwd(), cfg.data_dir)
          )
          return examples
      else:
          examples = processor.get_test_examples(
              os.path.join(utils.get_original_cwd(), cfg.data_dir)
          )
          return examples
  
file_path: DeepKE/src/deepke/name_entity_re/standard/tools/preprocess.py
imports: from .dataset import *
  import argparse
  import csv
  import json
  import logging
  import os
  import random
  import sys
  import numpy
  from hydra import utils
  import pickle
label_desc: Use image node_id 2 for calling a global function with example usage: build_crflstm_corpus(split, cfg) and returns: examples,  word2id,  label2id,  id2label, examples, examples