# Chatbot¶

## What is it¶

A Chatbot is an object allowing to make the robot react according to human sentences. The reaction can take different forms (verbal, movements etc. or a mix of several of them).

It is used by a Chat action.

## How to use it¶

Depending on your use cases, you may use one or several chatbot(s).

For example, you could use the three following chatbots:

• one QiChatbot, managing retail questions of your use case,
• one web-based chatbot (Microsoft, IBM, Google…), managing generic small talk,
• a last chatbot managing wikipedia questions.

### QiChatbot or BaseChatbot?¶

• Create a QiChatbot to take advantage of the powerful QiChat script language.

For further details see: QiChatbot.

• Create your implementation of BaseChatbot when you want to use external tools.

For further details see: BaseChatbot.

### Hypotheses number¶

It often happens that a pronounced sentence can be understood in different ways.

For example, if a human says: “Hello Pepper”, Pepper could understand: “Hello paper” as well as “Hello Pepper”.

So the Chatbot allows you to manage different assumptions of interpretation.

Moreover, you can define the maximum number of hypotheses you want to manage.

The Chatbot.setMaxHypothesesPerUtterance method allows to define a maximum number of hypotheses to process for each utterance, that is to say the maximum number of calls to Chatbot.replyTo().

val chatbot: Chatbot = ...
chatbot.maxHypothesesPerUtterance = 3


Chatbot chatbot = ...;
chatbot.setMaxHypothesesPerUtterance(3);



This information might be used to configure the number of hypotheses requested from the Speech Recognition engine, depending on the Chat implementation. While the setMaxHypothesesPerUtterance method allows to define the maximum number of results, Chatbot.replyTo() may be called less than this value, since the Speech Recognition engine may provide a smaller number of results depending on the intelligibility of the user’s speech.

Default value

The default value of maxHypothesesPerUtterance for Chatbots is 2, which is also the recommended one.