I have two slots: receiver_account and receiver_amount used inside a form action and both are of type unfeaturized.
And I have a intent to transfer balance where it normally has the name and the amount to be transferred but not the account number.
##intent: balance_tansfer
- I need to send some money
- What do I need to do to send money?
- I need to send money
- Can you send money?
- How can I transfer 50000 to Anjana?
- How can I send 15000 to Rajitha Sujana?
- How can I transfer balance to Anil Jayasinghe?
- I need to send 20000 money
The form action has required_slots : receiver_name, receiver_amount, reciever_account and receiver_branch.
So when the form asks the user to enter the bank_account, it is extracted as receiver_amount and the initial amount gets replaced.
Example scenario: User asks : Please transfer 20000 to John
Here, amount and name is extracted. So the form actions for account and branch.
Bot : Enter the account number User : 123456789
The above value (123456789) is recognized as amount and the initial value of 20000 gets replaced. However, there is a constraint that account number is of 10 digits while amount is <= 7 digits.
Here is the slot_mappings function in actions.py for the form:
def slot_mappings(self):
# type: () -> Dict[Text: Union[Dict, List[Dict]]]
"""A dictionary to map required slots to
- an extracted entity
- intent: value pairs
- a whole message
or a list of them, where a first match will be picked"""
#print('PIN number is '+self.from_text())
return {
"receiver_account": [self.from_text()],
"receiver_name": [
self.from_entity(entity="receiver_name", intent="transfer_balance"),
self.from_text()
],
"receiver_amount": [
self.from_entity(entity="receiver_amount", intent="transfer_balance"),
self.from_text()
],
"receiver_branch": [self.from_text()],
}
Any workaround to handle this scenario ?