ok
CHOOSE YOUR LANGUAGE

Template: Hello World

 

After you read the explanation for this DDE sample project Hello World, you will know:

 

  1. What is a cross intent
  2. How to trigger your app
  3. What is an app specific concept
  4. What is system concept
  5. How to reference a concept in intent
  6. What are the three conditions to control a triggered plan
  7. What is the required belief
  8. What is input context
  9. How to test a project on DDE

 

 

 

 

Part 1: Import Sample Project : Hello World

In the DDE editor, you can easily import the Hello World Sample Project by clicking “Import Template Project: Hello World”

 

Fig. 1. This figure shows the button to click to import the sample project.

                                     

Fig. 2. The figure shows the result after importing the sample project.

 

Part 2: Fill your app’s package name, activity name, and get your app key ID in the Console of Developer Site.

 

Before you start using the DDE Editor, you should register the info of your app (such as 1. Package Name 2. App Name 3. Activity Name…., etc.,) in the Console of Developer Site (see figure), and you will be assigned an app keyed key ID for this app (with corresponding package name, activity name, app name,.. etc.).

Fig. 3. The figure shows where the Console is

 

After you get in the console (if you didn’t login in, the website will ask you to login), you will see the Key Management as the figure below:

Fig. 4. The figure shows the App Key Management Page.

 

You can click “Add” to register a new app. Now you should predefined some static info here and follow the hint by the website.

Fig. 5. The figure shows to fill the app related info to get an app key id.

 

After you press summit, you will get an app key like below:

 

Fig. 6. The figure shows the result of summit successfully.

 

Now go back to the DDE Editor.

You can fill the app key id to the DDE editor like in the picture as figure below:

Fig. 7.  The figure shows the place to fill the app-specific info.

 

 

Fig. 8.  The required fields need to fill.

 

If the App Key ID is correct, the related info will fill automatically, Be sure to make your package Package Name and activity Activity Name is the same as your own apps’ (here means the package name and activity name in the code you will install on Zenbo), because that is how Zenbo SDK will get the corrected path to launch your app.

 

 

Part 3: Overview of Hello World project

 

In Concepts Tab

There is only one concept called MyCity with two instance, city001(Black City) and city002(White City).

 

Fig. 9. The overview of Concepts.

Fig. 10. Detailed info of class MyCity.

In Intents Tab

There are two intents :

 

Fig. 11. The overview of intents.

  1. Intent utteranceToLaunchApp with one sentence inside.

Fig. 12. Detailed info of intent utteranceToLaunchApp.

 

  1. Intent userSayHello with four sentences inside.

Fig. 13. Detailed info of intent userSayHello.

 

In Plan Tab

There are two Plans:

Fig. 14. The overview of Plans.

 

  1. Plan lanuchHelloWolrd_Plan.

Fig. 15. Part 1 of detailed info of lanuchHelloWolrd_Plan.

Fig. 16. Part 2 of detailed info of lanuchHelloWolrd_Plan.

 

The setting of “will this plan launch your app” inlanuchHelloWolrd_Plan is true so that this is an entry Plan for this app. When user utterance hits the intent “utteranceToLanuchApp”(a csr event), and since there is no required belief need to be collected, the Plan is triggered. Once this Plan is triggered, the Action is to choose a matched condition (In this case, it is “always” condition) and then set next context “helloWorld” to be listened by DS.

 

  1. Plan helloWorld_Plan.

Fig. 17. Part 1 of detailed info of helloWorld_Plan.

 

Fig.18. Part 2 of detailed info of helloWorld_Plan.

 

The setting of “will this plan launch your app” in helloWolrd_Plan is false, so there must define an input context inside (In this case, it is defined as “helloWorld”, which is a trigger condition of this plan.).

Once the context stack "helloWorld" comes, and the user utterance hits the intent “userSayHello”, since there is a required Belief “myCity1”in this Plan, this Plan will start to check if the value of required belief (myCity1) is already acquired from user utterance or not, if not, DS will do a clarification “can you tell me what city you are from?” which is defined in prompts of myCity1. If all the required info is extracted, this Plan is just triggered. The system will give up this plan after attempting clarification 4 times.

Once this Plan is triggered, the Action is to choose a matched condition (In this case, it is “always” condition) and then set empty context to be listened by DS , then the System will display the response “welcome to my city”. You can usually control when to respond easily by getting the string and call the TTS API in the Zenbo SDK).

 

 

Part 4: Publish your Hello World project

Now that you have linked your own specific app key ID and the sample project together you can now publish your project.

Fig. 19. The figure shows the place to click to Publish the project.

Part 5: Test on DDE

After publishing your app, before you test it on real devices, you can do a quick and simple test on the DDE.

 

Please input “start the hello world sample” and press enter.

Fig. 20. Simple test of hello world project.

 

 

Now you will see the response as below:

Fig. 21. Simple test result of hello world project.

 

