How to auto correct or give suggestion for a wrong entity

Hi @Sajjadmanal ,

You could do that as a validation action (example for Rasa 2):

from rasa_sdk import FormValidationAction

# You could define the possible values in the domain, or somewhere else
# possible_hospitals = ['united hospital', 'disunited clinic']

class ValidateHospitalName(FormValidationAction):
    def name(self) -> Text:
        return "validate_company_type"

    def find_likeliest_choice(self, candidate, possible_choices, threshold=0.7):
        # Write code to get some sort of similarity score between candidate
        # each element of possible_choices, take the maximum score
        # Perhaps use a minimum threshold as well

    def validate_hospital_name(
            self,
            slot_value: Any,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: DomainDict,
        ) -> Dict[Text, Any]:
            """Validate hospital_name."""

            possible_values = domain.slots['hospital_name']['values']

            slot_value = slot_value.lower()

            if slot_value in possible_values:
                return {'hospital_name': slot_value}

            likeliest = self.find_likeliest_choice(slot_value, possible_values)
            # You could fill in the slot from likeliest, or perhaps fill in
            # but add a check, maybe by implementing required_slots...

Hope that helps