How to auto correct or give suggestion for a wrong entity

In fact, here’s an example for a required_slots method in a FormValidationAction in Rasa 2:

    async def required_slots(
        self,
        slots_mapped_in_domain: List[Text],
        dispatcher: "CollectingDispatcher",
        tracker: "Tracker",
        domain: "DomainDict") -> Optional[List[Text]]:

        if tracker.slots.get('feedback_00_authorisation') is False:
            return []
        else:
            return slots_mapped_in_domain

For your use case, you could:

  • create a confirm_entity boolean slot, set it to False by default, but
  • make it True when you’re using your similarity measure in validate_hospital_name
  • If confirm_entity is True, modify the slots required (in required_slots) in order to ask a confirmation question
  • Revert confirm_entity to False when you’re done validating, and carry on with the form