Rasa - Train contact number

Hi Team,

How do we train Rasa bot for storing contact numbers?

please point me to good examples

Regards, Bharath

hey @bharathjc, You could extract the phone without training bot by a simple custom action function. Create unfeaturized Slots Slots to store or store it directly into the database. To Extract Phone Number from User’s message you could this regex method

text = tracker.latest_message[‘text’]

phone = re.findall(re.compile(r’(?:(?:+?([1-9]|[0-9][0-9]|[0-9][0-9][0-9])\s*(?:[.-]\s*)?)?(?:(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*)|([0-9][1-9]|[0-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{7})(?:\s*(?:#|x.?|ext.?|extension)\s*(\d+))?’), text)

and don’t forget to import re in your action.py, Hope this could help you :slight_smile: