跳到主要內容

發表文章

目前顯示的是有「alexa」標籤的文章

使用ask cli 指令快速建立alexa skill, Part II(更新language model)

前面的章節我們學到了使用ask cli來建立快速skill, 接下來要做的事就是定義我們的language model 基本上, Amazon 提供了非常好用的UI讓我們在上面建立語意模型 所以若要定義或修改模型的話 建議可以先在amazon的網頁上做好, 然後再同步回本地端 假設本機上skill的資料夾結構如下: /lambda /models     /en-US.json skill.json 我們可以在models的資料夾底下找到語意模型 en-US.json 接下來, 使用ask cli 的 get-model 將資料同步到本機 /models/en-US.json ask api get-model --skill-id skil123478 --local en-US --stage development > models/en-US.json 然後部屬 ask deploy 但如果你的模型沒有很複雜的話, 也是可以在本底端修改, 然後再上傳

How to send a MP3 sound to Alexa with SSML

Alexa Skills Kit provides Synthesis Markup Language(SSML) to enhance the Alexa speech output. It's very convenient to make Alexa say something we expect. In some case, you may want response an MP3 sound to Alexa, how could we do that? This article focuses on how to implement the <audio> tag to play an MP3 file. Converting Audio Files to an Alexa-Friendly Format. Download FFmpeg Convert your file via below command ffmpeg -i <input-file> -ac 2 -codec:a libmp3lame -b:a 48k -ar 16000 <output-file.mp3> Hosting the Audio Files for Skills You can store your files on Amazon S3, and make them public. Or using Azure Media Service. The following steps show how to host audio files on Azure Media Service  Create Media Service resource Upload the audio files           Search "Assets" on Media Service, and click upload to add your files Publish your file and save your URL Add <audio> Tag In Your Resp...

使用ask cli 指令快速建立alexa skill, Part I

先前有寫過Skill的朋友一定知道, 如果要開發一個Alexa Skill, 我們必須先登陸Amazon 的帳號, 然後再到Alexa Developer Console建立Skill, 除了填寫Skill的相關資訊之外, 還需要定義 Language Model, 最後綁定我們的Lambda 服務 ... 一整個做下來, 在還沒開發程式就已經耗了30-40分鐘了, 尤其日後想要修改Language Model的話, 我們還需要重新登錄Alexa Developer Console, 找到我們先前定義的Skill, 然後補上新的Intent, Utterance, 或是Slot 現在, 以上的動作通通可以自動化, 因為Amazaon 提供 ASK-CLI 的工具, 讓我們可以在本機端使用它的指令來存取Skill, 包含下載上傳Skill 或是對應的Lambda 程式碼 以下介紹如何使用ASK-CLI Prerequisite: 須設定完aws-cli Step 1. 安裝 ask cli > sudo npm install -g ask-cli Step 2. 設定使用者資料 ask init --no-browser 建立資料並連結你的AWS使用者資料 此時會獲得一組Url 我們必須打開瀏覽器貼上這組Url做認證 再將回傳的認證碼傳回給ask cli 以上動作完成後就可以來建立 Skill ~  Step 3. 建立skill > ask new --template Trivia --skill-name hello-world --lambda-name hello-world-lambda --template Trivia 是指使用現成的範例來修改 目前支援的範例有: How To Pet Match Quiz Game Team Lookup Trivia City Guide Decision Tree Fact Feed High Low Game !如果無法成功直行這個指令地話 可以試試底下方法, 直接指定範例的來源 > ask new --url https://github.com...

Failed to account linking with amazon

The redirect URI you provided has been whitelisted for your application. If you see above error message, it means you have to go to amazon develop console and edit your security profile for redirect URL. Step 1. Copy redirect Redirect URLs on Alexa skill configuration page Step 2. Go to the web setting of your security profile and add these Redirect URLs you just copied to "Allowed Return URLs"

Alexa skill, how to deal with missing slot

When we create an alexa skill, we have to specify intent, utterance, and slot(optional).These are called interaction model in alexa skill interface. For example, if we create a skill that provides information of repair center, we can define the interaction model like this: {    "intents":[            "name" : GetRepairCenter,             "samples":  where is the repair center in New York             "slots": [                              {                                  "name": "location",    ...