0
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 Skills Kit SDK] slot や intent についての簡単なまとめ

Posted at

今の発話がどのインテントであるかという判断は、アレクサ側でやってくれる。
こっちは、インテントとサンプル発話を用意するだけでいい。
アレクサ側で音声認識をし、それを文字に起こし、どのインテントに当てはまりそうかをサンプル発話を参考に判定する。

例:
HungryIntentというインテントを用意。
サンプル発話は「お腹がすいた」

アレクサのデベロッパーコンソールのテストでスキルを起動し「お腹がすいた」と発話すると、以下の情報がバックエンドに送られる。↓

IntentRequestであるかつ、intentの名前はHungryIntentである」という情報。

"request": {
    "type": "IntentRequest",
    "requestId": "リクエストのID",
    "timestamp": "タイムスタンプ",
    "locale": "ja-JP",
    "intent": {
        "name": "HungryIntent",
        "confirmationStatus": "NONE"
    },
    "dialogState": "STARTED"
}

バックエンドは、インテントの名前を受け取り、HungryIntentHandlerの処理を行う。

class HungryIntentHandler(AbstractRequestHandler):
    def can_handle(self, handler_input):
        return is_intent_name("HungryIntent")(handler_input)
    
    def handle(self, handler_input):
        handler_input.response_builder.speak('わかる').ask('わかるよ')
        return handler_input.response_builder.response

この場合、アレクサが「わかる」と言ってくれる。

0
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
0
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?