code: def build_default_config(resources, lang, model_dir, load_list):
      default_config = {}
      for processor, model_specs in load_list:
          option = build_default_config_option(model_specs)
          if option is not None:
              # if an option is set for the model_specs, keep that option and ignore
              # the rest of the model spec
              default_config[option[0]] = option[1]
              continue
  
          model_paths = [
              os.path.join(
                  model_dir, lang, processor, model_spec.package + ".pt"
              )
              for model_spec in model_specs
          ]
          dependencies = [
              model_spec.dependencies for model_spec in model_specs
          ]
  
          # Special case for NER: load multiple models at once
          # The pattern will be:
          #   a list of ner_model_path
          #   a list of ner_dependencies
          #     where each item in ner_dependencies is a map
          #     the map may contain forward_charlm_path, backward_charlm_path, or any other deps
          # The user will be able to override the defaults using a semicolon separated string
          # TODO: at least use the same config pattern for all other models
          if processor == NER:
              default_config[f"{processor}_model_path"] = model_paths
              dependency_paths = []
              for dependency_block in dependencies:
                  if not dependency_block:
                      dependency_paths.append({})
                      continue
                  dependency_paths.append({})
                  for dependency in dependency_block:
                      dep_processor, dep_model = dependency
                      dependency_paths[-1][
                          f"{dep_processor}_path"
                      ] = os.path.join(
                          model_dir,
                          lang,
                          dep_processor,
                          dep_model + ".pt",
                      )
              default_config[
                  f"{processor}_dependencies"
              ] = dependency_paths
              continue
  
          if len(model_specs) > 1:
              raise IllegalPackageError(
                  "Specified multiple packages for {}, which currently only handles one package".format(
                      processor
                  )
              )
  
          default_config[f"{processor}_model_path"] = model_paths[0]
          if not dependencies[0]:
              continue
          for dependency in dependencies[0]:
              dep_processor, dep_model = dependency
              default_config[
                  f"{processor}_{dep_processor}_path"
              ] = os.path.join(
                  model_dir, lang, dep_processor, dep_model + ".pt"
              )
  
      return default_config
  
imports: import argparse
  import collections
  from enum import Enum
  import io
  import itertools
  import sys
  import logging
  import json
  import os
  from stanza.pipeline._constants import *
  from stanza.models.common.constant import langcode_to_lang
  from stanza.models.common.doc import Document
  from stanza.models.common.foundation_cache import FoundationCache
  from stanza.models.common.utils import default_device
  from stanza.pipeline.processor import Processor, ProcessorRequirementsException
  from stanza.pipeline.registry import NAME_TO_PROCESSOR_CLASS, PIPELINE_NAMES, PROCESSOR_VARIANTS
  from stanza.pipeline.langid_processor import LangIDProcessor
  from stanza.pipeline.tokenize_processor import TokenizeProcessor
  from stanza.pipeline.mwt_processor import MWTProcessor
  from stanza.pipeline.pos_processor import POSProcessor
  from stanza.pipeline.lemma_processor import LemmaProcessor
  from stanza.pipeline.constituency_processor import ConstituencyProcessor
  from stanza.pipeline.coref_processor import CorefProcessor
  from stanza.pipeline.depparse_processor import DepparseProcessor
  from stanza.pipeline.sentiment_processor import SentimentProcessor
  from stanza.pipeline.ner_processor import NERProcessor
  from stanza.resources.common import DEFAULT_MODEL_DIR, DEFAULT_RESOURCES_URL, DEFAULT_RESOURCES_VERSION, ModelSpecification, add_dependencies, add_mwt, download_models, download_resources_json, flatten_processor_list, load_resources_json, maintain_processor_list, process_pipeline_parameters, set_logging_level, sort_processors
  from stanza.resources.default_packages import PACKAGES
  from stanza.utils.helper_func import make_table
label_desc: Use image node_id 3 for calling a global function with example usage: build_default_config(resources, lang, model_dir, load_list) and returns: default_config