Semantic understanding interface
Semantic understanding
## WeChat open platform semantic understanding interface call (http request) It is simple and convenient. Users do not need to master semantic understanding and related technologies. They only need to choose the corresponding services according to their own product characteristics to build a set of intelligent semantic services.
Send semantic understanding request
http request method: POST (please Using https protocol)
https://api.weixin.qq.com/semantic/semproxy/search?access_token=YOUR_ACCESS_TOKEN
POST Data format: JSON
POST data example:
{
"query":" Check the China Southern Airlines tickets from Beijing to Shanghai tomorrow.",
"city":"Beijing",
##"category": "flight ,hotel","appid":"wxaaaaaaaaaaaaaaaa",
"uid":"123456" }
Parameter Description
parameter | Is it necessary | Parameter type | Description |
access_token | is | String | Token obtained based on appid and appsecret |
query | is | String | Input text string |
category | is | String | that needs to be used Service type, multiple separated by ",", cannot be empty |
latitude | See interface protocol documentation | Float | Latitude coordinates are input at the same time as longitude; optionally input with city |
##longitude | See interface protocol documentation | Float | The longitude coordinates are input at the same time as the latitude; choose one of the two and input the city |
city | See interface protocol document | String | City name, choose one of the latitude and longitude |
## region | See the interface protocol document | String | Region name, if it exists in the city The following can be omitted; choose one of the longitude and latitude and enter |
appid | is | String | The unique identifier of the public account, used to distinguish the developers of the public account |
# #uid | No | String | User unique id (non-development User ID), the user can distinguish different users under the official account (it is recommended to fill in the user openid). If it is empty, the context understanding function cannot be used. The context understanding function can only be used when appid and uid exist at the same time. |
Note: The intention of a single category is relatively clear, and the recognition coverage is relatively large. Therefore, if you only want to use a specific category, it is recommended to set the category to only that category.
Return Instructions Under normal circumstances, WeChat will return the following JSON data packet:
{
"errcode":0,
"query":"Check the China Southern Airlines ticket from Beijing to Shanghai tomorrow",
"type":"flight",
"semantic":{
"details":{
“start_loc”:{
“type”:”LOC_CITY”,
“city”:”Beijing ",
## "city_simple":"Beijing",
## "loc_ori":"Beijing"},
“end_loc”: {
“type”:”LOC_CITY”, “city”:”Shanghai City”, “city_simple” :"Shanghai", "loc_ori":"Shanghai" ## }, "start_date": { "type":"DT_ORI", "date":"2014-03-05", “date_ori”:”tomorrow” }, “airline”:”China China Southern Airlines" }, "intent":"SEARCH" } Return parameter description For more details and protocol description, please view: Semantic Understanding Interface Protocol Document parameter Is it necessary Parameter type Explanation errcode is Int represents the status after the request query is String The user’s input string type is the global type of the String service id, please refer to the vertical service agreement definition in the agreement document semantic is the structured identifier of Object after semantic understanding. Each service is different result No Array Results for some categories ##answer ##NoString The results of some categories are displayed in html5, which is currently not supported ##text No String Special reply instructions