# How do “intent recognisers” work?

Amazon's Alexa, Nuance's Mix and Facebook's Wit.ai all use a similar system to specify how to convert a text command into an intent - i.e. something a computer would understand. I'm not sure what the "official" name for this is but I call it "intent recognition". Basically a way to go from "please set my lights to 50% brightness" to lights.setBrightness(0.50).

The way they are specified is by having the developer provide a list of "sample utterances" which are associated with an intent, and optionally tagged with locations of "entities" (basically parameters). Here's an example from Wit.ai:

My question is: how do these systems work? Since they are all very similar I assume there is some seminal work that they all use. Does anyone know what it is?

Interestingly Houndify uses a different system that is more like regexes: ["please"] . ("activate" | "enable" | "switch on" | "turn on") . [("the" | "my")] . ("lights" | "lighting") . ["please"]. I assume that is integrated into the beam search of their voice recognition system, whereas Alexa, Wit.ai and Mix seem to have separate Speech->Text and Text->Intent systems.

Edit: I found a starting point - A Mechanism for Human - Robot Interaction through Informal Voice Commands. It uses something called Latent Semantic Analysis to compare utterances. I'm going to read up on that. At least it has given me a starting point in the citation network.

Edit 2: LSA is essentially comparing the words used (Bag of Words) in each paragraph of text. I don't see how it can work very well for this case as it totally loses the word order. Although maybe word order doesn't matter much for these kinds of commands.

Edit 3: Hidden Topic Markov Models look like they might be interesting.

• This post explains intent classification in details: mrbot.ai/blog/natural-language-processing/… – znat Nov 28 '17 at 21:33
• This appears to use the "bag of words" method I mentioned in my question. Basically just add up the word vectors in the sentence. That can't be how it works though. Wit and Nuance's interfaces show that they recognise entities which bag of words can't easily do. Also bag of words loses all ordering so something like "Set an alarm for 10 past 5" would be indistinguishable from "Set an alarm for 5 past 10". There must be something more going on. – Timmmm Nov 29 '17 at 11:40
• Entity extraction is another problem where sequence matters. If you have a lot of data an Rnn will work, in smaller datasets, which are frequent in chatbots, conditional random fields work very well – znat Nov 29 '17 at 15:30
• Ok, so ... I'm looking for a more detailed answer than "an RNN will work". Most modern sequence learning systems use RNNs so that seems a given. – Timmmm Nov 29 '17 at 18:15
• intents are about the general meaning of the sentences (avg of vectors) and entities are about learning the context (surrounding words) in which they appear. Rnn or CRF are just algorithms that can be used because they learn from sequences. If you want to learn in detail, look into Rasa source code – znat Nov 29 '17 at 18:24

Although not directly answering your question, you may be interested in the field of automated question answering. To answer natural language text questions they must first be understood, which overlaps with your problem.

A good resource is the course by Jurafsky and Manning. Particularly the sections on semantics and question answering may help with what you are looking for. There are accompanying lecture videos available on youtube here.

• I find first part of your answer very funny yet informative. – Diego Nov 5 '16 at 0:01
• Perhaps this would be better as a comment since, as you admit, it doesn’t answer the question. – kbrose Nov 29 '17 at 0:04

This post has an approach. Basically they use bag of words - they convert the words to sparse vectors and then add them up.

It appears to work fairly well but one major flaw is the answer is independent of word order, so you can't do queries like "How many kilos in a pound" unless you special case them.

However I did text with Alexa and it is fairly insensitive to word order changes so maybe they do use something similar.

• Curious - what advantage do sparse-vectors have over Naive Bayesian? Both to me solve linearly-separable problems with the naive bag-of-words assumption – Angad Oct 25 '17 at 5:30