Challenge: Making the bot identify worldwide names - API.AI - Simplified approach

Today most of the people are starting to build conversational bots.
During the conversation the bot should know the name of people he is catering to.
The challenge is in the learning of bots, as in many cases the pre-configured entities for names have learning of around 2000-3000 names from SSA
If a raw platform with the capabilities of REGEX is being used for development, this challenge is very easy to be resolved.
But for a GUI based platform like API.AI, where user cannot write a REGEX to match patterns.
It becomes tricky and cumbersome.

As there is no direct answer, you need handle it in a different way.

Let us say you want to valid the OTP and the bot asks user " May I know your name and phone number".

Possible permutations of a user response are many e.g.

  • XYZ 99999999999 ( where XYZ is name, and the latter part is the number)
  • 99999999 XYZ
  • My name is XYZ and my number is 999999999
  • Name XYZ number is 99999999999
  • And many more.


So how to resolve it? How will bot learn the names all over the world. It might take a long time for bot to recognize all names?

What I can tell is, how we resolved it in a simplified way, using API.AI wild cards, and auto expansion feature.

We broke the complex question into two.

1. May I know your name?


Once the user responds --> We capture the response in @sys.any entity in API.AI ( this will accept almost everything in response), so no issue of any names of any origin. This is called the wild card.

2. May I know your number?

Tip:

  • You can define custom entity  like phoneNumbersCustom 
  • Make it composite of @sys.phone-number and some samples of your own in case you need specific patterns. This will help you simulate REGEX indirectly.
  • Make the Auto expansion tick box ON, for the bot to have enriched ML (machine learning)
  • For better results, if user tries to divert the conversation and doesn't provide number, make it mandatory and define the prompts.
    • Tip: For answers like Ok, sure, maybe, add to your intent, else APIAI small talk will be invoked and user will be out of your OTP flow context.


Benefits of this approach:


  • User experience becomes simpler, and he is not confused with what format to answer with.
  • Your AI flow becomes organized.


This is a small but useful tip, I spent whole day to resolve it; if you read it, you might do in 30 mins.

Happy Learning !

Comments