| java.lang.Object | |
| ↳ | com.nuwarobotics.service.agent.VoiceResultJsonParser |
Simple tool to parser Result JSON format
@Override
public void onSpeech2TextComplete(boolean isError, String json) {
String result_string = VoiceResultJsonParser.parseVoiceResult(json);
}
@Override
public void onWakeup(boolean isError, String score, float direction) {
String wakeup_word = VoiceResultJsonParser.parseVoiceResult(score);
}
Json format
{
"version": 1.0, //version control (double base)
"type": 1, //Result format, 1 is Command type, 2 is Recognized type
"result": "Hello", // ASR result(String base)
"class": "com.xxx.lib.voice.hybrid.engine.XXXTWMixEngine", // Engine class name(for debug)
"engine": "ASR solution", //engine solution name
"extra": //extra tag for solution extention (OPTION)
{
//Define :
"content":"String"
},
"content": "XXX", //Extra section (OPTION)
}
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| VoiceResultJsonParser() | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| static Object |
parseExtraData(String json, String key)
Get value of specific key field
| ||||||||||
| static String |
parseVoiceResult(String json)
Get recognize result string from JSON
| ||||||||||
| static int |
parseVoiceType(String json)
Get recognized result type from JSON
| ||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
Get value of specific key field
| json | recognized result json |
|---|---|
| key | specific field |
Get recognize result string from JSON
| json | recognized result json |
|---|
Get recognized result type from JSON
| json | recognized result json |
|---|