2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Alexa で日付を拾おうとしたらbuilt-in slot のAMAZON.DATEが全然ISO-8601フォーマットじゃなかった件

Last updated at Posted at 2017-04-29

Amazon公式のリファレンス
https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/built-in-intent-ref/slot-type-reference

こちらには、かなり堂々と、AMAZON.DATEについて
「Converts words that indicate dates (“today”, “tomorrow”, or “july”)
into a date format (such as “2015-07-00T9”).」と書いてあるのですが。。

これはつまり、AlexaでCustum skillを作り、Intentをこさえて、
Slot TypeにAMAZON.DATE型を指定したら、Slot.valueから拾い上げたパラメタは、
「August eighteenth」と言ったら「2017-08-18T9」のように変換されているはずだし、
「Tomorrow」と言ったら「2017-04-29T9」のようになってるはず。

とゆーことを説明してるにもかかわらず、
Lambdaのテストイベントでリクエストすると、
以下のように「tomorrow」がそのまま帰ってきてしまうのです。

・入力

AlexaIntent-recipeを改変
  "version": "1.0",
  "request": {
    "locale": "en-US",
    "timestamp": "2016-10-27T21:06:28Z",
    "type": "IntentRequest",
    "requestId": "amzn1.echo-api.request.[unique-value-here]",
    "intent": {
      "slots": {
        "birthday": {
          "name": "birthday",
          "value": "tomorrow"
        }
      },
      "name": "BirthdayToSign"
    }
  },

・出力

2017-04-29T10:58:23.294Z	c3791e0d-2cca-11e7-9d33-23aa71b078c7	L.103 myBirthday=tomorrow

なんなんだー(^^;)
困ったなぁ。。。

あっ、Lambda上のテストだからかな?

Qiitaに書いたら一瞬で自己解決する効果を狙ってエントリを書きました。
Stack over flowで解決策を探そうと思います。。


Alexaを通したら解決!

(3分後)

echoにしゃべりかけて、Alexaシステムを経由したらちゃんと
「Tomorrow」=「April thirtieth 2017」と変換してくれました。

lambda上のテストはこの変換がなされないということで、覚えておこうと思います。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?