Fig. 22. Simple test json result of hello world project.

 

Note:  “start the hello world sample”  is defined in utteranceToLaunchApp intent, and lanuchHelloWolrd_Plan have defined utteranceToLaunchApp as its CSR event. That is, once the CSR event “utteranceToLaunchApp”  happened,  the Plan is triggered.

 

You can then input “hello black city” and press Enter.

Fig. 23. Simple test of hello world project.

 

You will then get:

Fig. 24. Simple test result of hello world project.

 

Fig. 25. Simple test result of hello world project.

 

Note 1 : In the CSR case, the alphabets are always in lower case.

Note 2: How does this work? Remember the first Plan “lanuchHelloWolrd_Plan”, when the Plan is triggered, it has defined some task to do. One of the task is to set context status as “helloWorld”, which is actually one of the trigger condition of the second plan “helloWorld_Plan” (Input context is helloWorld), and “hello Black City” is defined in userSayHello intent, which is also a CSR event in helloWorld_Plan , that is, once the CSR event “sayHelloWorld” intent happened, and the system also got the required Belief info from user utterance, the Plan is triggered.

 

Part 6: Test Belief Setting

Now, let’s try again quickly by the following steps:

  1. Reset context
  2. Input “start the hello world sample” and press enter
  3. Input “hello taipei”

Now , you will see a system clarification like below:

                    

Fig. 26. Example of the system trying to do clarification to get the required Belief.

 

Why it happened?

Notice that under the belief setting in plan “helloWorld_Plan”, you will find that there are two beliefs.

Fig. 27. Review belief setting in helloWorld_Plan.

 

See the first row, myCity1 is set as “required”, that means before you execute your task defined in this plan, you must get the value from the user, or the system will do a clarification based on the prompt of this belief.

 

And how to interact with the system? Try inputting “white city”.

Fig. 28. Example answer of the clarification.

 

 

Fig. 29. Example of the result after the user answered the clarification,

notice that there are two beliefs extracted from the user utterance here.

 

 

Part 7: Test on Zenbo

Now, you must be wondering on how to test it on Zenbo.

First, you must install your own app with your registered packageName and Activity Name on the Dev Site.

After Installing, you can say “hey zenbo” and wait for the sign to speak “start the hello world sample”, now you will see Zenbo launch your app.

For more infomation on the right way to test on Zenbo, please refer to the developer website for other formal documents.

 

Part 8: Use DS API for the template project

Here are some sample codes for the DS API in the Zenbo SDK

Sample Code1:

sample code 1-1

//Normal case for start DS to listen user utterance

mRobotAPI.robot.speakAndListen("", 10);  // time out : 10 second

sample code 1-2

//Start TTS first then Listen user utterance  

mRobotAPI.robot.speakAndListen("Which city do you like?", 10);

 

Sample Code2:

/*

Set two contexts (helloWorld, helloWord2) to be listened by DS and then start to listen user utterance.

*/



mRobotAPI.robot.setListenContext(“1277”, “helloWorld, helloWord2”);

mRobotAPI.robot.speakAndListen("", 10);

 

Sample Code3

/*

 jump to the plan (lanuchHelloWolrd_Plan) and do the actions (set context status), and then start to listen user utterance.

*/

mRobotAPI.robot.jumpToPlan("1277",” lanuchHelloWolrd_Plan”);

mRobotAPI.robot.speakAndListen("", 10);

 

Sample Code4:

//clear current app context and then start to listen user utterance

mRobotAPI.robot.clearAppContext("1277");

mRobotAPI.robot.speakAndListen("", 10);

 

 

Part 9: Customize your DDE hello world Project

 

Now you can try modifying the “MyCIty” Concepts, sayHello intents, and make more specific plans on DDE.

 

Fig. 30. Example of a customized Concept.

 

Fig. 31. Example of a customized intent.

Fig. 32. Example of a customized intent.

Note that you can reference a concept by the use of an "@", and then press "Enter" to get the orange UI as below :

Fig. 33. Example of referencing a concept as slot in a sentence.

 

 

Fig. 34. Example of referencing an app-specific concept as slot in sentence.

In Fig. 34, the expression means that the user utterance “hi black city” and “hi white city” will both hit the intent.

 

Fig. 35. Example of a customized plan.

Fig. 35 shows how to set the output context of the plan, you can define a whole new plan which has “nextContextAfterHelloWorld” as its input context.

Review:

Now you should be able to :

  1. Make a plan to trigger your app
  2. Create your App specific Concept
  3. Reference an system concept in your intent sentences

(If you are interested in the system concept, please see the system concept doc.)

  1. Understand that a plan is triggered once:
    • The CSR intent defined in the plan is hit
    • The context status is the same as the input context in the plan
  2. Understand that a plan will give up the action (even when the event is matched) once:
    • The condition is not satisfied
    • The value of the required Belief is missing and cannot be obtained from the user

 

 

 

 

 

 

Go To Top