I am trying to get phone number form the user but sometimes the Speach recognition returns charachters instead of numbers, for instance:
my contact is zero three one one seven two one one.
so to get these values i am using duckling with number dimenssion to detect this.
it detects all the numbers as entities,
so now what i need is to get all number values from the wntities and conactnate them to get full number and put it’s value in slot.
I have tried using
self.from_entity('number') but it only returns last value from the list.
is there any way to this, or any work around i should consider.
Welcome to Rasa Community!.
Have you approached the way of appending the numbers into a string
a.append(self.from_entity('number')) and then reverting back to the slot. While returning in your custom actions
Thank you @MuraliChandran14 for the help,
How should i iterate over the list of entities or how should i stop the iteration.
any thoughts on this ?
@usamanawazfrt, If you are using FormAction. You can write like this in your submit method. Adjust the condition on the
len(a) > 2 to intake how many numbers you required to fill the slot.
def submit(self, dispatcher: CollectingDispatcher, tracker: Tracker,
domain: Dict[Text, Any],) -> List[Dict]:
if(len(a) > 2):
dispatcher.utter_message(text="len is > 2")