调试JSON返回信息与DEMO不一致
sddsyf 发布于2016-07 浏览:1235 回复:6
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
个赞
共6条回复 最后由用户已被禁言回复于2022-04
#16用户已被禁言回复于2022-04

http://www.jicheng.net.cn/searching/?k=%E6%B5%99%E6%B1%9F%E6%A1%90%E4%B9%A1%E7%9C%9F%E4%BA%BA%E9%BE%99%E8%99%8E%E5%AE%98%E7%BD%91TL262%EF%BC%8E%EF%BC%A3%EF%BC%AF%EF%BC%AD%E5%BA%86%E9%98%B3%E7%84%A6%E7%82%B9%EF%BC%83%EF%BC%95 https://read.douban.com/tag/%E7%A6%8F%E5%BB%BA%E5%8D%97%E5%AE%89%E7%9C%9F%E4%BA%BA%E5%B9%B3%E5%8F%B0TL262%C2%B7C%EF%BC%AFM%E6%99%8B%E5%9F%8E%E7%BE%8E%E9%A3%9F%EF%BD%98%EF%BD%9E https://quanmin.baidu.com/wise/growth/querypage?keyword=%E6%80%8E%E4%B9%88%E5%81%B7%E6%B8%A1%E5%8E%BB%E7%BC%85%E7%94%B8%E7%BB%B4%E5%8A%A0%E6%96%AF%E7%BD%91%E5%9D%80B2024%C2%B7CN%E5%8E%A6%E9%97%A8%E7%BE%8E%E9%A3%9F%EF%BD%85.htm https://b2b.baidu.com/s?q=%E6%96%B0%E7%99%BE%E8%83%9C%E5%9C%A8%E7%BA%BF%E5%B9%B3%E5%8F%B0%E7%BD%91%E6%8A%95%E7%94%B5%E8%AF%9D%E5%AE%98%E7%BD%91TL262%C2%B7C%EF%BC%AFM%E6%B5%8E%E5%AE%81%E7%83%AD%E9%97%A8&from=search https://search.instrument.com.cn/w/index?keywords=%E6%9E%9C%E6%95%A2%E7%BA%A2%E6%B5%B7%E5%9B%BD%E9%99%85%E5%BE%AE%E4%BF%A1%E5%BC%80%E6%88%B7%E7%94%B5%E8%AF%9D%E3%80%90%E5%AE%98%E7%BD%91%E2%86%92TL262%C2%B7C%EF%BC%AFM%E3%80%91%E7%A6%8F%E5%B7%9E%E5%8A%9E%E4%BA%8B%E5%A4%84%EF%BD%83 https://www.donews.com/Ent/search_by_tag.html?tag_str=%E4%BA%91%E9%BC%8E%E5%9B%BD%E9%99%85%E5%BC%80%E6%88%B7%E7%9B%B4%E8%90%A5%E5%BC%80%E6%88%B7%3ATL262%C2%B7%EF%BC%A3%EF%BC%AF%EF%BC%AD%E9%82%B5%E9%98%B3%E4%BA%BA%E6%89%8D%E7%BD%91%EF%BD%99%EF%BD%84&from=index&bg=

0
#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
切换版块