2

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

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

然后我在模拟器中输入“在我的行动中说明天”,我收到以下参数:

"arguments": [
    {
        "name": "mydate",
        "raw_text": "tomorrow",
        "text_value": "tomorrow"
    },
    {
        "name": "trigger_query",
        "raw_text": "say tomorrow",
        "text_value": "say tomorrow"
    }
]

请注意,动作 SDK 正确地将“明天”识别为类型“ $SchemaOrg_Date”并将其绑定到 mydate 变量,但是,它没有按照文档中的规定在返回 json 中返回“date_value”元素。我本来希望“date_value”元素包含一个解析的日期结构(每个文档)。

数字也是如此,尽管它们的行为略有不同。例如,如果我使用短语“在我的行动中说五十”,我将收到以下参数:

"arguments": [
    {
        "name": "mynumber",
        "raw_text": "50",
        "text_value": "50"
    },
    {
        "name": "trigger_query",
        "raw_text": "say fifty",
        "text_value": "say fifty"
    }
]

请注意,$SchemaOrg_Number已识别并且“五十”被正确解析为“50”,但 int_value 并未根据文档填充到参数 json 中。

谷歌正在积极解析这些复杂类型,并记录了它们应该被返回,所以我不想自己去解析它们。关于这是否会很快得到解决的任何想法?

4

1 回答 1

1

动作 SDK 不支持动作的 NLU。你必须使用自己的 NLU。如果您没有自己的 NLU,我们建议使用 API.AI。

于 2017-01-26T22:53:45.497 回答