com.nuwarobotics.service.agent.SimpleGrammarData |
SimpleGrammarData allow user easy to create grammar data
//prepare local command list ArrayListcmdList = new ArrayList () {{ add("今日の天気"); add("おはよう"); }};//you can customize this list //Create Grammar class object //NOTICE : please only use "lower case letter" as naming of grammar name SimpleGrammarData mGrammarData = new SimpleGrammarData("example"); //setup local command list to grammar class for (String string : cmdList) { mGrammarData.addSlot(string); Log.d(TAG, "add string : " + string); } //generate grammar data mGrammarData.updateBody(); //create and update Grammar to Robot Log.d(TAG, "createGrammar " + mGrammarData.body); //NOTICE : please only use "lower case letter" as naming of grammar name mRobotAPI.createGrammar(mGrammarData.grammar, mGrammarData.body); // Regist cmd
{ "version“: 1.0, “grammar": "test", //grammar set name “command": { //command array, if single command only, just only write single array "single": [ "今日の天気", "おはよう" ], } }
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
SimpleGrammarData(String grammar)
Identifier of grammar object
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
boolean |
addSlot(String... cmds)
Add recognize keyword as local command
| ||||||||||
Set<String> |
getAllCmdSet()
get all local command list
| ||||||||||
boolean |
updateBody()
Update grammar to system
|
Identifier of grammar object
grammar | grammar name |
---|
Add recognize keyword as local command
cmds | keyword string |
---|
get all local command list
Update grammar to system