Discovering QiChat, the SBR language for creating chatbots

Creating a Topic, a QiChatbot and a Chat

First, create a new QiChat-based application as seen in Getting Started (create a project, robotify it, register to the QiSDK, etc.). All the code in this lesson will be given in kotlin.

Your MainActivity class should look something like this:

class MainActivity : RobotActivity(), RobotLifecycleCallbacks {
   override fun onRobotFocusGained(qiContext: QiContext) {
       // TODO
   }

   override fun onRobotFocusLost() {
       Log.i(TAG, "Focus lost")
   }

   override fun onRobotFocusRefused(reason: String?) {
       Log.i(TAG, "Focus refused because $reason")
   }

   override fun onCreate(savedInstanceState: Bundle?) {
       super.onCreate(savedInstanceState)
       setContentView(R.layout.activity_main)
       QiSDK.register(this, this)
   }

   override fun onDestroy() {
       super.onDestroy()
       QiSDK.unregister(this, this)
   }
}

Then, create a topic file in the project: File > New > Chat Topic and name it basics.

You will then have to activate this topic by creating three objects (a Topic, a QiChatbot, and a Chat action). Replace the method onRobotFocusGained with this:

class MainActivity : RobotActivity(), RobotLifecycleCallbacks {
   override fun onRobotFocusGained(qiContext: QiContext) {
       val topic = TopicBuilder.with(qiContext).withResource(R.raw.basics).build()
       val qiChatbot = QiChatbotBuilder.with(qiContext).withTopic(topic).build()
       val chat = ChatBuilder.with(qiContext).withChatbot(qiChatbot).build()
       // Start the dialogue
       chat.run()
   }
}

Glossary

Topic: a file format containing the dialogue rules written with the QiChat language (a series of human inputs and robot outputs).

QiChat: the QiChat is a Softbank Robotics proprietary language forked from ChatScript, a combination of Natural Language engine and dialogue management system designed initially for creating chatbots. QiChat provides specific robotic functions to manage both inputs (words and human actions) and outputs (the robot's speech and movements).

Dialogue: a conversation between a person and a robot as a feature of a human-robot-interaction (HRI). Dialogue rules are written in a file that predefines inputs (what the robot can understand) and outputs (what the robot can answer when he understands something).