“It is said that to explain is to explain away. This maxim is nowhere so well fulfilled as in the area of computer programming, especially in what is called heuristic programming and artificial intelligence…Once a particular program is unmasked, once its inner workings are explained in language sufficiently plain to induce understanding, its magic crumbles away; it stands revealed as a mere collection of procedures, each quite comprehensible. The observer says to himself, I could have written that.”
What we should keep in mind before we write a conversational bot?
Domain knowledge should be the first thing to be kept in mind. True artificial intelligence (AI) doesn’t exit. Even the best that can intimate humans, is restricted to subset of topics or conversational gambits. IBM Watson (best AI supercomputer) known for winning Jeopardy knew facts and could construct realistic natural language responses, but it couldn’t schedule your meeting or deliver your groceries. Same is with other renowned chat bots, they only serve to a specific domain; to which they are trained.
Personality, tone or vocabulary bot will employ. Bots have historically been personified as something less than fully human to excuse their rote responses and frustrating lack of comprehension. Often the dual axes of domain and personality align: in the program ELIZA, the domain was a therapy session, and the bot’s personality was that of a Rogerian therapist. Domain and personality don’t necessarily need to be tightly coupled, though—an ecommerce bot needs to know about products, sizing, and order status, but that domain doesn’t imply any particular kind of personality. A shopping bot could have the persona of a helpful person, a cheerful kitten, or have no personality at all.
How bots work
Conversational agents or Dialog system, that simulates Intelligent conversation using text or speech, mostly consists of 3 modules.
- Data exchange module.
- Natural Language Assistance.
- Chat bot engine.
- Data exchange Module – Enables interaction between messaging client and bot engine. It could be 2 way hooks or full duplex real time communication channel like WebRTM, websockets or any other. Most of the times, web hooks are used as a medium of data exchange between messaging client and bot.
Transferring the message from messaging client to Chat bot and vice versa are responsibility of Data exchange modules. It’s an inlet and outlet for chat bot application interaction.
Roshan says “hello” to Bot -> Skype (check message is for bot engine ) -> send message to Bot engine listing at webhook (http:/so/so) or RTM (wss:/so/so) [this where data exchange module comes into picture]
Bot Engine processes the request and returns response
Botengine sends message to Roshan -> Skype (message is from Bot to Roshan) -> sends message to Roshan (Bot says “hi”)
- Natural Language Assistance – this is where the magic lays. It’s a mixture of Natural language processing, Natural language Understanding and Artificial Intelligence.
This is the core of conversational bots. We can build this in 3 major ways.
- Build AI of our own – A large amount of human hour and enormous data is needed for Machine Learning. NLP and NLU is another big thing to be taken care of.
- 3rd party NLP and NLU powered by AI like Wit.ai, luis and many others.
- Hybrid – Wherein we utilize 3rd party api for NLU and NLP and rule engine is built by us.
Rule engine doesn’t mean the use of if and else statement.
A rule engine is all about providing an alternative computational model. Instead of the usual imperative model, commands in sequence with conditionals and loops, it provides a list of production rules. Each rule has a condition and an action – simplistically, you can think of it as a bunch of if-then statements.
– Martin Fowler
Simple NLA example –
# Sentences we’ll respond with if the user greeted us
GREETING_KEYWORDS = (“hello”, “hi”, “greetings”, “hey”, “what’s up”)
# Predefined set of responses for specific topic greetings.
GREETING_RESPONSES = [“‘What’s up bro”, “hey”, “hi”]
“””If any of the words in the user’s input was a greeting, return a greeting response”””
for word in sentence.words:
if word.lower() in GREETING_KEYWORDS:
Its simple implementation where it looks for certain keywords in user utterance and returns, form several predefined responses. In a more complex system, deep neural networks like RNN are used. Even in a generative model, RNN with LSTM has soon great results but not so reliable, this is why we don’t see bots build out of true generative model.
- Chat bot engine – It converts results form Natural Language Assistance to actions and responses.
NLA provides us with the probability of intent, entities and different user defined contexts. But the business logic resides in bot engine. That uses those probabilities to determine appropriate response or action.
A better understanding can be derived from our next upcoming blog – How we implement Chat bot for IoT Ecosystem.
- Implementing bot in IoT ecosystem
What we did... With the help of Hallwaze beat’s RTM api and a bot engine that uses popular Wit.ai for NLU and NLP. We cooked some very interesting bots. We…
- Implementing Chatbot in IoT Ecosystem (Use-case)
In continuation with the Chatbot series, we are back with our next blog on implementing chatbot in IoT ecosystem. Let’s get started. What Did We Do? With the help of…
- Introduction to Chat bots (Part 1)
Chat bots Chat bots are Conversational agents or a Dialog system that simulates Intelligent conversation using text or speech. Why chat bots? In recent times, a sudden rise in interest towards…
- AI in Banking(2) – Chatbots
Hello readers, as promised, we are here with our 2nd blog in the series of blogs on “AI in Banking and Financial Services”, focusing on Chatbots. As discussed in the…
- A Know-how of Timesheet Management via Chatbot
SAP Timesheet Management using Chatbot is an application, which helps users in managing their time entries quickly and efficiently in real-time through mobile phones. Chatbot is an AI-powered computer program…
- Manager’s Dilema: SAS vs R vs Python
There are countless articles on this topic already, and I must begin by accepting that I am quite late to this superstar battle. However, every time these champions of analytics…