How to Start Developing Your Intelligent Chatbot

Now, we’ve already talked about bots and the benefits of using them.

How to Start Developing Your Intelligent Chatbot

By Iffy Kukkoo

12 Jul, 2017

Your Own Bot

Now, we’ve already talked about bots and the benefits of using them.

But, have you ever wondered if you can directly contribute to the creation of one? Yes, we’re talking about an artificial mind! And, no, we’re not just selling this article: we’re really saying that you can start developing one today.

In fact, the chances are that you may already know something about the technology. Especially, if you’re reading us. (If not, you may be interested in finding a bit more about how to approach machine learning, about its basics, some of its more advanced forms and future prospects, but also about some relevant limitations).

We’re nice people and we tend not to hold any grudges if it’s your first time here. We’ll be gentle and walk you through the process step by step.

So, let’s go and find out if you need a smart virtual assistant and where is the best place to start looking for one.

 

Be Aware of the Structure

At the outset, you have to be aware that building a chatbot may not be the solution you’re looking for. In other words, constructing complex systems every time you need a virtual assistant isn’t the right thing to do. This is why understanding the difference between existing chatbots is crucial. And this is why you need to learn a thing or two about chatbots before rushing your decision to build one.

1) Prepare Yourself

If you are a complete newcomer, before proceeding, you may want to read the article linked above, in the first sentence of the text you’re reading. That way, you’ll get a better idea what are bots and when you’ll need them. However, we promised to make things as clear as possible – even for those who haven’t read it and don’t have time for it now. So –

2) Learn What Chatbots Are

Chatbots are closely associated with web applications. They owe their functionality to numerous HTTP requests and responses (hypertext transfer protocol is the set of rules allowing the communication between the client and the server) of either “POST” (for submitting information) or “GET” (for requesting information) nature.

3) Learn How Chatbots Work

 

To break this down.

Using a particular programming environment and certain libraries, a programmer builds a web application able to exchange information with the messaging platform you’re interested in (see below, 4.).

The information flow depends exclusively on events taking place at the user’s end. To put it in layman terms, this means that the application is programmed to react automatically in response to certain changes in the user’s behaviour.

At the end of the day, the structure of a basic chatbot is the combination of the following two elements:

A connection between the chatbot application and the application programming interface (APIs) of a chosen messaging platform by means of HTTP requests and responses; and

A communication with the users, based on the “if-then-else” programming logic (conditional statements enable chatbots to check whether the user’s input matches the case predicted in the code: whether it’s true of false).

4) Choose Your Messaging Platform

Every messaging platform has its own application programming interface (API), or, in other words, its own set of techniques and methods which allow you to connect with it and deploy your application.

As a result, before building your chatbot, you need to carefully choose the messaging platform (Facebook Messenger, Telegram, KIK, Slack) where you would want to run it.

5) Know Their History: It’s Fascinating

ELIZA (1966) and PARRY (1972) are the names of the first two chatbots ever built. Both owed their functionality to hard-coded logic exclusively.

Hard-coding means embedding an input or configuration data directly into the source code. It means including as many “if-then-else” lines as there are expected inputs. In this case, the responses of a chatbot depend solely on predicting the users’ input. Since it is impossible to predict everything a person might say, programmers need to rely on a trick or two to cheat the user into sharing with the bot the right information. For example, ELIZA was programmed to respond to every input containing the word “mother” with either “Tell me more about your family” or “Does talking about this bother you?” or “I’m not sure I understand you fully”. But, of course, these are not the only three viable options and predicting inputs means that a lot of stuff will be inevitably left uncovered.

However, back in 1966, it was impossible to create a program able to understand human language in any other way but simulating this through hard-coded logic. In fact, even though the “behaviour” of ELIZA and PARRY was entirely hard-coded, both chatbots attempted to pass the Turing test and fascinated first users with their intelligence (a modern JavaScript version of ELIZA is available here, so have a go and see if you’ll be similarly fascinated as well). Until recently, in fact, due to the lack of computing resources, chatbots similar to ELIZA and PARRY were the only chatbots available.

Nowadays, fortunately, language understanding (LU) services, are widely available now and hard-coded programming isn’t the only option. But, if you think that each and every chatbot you come across at messaging platforms is more intelligent than its ancestors – think again. Sometimes, chatbots such as ELIZA and PARRY work just fine and plain hard-coded logic is more than enough. Because, in more cases than one, humans are predictable.

Conventional Chatbots: Problems and Advantages

 

Problems

In general, there are two, or better yet one two-sided problem with conventional chatbots:

We are humans and we are different enough to often use diverse words to express pretty much the same things. Therefore, it frequently happens that a chatbot relies on a set of inputs which doesn’t include the one you use. This leads to him being unable to understand you. You might as well have been talking Chinese.

The second problem is a direct consequence of the first one: in order to prevent misunderstanding, a developer must offer the user a list of possible options, out of which he or she should choose one. This, however, makes the dialogue seem unnatural.

 

Advantages

But, as far as customer service is concerned, neither should be crucial. Because an artificially looking chatbot which incorporates a lot of buttons or drop-down list control menus (to avoid ambiguous inputs), but still performs fast searches through huge amounts of data and ends up either offering the user the best possible information or redirecting him to a human assistance may be even more than what you need.

