class_docstr: Action which implements and executes the form logic.
class_docstr_tok: ["Action","which","implements","and","executes","the","form","logic","."]
docstr: Finds mappings of type `from_entity` that uniquely set a slot.
  
  For example in the following form:
  some_form:
    departure_city:
      - type: from_entity
        entity: city
        role: from
      - type: from_entity
        entity: city
    arrival_city:
      - type: from_entity
        entity: city
        role: to
      - type: from_entity
        entity: city
  
  An entity `city` with a role `from` uniquely sets the slot `departure_city`
  and an entity `city` with a role `to` uniquely sets the slot `arrival_city`,
  so corresponding mappings are unique.
  But an entity `city` without a role can fill both `departure_city`
  and `arrival_city`, so corresponding mapping is not unique.
  
  Args:
      domain: The domain.
  
  Returns:
      A set of json dumps of unique mappings of type `from_entity`.
docstr_tok: ["Finds","mappings","of","type","`","from_entity","`","that","uniquely","set","a","slot",".","For","example","in","the","following","form",":","some_form",":","departure_city",":","-","type",":","from_entity","entity",":","city","role",":","from","-","type",":","from_entity","entity",":","city","arrival_city",":","-","type",":","from_entity","entity",":","city","role",":","to","-","type",":","from_entity","entity",":","city","An","entity","`","city","`","with","a","role","`","from","`","uniquely","sets","the","slot","`","departure_city","`","and","an","entity","`","city","`","with","a","role","`","to","`","uniquely","sets","the","slot","`","arrival_city","`",",","so","corresponding","mappings","are","unique",".","But","an","entity","`","city","`","without","a","role","can","fill","both","`","departure_city","`","and","`","arrival_city","`",",","so","corresponding","mapping","is","not","unique",".","Args",":","domain",":","The","domain",".","Returns",":","A","set","of","json","dumps","of","unique","mappings","of","type","`","from_entity","`","."]
code: def _create_unique_entity_mappings(self, domain: Domain) -> Set[Text]:
      """Finds mappings of type `from_entity` that uniquely set a slot.
  
      For example in the following form:
      some_form:
        departure_city:
          - type: from_entity
            entity: city
            role: from
          - type: from_entity
            entity: city
        arrival_city:
          - type: from_entity
            entity: city
            role: to
          - type: from_entity
            entity: city
  
      An entity `city` with a role `from` uniquely sets the slot `departure_city`
      and an entity `city` with a role `to` uniquely sets the slot `arrival_city`,
      so corresponding mappings are unique.
      But an entity `city` without a role can fill both `departure_city`
      and `arrival_city`, so corresponding mapping is not unique.
  
      Args:
          domain: The domain.
  
      Returns:
          A set of json dumps of unique mappings of type `from_entity`.
      """
      unique_entity_slot_mappings: Set[Text] = set()
      duplicate_entity_slot_mappings: Set[Text] = set()
      domain_slots = domain.as_dict().get(KEY_SLOTS, {})
      for slot in domain.required_slots_for_form(self.name()):
          for slot_mapping in domain_slots.get(slot, {}).get(
              SLOT_MAPPINGS, []
          ):
              if slot_mapping.get(MAPPING_TYPE) == str(
                  SlotMappingType.FROM_ENTITY
              ):
                  mapping_as_string = json.dumps(
                      slot_mapping, sort_keys=True
                  )
                  if mapping_as_string in unique_entity_slot_mappings:
                      unique_entity_slot_mappings.remove(
                          mapping_as_string
                      )
                      duplicate_entity_slot_mappings.add(
                          mapping_as_string
                      )
                  elif (
                      mapping_as_string
                      not in duplicate_entity_slot_mappings
                  ):
                      unique_entity_slot_mappings.add(mapping_as_string)
  
      return unique_entity_slot_mappings
  
imports: import copy
  from typing import Text, List, Optional, Union, Any, Dict, Set
  import itertools
  import logging
  import structlog
  import json
  from rasa.core.actions import action
  from rasa.core.actions.loops import LoopAction
  from rasa.core.channels import OutputChannel
  from rasa.shared.core.domain import Domain, KEY_SLOTS
  from rasa.shared.core.constants import SlotMappingType, SLOT_MAPPINGS, MAPPING_TYPE
  from rasa.core.actions.action import ActionExecutionRejection, RemoteAction
  from rasa.shared.core.constants import ACTION_EXTRACT_SLOTS, ACTION_LISTEN_NAME, REQUESTED_SLOT
  from rasa.shared.constants import UTTER_PREFIX
  from rasa.shared.core.events import Event, SlotSet, ActionExecuted, ActiveLoop, ActionExecutionRejected, Restarted
  from rasa.core.nlg import NaturalLanguageGenerator
  from rasa.shared.core.slot_mappings import SlotMapping
  from rasa.shared.core.slots import ListSlot
  from rasa.shared.core.trackers import DialogueStateTracker
  from rasa.utils.endpoints import EndpointConfig
label_desc: Use image node_id 6 for calling the FormAction obj's underlying member method code with example usage: obj._create_unique_entity_mappings(domain) and returns: unique_entity_slot_mappings