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
- 123456789
- 12345
- 1234512345
- 98765432
- 7865432
- 6576987
- 543298098
- 1200
- 1400
- 52
- 545
- 679
- 5200
- 545
- 787
- 1210.00
- 400.00
- 5200
- 1234.00
- 12345.00
- 8975.97
- 12345.66
- 123456.56
- 123123123
- 231231236
- 312312317
- 912312387
- 748619988
- 559713389
- 373916580
- 274950677
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:
- my account number is 123456 and my routing number is 123123123
- account no is 12349 and routing no 104000029
Thanks in advance and expecting an early reply.