code: def load_lexicon(args):
      """
      This function is to create a new dictionary and load it to training.
      The external dictionary is expected to be inside the training dataset dir with format of: SHORTHAND-externaldict.txt
      For example, vi_vlsp-externaldict.txt
      """
      shorthand = args["shorthand"]
      tokenize_dir = paths["TOKENIZE_DATA_DIR"]
      train_path = f"{tokenize_dir}/{shorthand}.train.gold.conllu"
      external_dict_path = (
          f"{tokenize_dir}/{shorthand}-externaldict.txt"
      )
      if not os.path.exists(external_dict_path):
          logger.info(
              "External dictionary not found! Checking training data..."
          )
          external_dict_path = None
      if not os.path.exists(train_path):
          logger.info(
              f"Training dataset does not exist, thus cannot create dictionary {shorthand}"
          )
          train_path = None
      if train_path is None and external_dict_path is None:
          raise FileNotFoundError(
              f"Cannot find training set / external dictionary at {train_path} and {external_dict_path}"
          )
  
      return create_lexicon(shorthand, train_path, external_dict_path)
  
imports: from collections import Counter
  from copy import copy
  import json
  import numpy
  import re
  import logging
  import os
  from torch.utils.data import DataLoader
  import stanza.utils.default_paths
  from stanza.models.common.utils import ud_scores, harmonic_mean
  from stanza.models.common.doc import Document
  from stanza.utils.conll import CoNLL
  from stanza.models.common.doc import *
  from stanza.models.tokenization.data import SortedDataset
label_desc: Use image node_id 3 for calling a global function with example usage: load_lexicon(args) and returns: create_lexicon