本文介绍了如何在Google Actions SDK中获取正确类型的参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google的动作api似乎在我的意图中找到了正确的模式并绑定到正确的类型,但是没有返回已解析的类型数据。例如,如果我在actions.json文件中定义了以下意图:

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"
    }
]

请注意,动作SDK正确地将 明天标识为类型 $ SchemaOrg_Date 并将其绑定到mydate变量,但是,它未按照文档中指定的那样在return json中返回 date_value元素。我本来希望 date_value元素包含一个经过解析的日期结构(根据文档)。

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"
    }
]

请注意, $ SchemaOrg_Number 被识别,五十被正确解析为 50,但是根据文档文档json参数中没有填充int_value。

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积极地解析这些复杂类型,并记录了应将其返回,因此我不想自己解析它们。是否有任何想法会很快解决?

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?

推荐答案

Actions SDK不支持NLU进行操作。您必须使用自己的NLU。如果您没有自己的NLU,建议您使用API​​.AI。

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.

这篇关于如何在Google Actions SDK中获取正确类型的参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 17:04