A lesson on how to make a robot that can be queried and returns relevant answers
Lesson

## What the lesson is about¶

With this lesson you will learn how to make a Pepper the robot linking constructive information to actal inquiries made from people in interaction.

## What you will need¶

• The assets contained in this zip file:

• A set of images, to place inside your app’s res/drawable folder
• The monsters_data.json file, to place in your app’s res/raw folder
• The third-party library “Klaxon” to parse the JSON file into Kotlin objects.

### What you will learn¶

One frequent use for Pepper is giving useful information - the hard part of doing that, however, is making sure that Pepper has the information, and is capable of linking it to questions asked by the users.

It is fairly straightforward to handcraft a specific dialogue on a given topic, on which one can anticipate the most common questions, and for which the answers are not expected to change; and that can be perfectly appropriate in some cases - for example, if Pepper is in a hotel lobby explaining how the magnetic keycard system works.

However, things become more difficult if there are a lot of possible questions, and, especially, if the answers are likely to change from time to time - continuously updating Pepper’s dialogue content can quickly become too much work. And this kind of frequently-changing information is precisely the kind of information that people are most likely to look for. For example:

• On which platform is the next train for Boston?
• Will it snow tomorrow?
• Do you have black running shoes in size 9?

A common point of these questions is that the answer can be found in a data source - that could be a database, a web service, or the outcome of an algorithm.

So in this lesson, we’ll be looking at a few useful design patterns when doing that; as an example, we’ll use a simple data table of cute monsters, like these:

We’d like Pepper to be able to answer queries like:

• How many red monsters are there?
• Show me monsters with one red eye
• Show me a monster with horns
• Do any of the purple monsters have three eyes?

The same principle could be applied to using more complex databases, web services, etc.

There are two ways:
Different kinds of Criteria:

• Show me red monsters
• Show me blue monsters with horns
• Show me monsters with one red eye

Different Question Types:

• Show me red monsters
• Show me a red monster
• How many red monsters are there?
• Are there any red monsters?