class_docstr: Defines functionality for the available slot mappings.
class_docstr_tok: ["Defines","functionality","for","the","available","slot","mappings","."]
docstr: Checks whether slot should be filled by an entity in the input or not.
  
  Args:
      mapping: Slot mapping.
      tracker: The tracker.
  
  Returns:
      True, if slot should be filled, false otherwise.
docstr_tok: ["Checks","whether","slot","should","be","filled","by","an","entity","in","the","input","or","not",".","Args",":","mapping",":","Slot","mapping",".","tracker",":","The","tracker",".","Returns",":","True",",","if","slot","should","be","filled",",","false","otherwise","."]
code: def entity_is_desired(
      mapping: Dict[Text, Any], tracker: "DialogueStateTracker"
  ) -> bool:
      """Checks whether slot should be filled by an entity in the input or not.
  
      Args:
          mapping: Slot mapping.
          tracker: The tracker.
  
      Returns:
          True, if slot should be filled, false otherwise.
      """
      slot_fulfils_entity_mapping = False
      if tracker.latest_message:
          extracted_entities = tracker.latest_message.entities
      else:
          extracted_entities = []
  
      for entity in extracted_entities:
          if (
              mapping.get(ENTITY_ATTRIBUTE_TYPE)
              == entity[ENTITY_ATTRIBUTE_TYPE]
              and mapping.get(ENTITY_ATTRIBUTE_ROLE)
              == entity.get(ENTITY_ATTRIBUTE_ROLE)
              and mapping.get(ENTITY_ATTRIBUTE_GROUP)
              == entity.get(ENTITY_ATTRIBUTE_GROUP)
          ):
              matching_values = tracker.get_latest_entity_values(
                  mapping.get(ENTITY_ATTRIBUTE_TYPE),
                  mapping.get(ENTITY_ATTRIBUTE_ROLE),
                  mapping.get(ENTITY_ATTRIBUTE_GROUP),
              )
              slot_fulfils_entity_mapping = matching_values is not None
              break
  
      return slot_fulfils_entity_mapping
  
file_path: rasa/rasa/shared/core/slot_mappings.py
imports: from typing import Text, Dict, Any, List, Optional, TYPE_CHECKING
  from rasa.shared.constants import DOCS_URL_SLOTS, IGNORED_INTENTS
  import rasa.shared.utils.io
  from rasa.shared.nlu.constants import ENTITY_ATTRIBUTE_TYPE, ENTITY_ATTRIBUTE_ROLE, ENTITY_ATTRIBUTE_GROUP, INTENT, NOT_INTENT, INTENT_NAME_KEY
  from rasa.shared.core.constants import SLOT_MAPPINGS, MAPPING_TYPE, SlotMappingType, MAPPING_CONDITIONS
label_desc: Use image node_id 5 for calling the SlotMapping obj's underlying member method code with example usage: obj.entity_is_desired(mapping, tracker) and returns: slot_fulfils_entity_mapping