Jason Marshall
27 Nov 19

Don’t worry, this isn’t a sad story.

We patched it up. This is really a story about the basics of Natural Language Processing.

I had just got my new Apple Watch, and was experimenting with Siri. I chuckled to myself as I exclaimed that AI was going to make everything easier; it would even help me to maintain my relationships. I thumbed the watch’s crown and uttered the fatal phrase “Tell my wife I love her”.

As I was beginning to ponder what other areas of my life chatbots could revolutionise, I received a message:

Oh my, what had I done? How was I going to explain this? More to the point, why had Siri let me down like this — what was it thinking?!

My mistake: Artificial Intelligence is not human intelligence, in a machine

Let’s imagine I am driving you somewhere, and ask you to grab my phone and “tell my wife I love her”, you would know to send a text to my wife and to say “I love you”. You would pick up on the change in context, and the need to switch the subjects around to convey the intended message. That is because you, dear reader, are a human.

The mistake I made with Siri, was to assume that it could think like me. It can’t. It’s “intelligence” is much more rudimentary. All it can really do is to make predictions about whether what I said is likely to mean something that it can actually do. In my case, it was able to accurately predict that I wanted it to send a text message to my wife, and it could detect what my message was. But it was not able to reason about the content of the message.

So what was Siri thinking?

Siri is a software agent (as are other chat bots). It is able to interact with a human and do things for them. AI powered agents employ Natural Language Processing (NLP) to take action based on what you say (or type). AI agents appear intelligent because you can ask them to do things in the same way that you would a human and they will (mostly) understand you. Also you can say the same thing in a range of different ways, for instance, “Tell my wife I love her” and “Send my wife a message to tell her that I love her” and they will be able to interpret that you meant the same thing.

To demonstrate how this works, I am going to use Google’s Dialogflow to recreate my interaction with Siri. The great thing about Dialogflow is that you don’t have to be computer scientist to use the power of NLP, you just need to understand a few key concepts:

Agent — This is the software that interacts with humans, in this example: DialogFlow.
Utterance — this is what I said: “tell my wife I love her”
Intent — this is what I intended to achieve with my utterance. In my case, I wanted to send an SMS to someone, specifically my wife, specifically to tell her that I love her.
Entity — these are the “parameters” that are relevant to my intent. In this case you need to provide both the intended recipient, and the message.

So let’s get started.

The first thing I need to do is to define the “send an SMS to someone” intent. Having done so, I provide some training phrases. These are examples of utterances that my users might reasonably say. You can see here that I have provided a few.
Now, when I say any of these utterances, or something similar, DialogFlow will know that I intended to “send an SMS to someone”. But at this stage it won’t know who that someone is, nor what I want to say. To give DialogFlow this information, we need to label the entities in our training phrases to help it pick out the parameters it needs to perform the intended action.




First I have labelled up the utterances where I have specified the message that I want to send. I have used one of DialogFlow’s system entities that will match any string, seeing as I can’t predict what the user will want to say.
Almost there, but DialogFlow still doesn’t know who to send the message to. I need to create my own entity to define “relationship” . Once DialogFlow has identified the relationship entity in an utterance it can figure out who to send the message to.

To make things interesting, I have added a few relationships, and I have reasoned that even though I said “wife” someone else might say “husband” but we are both talking about our spouses.



The last thing to do is train DialogFlow to recognise this new entity in the training phrases:

Great, so now when I make the utterance “tell my wife I love her”, DialogFlow can tell that my intent is to send a text message to someone, that the message is “I love her”, and that I want to send it to my wife. For the purposes of this demo, we’ll do something similar to Siri — we’ll confirm what is going to be sent:

What is great about NLP is that now we have set this up, I can start to use it for more than upsetting my wife:

How could I have achieved my original objective?

So, now we know the limits of AI, how could I have achieved my original objective of getting Siri to “tell my wife I love her”. Simple — “Siri, tell my wife that I love you”!


Article written by Jason, who is an associate consultant with us alongside running his own chatbot agency. We see AI/Chatbots being a vital part of some of the tools we create in the years to come.