Upload
amazon-web-services
View
41
Download
2
Embed Size (px)
Citation preview
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
January 2017
Creating IoT Solutions with Serverless Architecture & Alexa
John Chang (張書源 )Technology Evangelist
Today’s agenda• Skill building fundamentals• Voice User-Interface• Alexa skill building
70s 80s 90s 00s Present
mode
GUI
web
mobile
character
VUI
Skill Building Fundamentals
Before we code1. developer.amazon.com2. aws.amazon.com
7
The Alexa Service
Alexa Skills Kit
Alexa Voice
Services
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
8
Alexa Skills Kit: Processing a request
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Audio
Request
Response
Your service
Speech RecognitionMachine Learning
Natural Language Understanding
Text to Speech
Cards
9© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Cards
Alexa Skills Kit: Utterances and Intents
Response
Your service
Audio
Speech RecognitionMachine Learning
Natural Language Understanding
Text to Speech
RequestIntents
Utterances
ASR – Automatic Speech Recognition
for tē tīmz
• Forty Times?
• For Tea Times?
• For Tee Times?
• Four Tee Times?
Alexa, ask Anime Facts for a factwake word utteranceskill namelaunch
Utterances and Intents
One more pleaseutterance
Utterances and Intents
Alexa, ask Anime Facts for a factwake word utteranceskill namelaunch
GetFactIntentIntent
utterance slot value
Utterances and Intents
One more pleaseutterance
Alexa, ask Anime Facts for a factwake word utteranceskill namelaunch
14
Building an Alexa SkillHosted service• You define interactions for your
Voice App through intent schemas• Each intent consists of two fields:
• The intent field gives the name of the intent
• The slots field lists the slots associated with that intent
• Slots can also included types such as LITERAL, NUMBER, DATE, etc.
15
Building an Alexa SkillHosted service• The mappings between intents and
the typical utterances that invoke those intents are provided in a tab-separated text document of sample utterances.
• Each possible phrase is assigned to one of the defined intents.
• GetHoroscope what is the horoscope for {pisces|Sign}
• GetHoroscope what will the horoscope for {leo|Sign} be {next tuesday|Date}
16© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Audio
Speech RecognitionMachine Learning
Natural Language Understanding
Text to Speech
Cards
Alexa Skills Kit: Requests and Responses
Request
Response
Your service
17
18
Handling Amazon Alexa serviceRequests• You need to handle POST requests to
your service over port 443 and parse the JSON
• You need to check the session variable to see if the user started a new session or if request is from existing one
• Requests always Include a type, requestId and timestamp
• requestId maps directly to LaunchRequest, IntentRequest and SessionEndedRequest
19
Alexa Skills Kit: Request and Response
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
“Help”
20
Using Lambda for Processing the Request & generating the response
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
21
Demo
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AnswerIntent {value: “one”}slot valueIntent
one is the answerslot value
Slots in the utterances
The answer is oneslot value
oneslot value
23
Utterances and Intent Schema
Utterances Intent Schema
24
Utterances and Intent Schema
Utterances Intent Schema
25
Built-in and Custom Slot Types
26© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Session Attributes
27
Session Persistence
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
exports.handler = function (event, context, callback) { var alexa = Alexa.handler(event, context); alexa.appId = appId; alexa.dynamoDBTableName = 'YourTableName'; //
That's it! alexa.registerHandlers(State1Handlers, State2Handlers);
alexa.execute(); };
this.attributes['yourAttribute'] = 'value';
var yourVariable = this.attributes['yourAttribute']
Add dynamoDB table name in your index.js
put
get
Thank you!