问题
Google's action api seems to find the right pattern in my intent and bind to the right type, but does not return the parsed type data. For example, if I have the intent defined below in my actions.json file:
{
"description": "",
"initialTrigger": {
"intent": "RepeatIntent",
"queryPatterns": [
{
"queryPattern": "say $SchemaOrg_Number:mynumber"
},
{
"queryPattern": "say $SchemaOrg_Date:mydate"
},
{
"queryPattern": "say $SchemaOrg_Time:mytime"
}
]
},
"httpExecution": {
"url": "https://myurl/repeat"
}
}
and I enter, "at my action say tomorrow" into the simulator, I receive the following arguments:
"arguments": [
{
"name": "mydate",
"raw_text": "tomorrow",
"text_value": "tomorrow"
},
{
"name": "trigger_query",
"raw_text": "say tomorrow",
"text_value": "say tomorrow"
}
]
Note that the action SDK correctly identified "tomorrow" as type "$SchemaOrg_Date
" and bound it to the mydate variable, however, it did not return the "date_value" element in the return json as specified in the documentation. I would have expected that "date_value" element to contain a parsed date structure (per the document).
The same is true of numbers although they behave slightly differently. For example, if I use the phrase "at my action say fifty", I'll receive these arguments:
"arguments": [
{
"name": "mynumber",
"raw_text": "50",
"text_value": "50"
},
{
"name": "trigger_query",
"raw_text": "say fifty",
"text_value": "say fifty"
}
]
Note that the $SchemaOrg_Number
was recognized and "fifty" was correctly parsed to "50", but the int_value wasn't populated in the argument json per the documentation.
Google is actively parsing these complex types and has documented that they should be returned so I don't want to go to the trouble of parsing them myself. Any thoughts as to if this will be fixed any time soon?
回答1:
The Actions SDK does not support NLU for actions. You have to use your own NLU. If you don't have your own NLU, we recommend using API.AI.
来源:https://stackoverflow.com/questions/41877968/how-do-you-get-arguments-of-correct-type-in-google-actions-sdk