56. Lex Endpoints/API
Service Region URL
Model building
service
US East
(N.Virginia)
https://models.lex.us-east-1.amazonaws.com
Runtime
service
US East
(N.Virginia)
https://runtime.lex.us-east-1.amazonaws.com
62. Lex AWS mobile SDK for iOS
http://dev.classmethod.jp/smartphone/amazon-lex-ios-sdk/
1. pod install
2. マイク利⽤許可(info.plist)
3. CognitoによるIdentity発⾏とLexの初期化
4. AWSLexVoiceBottn
63. Lex AWS mobile SDK for iOS
source
'https://github.com/CocoaPods/Specs.git’
target 'BotSampleApp' do
platform :ios, '9.0’
use_frameworks!
pod 'AWSLex’
pod 'AWSCognito’
end
64. Lex AWS mobile SDK for iOS
<key>NSMicrophoneUsageDescription</key>
<string>For interaction with Amazon Lex</string>
65. Lex AWS mobile SDK for iOS
let poolId = "us-east-1:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx"
let credentialsProvider = AWSCognitoCredentialsProvider(regionType:.USEast1,identityPoolId:poolId)
let configuration = AWSServiceConfiguration(region:.USEast1, credentialsProvider:credentialsProvider)
AWSServiceManager.default().defaultServiceConfiguration = configuration
let BotName = “LexSample"
let BotAlias = “$LATEST"
let chatConfig = AWSLexInteractionKitConfig.defaultInteractionKitConfig(withBotName: BotName, botAlias: BotAlias)
AWSLexInteractionKit.register(with: configuration!, interactionKitConfiguration: chatConfig, forKey: "AWSLexVoiceButton")
AWSLexInteractionKit.register(with: configuration!, interactionKitConfiguration: chatConfig, forKey: "chatConfig")
cognito
Lex
82. Lex SessionAttribute
{
"currentIntent": {
"name": "intent-name",
"slots": {"slot-name": "value",},
"confirmationStatus": "None, Confirmed, or Denied (intent confirmation, if configured)",
},
"bot": {
"name": "bot-name",
"alias": "bot-alias",
"version": "bot-version"
},
"userId": "User ID specified in the POST request to Amazon Lex.",
"inputTranscript": "Text used to process the request",
"invocationSource": "FulfillmentCodeHook or DialogCodeHook",
"outputDialogMode": "Text or Voice, based on ContentType request header in runtime API request",
"sessionAttributes": {
"key1": "value1",
"key2": "value2"
}
}
Lambda Input
sessionAttribute
http://docs.aws.amazon.com/ja_jp/lex/latest/dg/lambda-input-response-format.html
91. Polly AWS mobile SMD
source
'https://github.com/CocoaPods/Specs.git’
target 'BotSampleApp' do
platform :ios, '9.0’
use_frameworks!
pod 'AWSPolly’
pod 'AWSCognito’
end
92. Polly AWS mobile SMD
let input = AWSPollySynthesizeSpeechURLBuilderRequest()
input.text = textView.text
input.outputFormat = AWSPollyOutputFormat.mp3
input.voiceId = AWSPollyVoiceId.joanna
let builder = AWSPollySynthesizeSpeechURLBuilder.default().getPreSignedURL(input)
builder.continueOnSuccessWith { (awsTask: AWSTask<NSURL>) -> Any? in
let url = awsTask.result!
self.audioPlayer.replaceCurrentItem(with: AVPlayerItem(url: url as URL))
self.audioPlayer.play()
return nil
}
http://dev.classmethod.jp/smartphone/amazon-polly-sdk/
AWSPollySynthesizeSpeechURLBuilderRequest
テキスト
声の種類
AVFoundation.AudioPlayer