Artificial Intelligence is a contemporary buzzword that has the tendency to incite visions of a not-so-distant dystopian future ruled by intelligent robots. These feelings are backed up by a number of films and books that feed these fears for the future, such as BladeRunner, WestWorld, 2001: A Space Odyssey and the works of Harlan Ellison – but today, AI is just a field in computer science that is inspiring a generation of engineers.
I’m a front-end engineer at Blend however recently I’ve had the opportunity to work on one of the most accessible parts of the field of IA – the chatbot. These bots are built on Machine Learning (ML) and Natural Language Processing (NLP) – two of the most famous subsections of AI that have recently had a lot of energy directed towards, so I decided to give a brief overview of chatbots and how they relate to ML and NLP.
Machine Learning
Machine Learning is probably a term that you haven’t escaped in recent years – it’s already prolific and many services we use today are built upon it – Netflix, for example, uses ML to provide you with recommended shows. Essentially you can think of ML as a programme that can learn without being programmed, it looks for its own insights rather than being fed information by a developer.
The idea of self-learning computers may bring back those thoughts of the dystopian future, but this doesn’t need to be on our radar just yet – Machine Learning is still very much in its infancy and there is still limited understanding of the core theories behind it. However, Machine Learning is one of the elements at heart of AI – if a machine can learn that’s the first step towards intelligence.
“Machine Learning is one of the elements at the heart of AI – if a machine can learn that’s the first step towards intelligence”
So a machine needs to learn to be considered intelligent, but perhaps more importantly a machine would also need to communicate. Language is so important in this field and it comes into great consideration in the ‘Turing test’, a theory that underpins the philosophy of AI. In this test, developed by Alan Turing, an examiner must have a text-based conversation with a machine. If the examiner cannot conclusively tell if their conversation partner is a machine, then the machine has passed the test – it is so realistic that it passes for human.
Natural Language Processing
It should come as no surprise then that a significant effort has been spent on getting computers to handle language. This is where Natural Language Processing comes in – this field examines the relationship between computers and human languages (such as we see with chatbots).
Natural Language Processing only started to truly come into being in the late 1980s when the introduction of Machine Learning revolutionised the field. Before then, rules of languages were hard-coded, but this approach could never satisfy the fluid rules of language and the many irregularities all languages have. Instead, ML and NLP in conjunction allowed programmes to ‘learn’ – they could make guesses based on probability and statistical evidence acquired through analysing large quantities of text, and this is how we can have natural conversations that almost seem human with some chatbots.
It’s important to understand, however, that chatbots aren’t intelligent – but a well-programmed bot can do a great job of convincing us otherwise. To date, no bot has ever passed the Turing test (although some have claimed otherwise: both Eugene Goostman and Cleverbot’s creators assert that their bot has passed the test, but this is highly contested). Bots are on the rise, partly due to the recent fascination with intelligent machines, but also because of the appearance of many Natural Language Processing tools as a service platforms.
IBM Watson
Blend Media wanted to streamline the process by which people within the company could report bugs, and a bot seemed the best way to handle this. Before building this, I decided I wanted to use IBM Watson, which is a way of applying Natural Language Prosessing to the chat bot. IBM Watson is one of the leaders in the field whose machine won Jeopardy against the world champions in 2011 (see video below), and started working in hospitals on lung cancer treatment in 2013. I also used Botkit, a user-friendly library that easily integrates with IBM Watson, to build it.
The many tools available for building chatbots, including the two I just mentioned, meaning that I don’t actually have to touch any Machine Learning or Natural Language Processing to get a working bot – IBM Watson does that all for me. I do, however, get to train the NLP service by supplying it with a series of intents and entities.
Intents are the intention of the user talking to the programme, and they include things like ‘yes’, ‘no’, ‘hello’ and ‘goodbye’, but also cover more complicated structures, for example ‘what is the weather like in Sao Paulo?’ would have the intent of ‘check weather in certain location’.
Entities are the object of the intent, so in the example above, the entity is ‘Sao Paulo’. You can then set the bot to respond in a certain way when it hears particular intents or entities. We could therefore set our hypothetical bot to respond to our question by checking the weather in our entity, and telling the user ‘it is currently 22°C and sunny in Sao Paulo’. What I then do is map out the conversation in intents and entities, and handle the data I get from these convos. In the case of the bug bot, I sent the details of the bug to Trello where the dev team can easily review them.
By using IBM Watson, the chatbot isn’t simply palming off set responses to hard-coded questions, however, it will actually try to recognise intent, no matter what its phrasing is, so the questions: ‘what time does the restaurant close?’ and ‘when is the restaurant open until?’ would return the same intent and the bot would respond correctly. In this way misspellings and even missing words are accounted for, and the programme seems to ‘understand’ our questions.
Of course, in the grand scheme of things, this technology is still very much in its first stages of development and frequently trips up – in our bug bot, the word ‘platform’ kept being registered as the intent ‘stop conversation’, so this required some tweaking of the IBM Watson middleware.
Both Machine Learning and Natural Language Processing are in vogue at the moment, and this, coupled with the numerous accessible NLP tools as a service platforms, has led to the rise of the chatbot. They’re easy to get started with so it doesn’t require advanced programming knowledge to build, but they do have their limitations. No bot has ever truly passed the Turing test and convinced us that they’re human, but that doesn’t mean they won’t in the future, possibly very soon.
Could this be the first step towards a new rule of robots overlords? Maybe, but not for a while.