code: def load_resources_from_dir(resources_dir, required_resources=None):
      with (resources_dir / "metadata.json").open(encoding="utf8") as f:
          metadata = json.load(f)
      metadata = _update_metadata(metadata, required_resources)
      gazetteer_names = metadata["gazetteers"]
      clusters_names = metadata["word_clusters"]
      stop_words_filename = metadata["stop_words"]
      stems_filename = metadata["stems"]
      noise_filename = metadata["noise"]
  
      gazetteers = _get_gazetteers(
          resources_dir / "gazetteers", gazetteer_names
      )
      word_clusters = _get_word_clusters(
          resources_dir / "word_clusters", clusters_names
      )
  
      stems = None
      stop_words = None
      noise = None
  
      if stems_filename is not None:
          stems = _get_stems(resources_dir / "stemming", stems_filename)
      if stop_words_filename is not None:
          stop_words = _get_stop_words(
              resources_dir, stop_words_filename
          )
      if noise_filename is not None:
          noise = _get_noise(resources_dir, noise_filename)
  
      return {
          METADATA: metadata,
          WORD_CLUSTERS: word_clusters,
          GAZETTEERS: gazetteers,
          STOP_WORDS: stop_words,
          NOISE: noise,
          STEMS: stems,
      }
  
imports: from __future__ import unicode_literals
  import json
  from collections import defaultdict
  from copy import deepcopy
  from pathlib import Path
  from future.utils import iteritems
  from snips_nlu.common.utils import get_package_path, is_package, json_string
  from snips_nlu.constants import CUSTOM_ENTITY_PARSER_USAGE, DATA_PATH, GAZETTEERS, NOISE, STEMS, STOP_WORDS, WORD_CLUSTERS, METADATA
  from snips_nlu.entity_parser.custom_entity_parser import CustomEntityParserUsage
label_desc: Use image node_id 2 for calling a global function with example usage: load_resources_from_dir(resources_dir, required_resources) and returns: dict