class_docstr: Maps entities to their synonyms if they appear in the training data.
class_docstr_tok: ["Maps","entities","to","their","synonyms","if","they","appear","in","the","training","data","."]
docstr: Loads trained component (see parent class for full docstring).
docstr_tok: ["Loads","trained","component","(","see","parent","class","for","full","docstring",")","."]
code: def load(
      cls,
      config: Dict[Text, Any],
      model_storage: ModelStorage,
      resource: Resource,
      execution_context: ExecutionContext,
      **kwargs: Any,
  ) -> EntitySynonymMapper:
      """Loads trained component (see parent class for full docstring)."""
      synonyms = None
      try:
          with model_storage.read_from(resource) as storage:
              entity_synonyms_file = (
                  storage / EntitySynonymMapper.SYNONYM_FILENAME
              )
  
              if os.path.isfile(entity_synonyms_file):
                  synonyms = rasa.shared.utils.io.read_json_file(
                      entity_synonyms_file
                  )
              else:
                  synonyms = None
                  rasa.shared.utils.io.raise_warning(
                      f"Failed to load synonyms file from '{entity_synonyms_file}'.",
                      docs=DOCS_URL_TRAINING_DATA + "#synonyms",
                  )
      except ValueError:
          logger.debug(
              f"Failed to load {cls.__class__.__name__} from model storage. Resource "
              f"'{resource.name}' doesn't exist."
          )
  
      return cls(config, model_storage, resource, synonyms)
  
imports: from __future__ import annotations
  import os
  from typing import Any, Dict, List, Optional, Text
  import logging
  from rasa.engine.graph import GraphComponent, ExecutionContext
  from rasa.engine.recipes.default_recipe import DefaultV1Recipe
  from rasa.shared.constants import DOCS_URL_TRAINING_DATA
  from rasa.shared.nlu.constants import ENTITIES, TEXT
  from rasa.shared.nlu.training_data.training_data import TrainingData
  from rasa.shared.nlu.training_data.message import Message
  from rasa.nlu.utils import write_json_to_file
  from rasa.nlu.extractors.extractor import EntityExtractorMixin
  import rasa.utils.io
  import rasa.shared.utils.io
  from rasa.engine.storage.resource import Resource
  from rasa.engine.storage.storage import ModelStorage
label_desc: Use image node_id 6 for calling the EntitySynonymMapper obj's underlying member method code with example usage: obj.load(cls, config, model_storage, resource, execution_context) and returns: cls