A bot is software that can respond back to user inputs, relying upon the input keywords. It can use natural language processing or some regular expression to process the statement.
There are a couple of tasks that are mostly repetitive. In a way, it does not involve any intelligence. At the same time, such tasks need human intervention. For instance in a bank, account holders usually query their account balance or want to know the status of their check. Similarly, a city administration team would be interested to know what areas have been flooded due to heavy rains so emergency services can kick in.
All such scenarios are only possible when there is some artificial intelligence in a software system that can prompt relevant business units when an event occurs. No human intervention required.
Different products in the chat space include:
- Facebook messenger chat
- Kik messenger chat
- Apple iMessage
- Slack bot
Different products in the AI space
- Facebook Wit AI
- Google McParsey
- Microsoft LUIS
- IBM Watson
Typical Dialogue Structure of a Bot
So what do you say to a bot? You would like to say something what you need from it. So there is definitely an intent. An Intent is the core concept in building the conversation. So the first thing that we can do with the incoming message from the user is to understand its Intent. This means mapping a phrase to a specific action that we can really provide. This means that a sample query string that can be returned back.
Along with the Intent, it’s necessary to extract the parameters or keywords of actions from the phrase. Parameters, also called entities, often belong to a particular type of pre-defined user meant keywords.
A Session usually represents one conversation from beginning to end. It may include one statement or multiple statements.
We can think about context as a conversational state that stays through out the whole session and use it as short term memory.
Natural Language Processing
Natural Language Processing (NLP) is the mecahnism wherein a software module attempts to understand what a sentence acually means. In order to do NLP, the software module must cover:
- Sentence splitter.
- Parts of speech tagging.
- Named entity tagging.
- Final extraction.
In order to build a chat bot, it’s better to use a chat bot that is more popular. Here is a globe level popularity of chat or messengers.
Because the Facebook messenger platform appears to be the most popular, I am going to explain the steps to build a bot on that.
Step 1: If the business entity does not have a Facebook, create a Facebook page named for it. Briefly describe your business on that page
Step 2: Go to https://developer.facebook.com and setup messenger platform.
Step 3: Assign roles to a user as insight user, administrator, tester, and/or developer.
Step 4: Write a Java script with the pre-defined templates like generic, text, button, or airflight-based templates.
Step 5: Send text, image, audio, video, or a file to the end user.
- Wit AI platform
Wit AI is an AI product from Facebook that has features like:
- Voice recognition
One can create an entity that will have predefined trait or keywords or free-text, and it will return a user-defined entity, which will be used by the bot to process the text. Using the same approach, multiple such stories can be created that can meet a business use case. On the basis of what user defined text is returned, it becomes easier to process the response and get the desired result.
Here is what you are required to do in the script:
- Step 1: Configure the token into the script
- Step 2: integrate with Wit AI
- Step 3: Write the response code for the JS.
So this is how a bot would look: