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: Adds entities to the synonym lookup table.
  
  Lowercase is used as keys to make the lookup case-insensitive.
docstr_tok: ["Adds","entities","to","the","synonym","lookup","table",".","Lowercase","is","used","as","keys","to","make","the","lookup","case-insensitive","."]
code: def _add_entities_if_synonyms(
      self, entity: Text, synonym: Optional[Text]
  ) -> None:
      """Adds entities to the synonym lookup table.
  
      Lowercase is used as keys to make the lookup case-insensitive.
      """
      if synonym is not None:
          entity = str(entity)
          synonym = str(synonym)
          if entity != synonym:
              entity_lowercase = entity.lower()
              if (
                  entity_lowercase in self.synonyms
                  and self.synonyms[entity_lowercase] != synonym
              ):
                  rasa.shared.utils.io.raise_warning(
                      f"Found conflicting synonym definitions "
                      f"for {entity_lowercase!r}. Overwriting target "
                      f"{self.synonyms[entity_lowercase]!r} with "
                      f"{synonym!r}. "
                      f"Check your training data and remove "
                      f"conflicting synonym definitions to "
                      f"prevent this from happening.",
                      docs=DOCS_URL_TRAINING_DATA + "#synonyms",
                  )
  
              self.synonyms[entity_lowercase] = synonym
  
          # add a self-reference to handle entities extracted in alternate cases
          # i.e. for a synonym Austria,
          # entities extracted as AUSTRIA, austria, ausTRIA, etc
          # should also have the value of `Austria`
          synonym_lowercase = synonym.lower()
          if synonym_lowercase not in self.synonyms:
              self.synonyms[synonym_lowercase] = synonym
  
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 8 for calling the EntitySynonymMapper obj's underlying member method code with example usage: obj._add_entities_if_synonyms(entity, synonym) without return types