KITT.AI : Natural Language Understanding

Craig Wright
Dev Tutorials
Published in
2 min readJan 30, 2017

--

NLU (Natural Language Understanding engine) is a machine learning powered system for building chatbots that feel more like talking to a person than talking to a computer.

Intents

Intents are the main communicative intent of the lines being input to the engine. For example, an intent called dialog_yes would capture inputs such as “Yes”, “Sure thing”, “I agree”, etc.

There are premade intents that are common, such as the dialog_yes example I used above. However, a developer may decide to make his own intents for more niche uses.

After choosing a name to define the intent, a developer would fill the intent with many different sample utterances that signal the intent to the engine, and after extended testing and use the chatbot would learn other phrases that may correspond to this intent.

Entities

A command spoken by a user to a NLU chatbot would contain one or many different entities, such as a song title, a location, etc.

For example, take the command “Play Livin’ On a Prayer by Bon Jovi”. The entities in this command are song: Livin on a Prayer, and artist: Bon Jovi.

Training

After adding 2 or more intents, you can start to train your chatbot. To train, you will send a command to the bot. After analyzing, the bot will return what it believes your intent was. If the bot was incorrect, you can correct it and it will do better next time.

Input and Output

After taking in a string/command as input, the NLU would output a json that would follow this format:

{
"tokenized_sentence": "utterance",
"intents": [
{
"score": intent_probability_score,
"intent": "intent_type"
},
],
"entities": [
{
"text": "text",
"end": endpoint,
"start": startpoint,
"entity": "entity_type"
},
],
"sentence": "utterance"
}

NLU and ChatFlow

NLU is just an engine used to train a bot to learn how to understand what a users intent is when speaking. The actual natural language part comes with ChatFlow, another technology made by the same company who made NLU. I’ll get more in depth with ChatFlow in the next post. To quickly sum it up, the designer places nodes on a canvas. These nodes have both inputs and outputs, and connect to each other.

Dialog nodes in ChatFlow

http://docs.kitt.ai/chatflow/

Like to share your coding examples and knowledge of bot development on various messaging platforms with other developers? Join bot Tutorials and submit your articles and post.

--

--