调试JSON返回信息与DEMO不一致
sddsyf 发布于2016-07 浏览:1092 回复:5
0
收藏

百度语音输入对话框的activity在输入语音识别后会返回如下结果:

---origin_result

{
"content": {
                                                    "item": [
                                                        "返回首页"
                                                    ],
                                                    "json_res": "{\"parsed_text\":\"返回 首页\",\"raw_text\":\"返回首页\",\"results\":[{\"domain\":\"setting\",\"intent\":\"set\",\"object\":{\"_settingtype\":\"back_home\",\"settingtype\":\"back_home\"},\"score\":0.950},{\"domain\":\"instruction\",\"intent\":\"back_home\",\"object\":{},\"score\":0.950}]}\n"
                                                },
                                                "result": {
                                                    "corpus_no": 6311894965753955258,
                                                    "err_no": 0,
                                                    "idx": -32,
                                                    "res_type": 3,
                                                    "sn": "1402f80c-b2b5-4bc7-b81a-7c7c4844db4f"
                                                }
          


但是我们实际调用过程中拿到的返回结果是:

origin_result=
                                                    {
                                                        "content": {
                                                            "item": [
                                                                "返回首页"
                                                            ]
                                                        },
                                                        "result": {
                                                            "corpus_no": 6311894379772350270,
                                                            "err_no": 0,
                                                            "idx": -17,
                                                            "res_type": 3,
                                                            "sn": "ecb70010-e73f-4889-89e0-4a0f47fa391d"
                                                        }
                        


"json_res"这部分的内容没有了,请问怎么处理呢?                              

收藏
点赞
0
个赞
共5条回复 最后由c5812回复于2016-08
#6c5812回复于2016-08

你好,

if (sp.contains(Constant.EXTRA_NLU))

直接跳过这个if,直接设置EXTRA_NLU也是可以的

0
#5勤奋的车和家回复于2016-07

您好,按照您所说的:

1.程序中设置nlu为enable:

if (sp.contains(Constant.EXTRA_NLU)) {
String tmp = sp.getString(Constant.EXTRA_NLU, "").replaceAll(",.*", "enable").trim();
   if (null != tmp && !"".equals(tmp)) {
intent.putExtra(Constant.EXTRA_NLU, tmp);
   }
}

2.开放平台自定义设置勾选需要的领域,并且已经生效:

√已生效

生效时间:2016年07月29日

已选领域:地图、电话、通讯录等共12个

结果问题这个issue依然存在。

另外我在设置里勾选了开启语义解析,但程序中if里的条件一直为false.

if (sp.contains(Constant.EXTRA_NLU))

请帮助分析问题原因,谢谢。

0
#4c5812回复于2016-07

您好,不需要关注协议号。要使用语义请:

1. 程序中设置nlu参数为字符串的enable

2. 开放平台对应app的自定会设置中,勾选需要的领域(应用管理->您的APP->自定义设置-语义解析设置)

0
#3勤奋的车和家回复于2016-07

请问以上问题需要设置协议号为305,在哪里设置?

0
#2mosal4hi回复于2016-07

需要设置协议号为305,并且勾选对应的领域

0
TOP
切换版块