Entity not recognizing correctly - Getting Started with Rasa / Tutorials, Resources & Videos - Rasa Community Forum

Entity not recognizing correctly

post by surya1994 on Sep 27, 2019

Hi

I have a numeric data with tax id (numeric and length 9), routing number (numeric and length 9) and account number (numeric and length 5 to 15) but in some cases routing number is recognized as account number or tax id and account number as routing number or tax id and slots are getting set.

Can you please let me know how to fix this problem?

I am using forms in actions.py file because of this whenever I give some number it is setting any of the above slots by extracting entity from the input (even though that entity is not correct) without executing validation in forms due to which that slot gets skipped in forms as it is not none so can you please tell me how can I make it to validate slot before setting it with entity?

Also please let me know how can I take text free without checking it on NLU data as I have a name slot in my form.

Below is training data, config file, actions.py file attached.

data nlu:

intent:inform

config.yml:

language: en pipeline: supervised_embeddings

actions.py:

class UserLoginForm2(FormAction): """Example of a custom form action"""

def name(self): """Unique identifier of the form""" return "user_easypay2_form"

@staticmethod def required_slots(tracker: Tracker) -> List[Text]: """A list of required slots that the form has to fill""" return ["accholdername", "routingnumber", "accountno"]

def validate_slots(self, slot_dict: Dict, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict]: slot_values = self.extract_other_slots(dispatcher, tracker, domain) slot_to_fill = tracker.get_slot(REQUESTED_SLOT)

if slot_to_fill: slot_values.update(self.extract_requested_slot(dispatcher, tracker, domain)) for slot, value in slot_values.items(): if slot == 'accholdername': if(value.isalpha()): pass else: dispatcher.utter_message("Bank Account Holder's Name must be alphabatic") slot_values[slot] = None

elif slot == 'routingnumber': if (value.isnumeric() and len(value) == 9): pass else: dispatcher.utter_message("Routing Number must be 9 digits.") slot_values[slot] = None

elif slot == 'accountno': if (value.isnumeric() and len(value) >= 5 and len(value) <= 17): pass else: dispatcher.utter_message("Account Number must be at least 5 digits and max 17 digits") slot_values[slot] = None

return [SlotSet(slot, value) for slot, value in slot_values.items()]

NLU DATA:

Thanks in advance and expecting an early reply.