String requestJson = "{text:'请问能预定明天上午10点MF8196的机票吗?'}";
ResponseResult respResult = NLUAPIService.getInstance().
getAssistantIntention(requestJson,
NLUConstants.REQUEST_TYPE_LOCAL);
if (null != respResult)
{
//获取接口返回结果,参考接口文档返回使用
String result = respResult.getJsonRes();
}
{"intentions":[{"name":"bookAirTicket","attributes":
[{"flightNo":"mf8196","departTime":{"normalTime":
{"start"{"timestamp":1521856800000,"section":"P",
"standardTime":"2018年03月24日10时00分00秒"}},
"oriText":"明天上午10点","origin":"1521797656120",
"charOffset":5}}],"confidence":1}],
"code":0,"message":"success"}
目前助手类场景意图,只支持中文语境,意图中出现的属性可以为其他语言。
助手类场景意图是端测的,用户在手机断网的情况下,仍然可以使用这个功能。
SDK设计为单例,最好在application的onCreate里面初始化,onDestroy里面销毁。