Therefore, before deciding you need something much more complicated than a conventional chatbot, carefully think about the needs of your users and the purpose of your bot. Bear in mind that even when hard-coded, modern chatbots are far more efficient than their ancestors, due to increased computer power, which allows them to deal efficiently with much larger input/output sets. Also, bear in mind that even if you build something complicated, users may still be interested in merely some parts of its functionality. Then, why not offer them those only and save yourself the money and the time?

Our privacy promise to you
dee.ie Do you need some help?

 

Smart Chatbots: What to Do If You Really Need One?

OK, you got it: conventional chatbots are not as bad as they seem. But what if you really need a smart chatbot?

Well, you’re lucky – because we live in a day and age when “if-else” bots are practically a thing of the past. And when we say “day and age” we really mean “these days”. Because, during the past year or two, things have gotten a lot better. And it’s not because computers are becoming ever more powerful. It’s because the technology is more readily available. Nowadays, in fact, practically every developer can try himself/herself in AI fairly straightforwardly.

It’s as easy as 1-2-3.

1) Choose the Right Messaging Platform

This is both the most undemanding and the most important part of your job. Because you must choose the messaging platform your customers use more often (or even exclusively). No need to tell you this, but different messaging platforms are used by different people and for varying purposes. Some are used for chilling and talking to friends (Facebook), while others are for work purposes only (Slack). Some can be used for either (Telegram) and some are popular with teenagers (KIK). Make sure that you know your audience before choosing the right messenger.

2) Pick the Development Platform

Platforms such as Microsoft Bot Framework offer a wide range of useful tools which can simplify the development process and reduce the number of lines of code. In fact, Microsoft offers an all-in-one solution: create the bot application in Microsoft’s development environment, use the tools offered by Microsoft’s Bot Framework, add Microsoft Cognitive Services, and then publish the final product on Microsoft Azure.

3) Add Smart Services

Here’s a short list of the services which can help you create a chatbot which understands human language:

  • Microsoft Cognitive Services
  • IBM Watson
  • Wit.ai
  • Api.ai
  • Chatfuel
  • Botsify

Some of these services don’t even require you to code anything (Botsify, Chatfuel), which, as far as beginners are concerned, is more than useful. On the other hand, services such as Microsoft Cognitive Services and IBM Watson offer a wide array of functions, so they are a great tool for proficient developers (even though, learning them is simplified for newcomers as well).

The rest of these tools are something in the middle between the large platforms and the services which allow you to get around without coding: proficiency may be necessary, but they too have a highly intuitive interface and convenient tools to get you started.

It’s Been a Long Time…

Almost sixty years have passed since the first conversation between two chatbots – ELIZA and PARRY. You can find the conversation here and compare it with a recently recorded discussion between two AI-based Google Home chatbots named Estragon and Vladimir. The difference is striking.

And it owes much to the fact that, as we explained above, the “if-then-else” conditional logic behind ELIZA and PARRY has been superseded by the LU abilities of Estragon and Vladimir, which, as opposed to hard coding, rely on machine learning (ML) algorithms.

Here is how Sebastian Thrun, the chairman and co-founder of Udacity, and the founder of Google X, describes the difference between the old-fashioned hard-coded logic and the LU based on ML algorithms:

 

Imagine an old-fashioned program to identify a dog. A software engineer would write a thousand if-then-else statements: if it has ears, and a snout, and has hair, and is not a rat . . . and so forth, ad infinitum. But that’s not how a child learns to identify a dog, of course. At first, she learns by seeing dogs and being told that they are dogs. She makes mistakes, and corrects herself. She thinks that a wolf is a dog””but is told that it belongs to an altogether different category. And so she shifts her understanding bit by bit: this is ”˜dog,’ that is ”˜wolf.’ The machine-learning algorithm, like the child, pulls information from a training set that has been classified. Here’s a dog, and here’s not a dog. It then extracts features from one set versus another. And, by testing itself against hundreds and thousands of classified images, it begins to create its own way to recognize a dog””again, the way a child does.

Sebastian Thrun

 

Conclusion

There are two types of bots: 1) conventional, which rely on hard-coding “if-then-else” conditional statements and predicting inputs, and 2) modern, which have language understanding capabilities based on machine learning algorithms. Even though you might think otherwise, both types of bots are still in use.

As newer and newer platforms and services for building AI bots emerge, the amount of time necessary to develop a smart chatbot will exponentially decrease, and with it the need for conventional chatbots as well. And even though it’s fairly normal to expect that, in a very short period of time, the development of smart chatbots will become both easier and faster than the development of the conventional old-fashioned ones, before building a chatbot for your company you still need to consider the relation between the real purpose of its existence and the means at our disposal.

More often than not, conventional chatbots may still do the job.

Posted By: Iffy Kukkoo
Resident Editor-In-Chief

Iffy is our exclusive resident technology newshound editor, relentlessly exploring the beauties of the world from a 4th dimensional viewpoint. When not crafting, editing or publishing our IT content, she spends most of her time helping people understand life and its basic principles. You know, the little things around you, that you've failed to grasp each day.

Dee.ie IT blog has updates on IT Consultancy, IT Contractors and Software Development related posts, on how your business can be managed effectively using technology.

Feel free to read more and or reach out to share your thoughts, feelings and input on our articles, our team would love to hear from you!

Our privacy promise to you
Have a Question or Need an Answer? Ask our Live Chat and we will include it in our FAQ’s to make things easier for others

Our IT Blog

Latest Blog Post
blog-post

How to improve your businesses Software Maintenance?

Latest Blog Post
blog-post

What is the Difference Between a CTO & IT Consultant?

All Posts