Gracias por tu visita. Esta página solo está disponible en inglés.
Alexa Blogs Alexa Developer Blogs /blogs/alexa/feed/entries/atom 2019-06-15T03:05:59+00:00 Apache Roller /blogs/alexa/post/173b7c30-dcd4-483b-a4b1-8c7d798546a7/what-s-new-in-the-alexa-skills-kit-may-2019-release-roundup What's New in the Alexa Skills Kit: May 2019 Release Roundup Leo Ohannesian 2019-06-15T03:05:59+00:00 2019-06-15T03:05:59+00:00 <p><img alt="Intent-history_blog.png" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/default/Intent-history_blog.png._CB460678784_.png?t=true" /></p> <p>What's new in the Alexa Skills Kit for May 2019? Read our release roundup blog to find out.</p> <p><em><strong>Editor's Note: </strong>Our monthly release roundup series showcases the latest in Alexa Skills Kit developer tools and features that can make your skills easier to manage, simpler to deploy, and more engaging for your customers. Build with these new capabilities to enable your Alexa skills to drive brand or revenue objectives.</em></p> <p>In this roundup post we share details about the new things released for skill developers last month, including the release of the Spanish voice model for the US&nbsp;and several other features&nbsp;that can help make you be more productive or build more engaging skills. Check out the entire livestream for more information from Alexa evangelists and code samples.</p> <p><iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/EWXV6k4EmEo" width="560"></iframe></p> <h2>1. Alexa Skills Kit expands to include Spanish in the US</h2> <p>Now you can create Spanish-speaking skills for US customers with the new Spanish-for-US voice model. Skills that you publish now using the new voice model will be available to customers when Alexa launches with Spanish language support in the US later this year. <a href="https://developer.amazon.com/blogs/alexa/post/3c0adda8-3733-4083-9378-e63903f3e993/alexa-skills-kit-expands-to-include-spanish-in-the-us?&amp;sc_category=Owned&amp;sc_channel=BG&amp;sc_campaign=roundup&amp;sc_content_category=Int&amp;sc_country=WW" target="_blank">Check out the announcement here</a> or <a href="https://developer.amazon.com/fr/blogs/alexa/post/3cea1fe4-0f94-4ea7-948e-0b647018cb6c/how-to-update-your-alexa-skills-for-us-spanish?&amp;sc_category=Owned&amp;sc_channel=BG&amp;sc_campaign=roundup&amp;sc_content_category=Int&amp;sc_country=WW" target="_blank">read about how to update your Alexa skill for US Spanish here.</a></p> <ul> </ul> <h2>2. Enhance the smart home camera experience with person detection</h2> <p>You can use the new Alexa.EventDetectionSensor interface in the Smart Home Skill API to tell Alexa when your smart home camera detects the presence of a person. Once you’ve implemented the capability, customers can use person detection as a trigger for other actions, such as turning on the house lights. You can also enable customers to view the last person detected by saying, “Alexa, show the most recent person detected at the front door.” The new capability is available in the US today. <a href="https://developer.amazon.com/docs/device-apis/alexa-eventdetectionsensor.html?&amp;sc_category=Owned&amp;sc_channel=BG&amp;sc_campaign=roundup&amp;sc_content_category=SH&amp;sc_country=WW" target="_blank">Read about it in our docs</a>.&nbsp;</p> <h2>3. Quickly test your voice UI with SMAPI quick builds</h2> <p>Save time and start testing early: We are excited to announce the launch of quick builds, which enable you to start testing your skill with sample utterances on average 67% quicker than before. This is done by introducing a new intermediate build state called Quick Build through SMAPI or the ASK CLI. Read about <a href="https://developer.amazon.com/docs/custom-skills/create-the-interaction-model-for-your-skill.html?&amp;sc_category=Owned&amp;sc_channel=BG&amp;sc_campaign=roundup&amp;sc_content_category=Productivity&amp;sc_country=WW#build-and-save" target="_blank">building your model</a> and <a href="https://developer.amazon.com/docs/smapi/skill-operations.html?&amp;sc_category=Owned&amp;sc_channel=BG&amp;sc_campaign=roundup&amp;sc_content_category=Productivity&amp;sc_country=WW#get-skill-status" target="_blank">getting your skill status</a> in our docs.&nbsp;</p> <h2>4. Simulate a multi-turn conversation with the ASK CLI</h2> <p>Now available: Test multi-turn conversations using the the CLI, SMAPI,&nbsp;or the ASK plugin for Visual Studio Code.&nbsp;Use this new testing capability to improve your skill conversations and deliver a better customer experience. <a href="https://developer.amazon.com/docs/smapi/ask-cli-command-reference.html?&amp;sc_category=Owned&amp;sc_channel=BG&amp;sc_campaign=roundup&amp;sc_content_category=Productivity&amp;sc_country=WW#dialog-command" target="_blank">Learn about simulating a multi-turn conversation in our docs.&nbsp;</a></p> <p>&nbsp;</p> <p>As always, we can't wait to see what you build. As a reminder, learn how to get the most out of the tech docs by visiting the <a href="https://developer.amazon.com/docs/ask-overviews/latest-tips-documentation.html" target="_blank">Latest Tips page.</a></p> /blogs/alexa/post/b7bf617e-31e4-439c-a93e-6f0d09fe7a23/build-premium-experiences-for-kid-skills-in-the-us-preview Build Premium Experiences for Kid Skills in the US (Preview) Metty Fisseha 2019-06-14T17:56:41+00:00 2019-06-14T18:15:55+00:00 <p><img alt="" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/default/blog_kids-isp_954x240.png._CB443646252_.png?t=true" style="height:480px; width:1908px" /></p> <p>As part of this preview, developers can build premium kid skills for the US Alexa Skills Store using in-skill purchasing (ISP).</p> <p><img alt="blog_kids-isp_954x240.png" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/default/blog_kids-isp_954x240.png._CB443646252_.png?t=true" /></p> <p>Alexa developers have already created thousands of kid skills that provide fun and educational experiences for families, such as a skill that <a href="https://www.amazon.com/Gimlet-Media-Chompers/dp/B079WCGTKX/ref=sr_1_1?keywords=B079WCGTKX&amp;qid=1560532142&amp;s=gateway&amp;sr=8-1">encourages kids to brush their teeth</a> and one that <a href="https://www.amazon.com/dp/B078RGPMY6">teaches kids how to run their own lemonade stand</a> business. Today, we are excited to announce a preview of new tools that developers can use to build kid skills with in-skill purchasing (ISP) for the US Alexa Skills Store. With ISP, you can further enrich these kid skill experiences, offering premium content in the form of one-time purchases or subscriptions for families to enjoy across over 100 million Alexa-enabled devices.</p> <p>ISP for kid skills is supported by new tools powered by Alexa, including APIs to help you create premium kid skills, as well as purchase controls that help account holders manage them. If you are interested in building a kid skill with ISP, fill out <a href="https://alexa.design/kid-survey">this form</a> telling us about your use case and we will notify you if your application has been selected.</p> <h2><a></a><a>How It Works: Purchasing Controls for Premium Kid Skills</a></h2> <p>By default, when a customer is offered premium content in a kid skill and agrees to purchase, the account holder will receive an SMS or email requesting they approve or decline the transaction within 24 hours. If approved, the purchase will be completed, and the customer will have access to the premium content. If declined, the purchase will not be completed, and the customer will have access only to the skill’s free content. If the purchase request is neither approved nor declined within 24 hours, the request is canceled.&nbsp; Account holders who want to allow purchases to be made in kid skills but do not wish to receive these approval requests can disable them in the Alexa app, allowing purchases to be made in kid skills without the request for approval.</p> <p>Customers can opt out from voice purchasing in kid skills, which will disable voice discovery of premium content in kid skills, by disabling the feature in the Alexa app. To manage these settings, open the Alexa App and navigate to Settings -&gt; Alexa Account -&gt; Voice Purchasing -&gt; Kid Skills Purchasing.</p> <h2><a></a><a>Amazon FreeTime and Amazon FreeTime Unlimited Offer a Curated Skill Experience</a></h2> <p>FreeTime on Alexa customers will not receive offers to purchase premium content within skills. And for FreeTime Unlimited subscribers, many of these premium experiences will already be available automatically as part of their subscription at no additional cost. See <a href="https://www.amazon.com/b?ie=UTF8&amp;node=17738015011">here</a> for a full list of premium kid skills included in the FreeTime Unlimited experience.</p> <p>If you have a kid skill that offers a best-in-class customer experience, and think it could be eligible to be included in FreeTime Unlimited, send an email to <a href="mailto:freetime-skills@amazon.com">freetime-skills@amazon.com</a> for consideration.</p> <h2><a></a><a>New Tools for Building a Premium Kids Skill</a></h2> <p>As part of this preview, you can build a premium kid skill using the tools that currently exist: the <a href="https://www.youtube.com/watch?v=JuGBomjSt90">Alexa Skills Kit Command-Line Interface (ASK CLI)</a> to write your own code, or the <a href="https://developer.amazon.com/blogs/alexa/post/8019524b-6a98-4b7e-9995-c5d583696905/add-in-skill-purchasing-directly-from-the-alexa-developer-console">Alexa Developer Console</a> to click through step-by-step instructions. However, we have built three new tools for kid skills specifically, to help you implement a thoughtful premium experience that is tailored to the controls set by the account holder:</p> <ul> <li>An extension to the current getInSkillProducts API to see if a product is PURCHASABLE, whether the account holder approved the purchase, or NOT_PURCHASABLE, pending authorization OR rejected three times in the past 30 days, which will suppress offers for that product over the next 30 days.</li> <li>A new inSKillProductsTransactions endpoint for transaction-level information, including when the request went into PENDING status and if a previous purchase request was denied. This endpoint is available only for kid skills.</li> <li>A new endpoint to get the purchase control setting for an account, to determine if the account holder has ENABLED or DISABLED voice purchasing for kids skills.</li> </ul> <p><em>Note that you must use the upsell API for when adding ISP to kid skills. Consumable products and Amazon Pay for Alexa Skills are not available for kid skills at this time. </em></p> <h2><a></a><a>Premium Kid Skill Experiences Available Today</a></h2> <p>Developers have already implemented ISP in their kid skills across a variety of fun and educational experiences, including:</p> <p><a href="https://www.amazon.com/dp/B078H9R4P3"><strong>Kids Court (Pretzel Labs)</strong></a>:<strong> </strong>This skill teaches kids about the judicial system by allowing them to take their naughty friends, siblings or parents to Kids Court for a ruling from the Honorable Judge Lexy. Customers will learn how to articulate themselves clearly while presenting their case to Judge Lexy. Customers can play the judge in other kids’ trials once a day for free, or purchase the Supreme Court premium pack, which allows them to take as many cases as they want to judge.</p> <p><strong><a href="https://smile.amazon.com/gp/product/B07L1N278F">You Choose Superman Adventures (Capstone)</a></strong>: This skill entertains kids with an action-packed, interactive adventure with America’s favorite super hero, Superman. Customers will help Superman protect the citizens of Earth and Metropolis, and defeat the evil plans of the most cunning and powerful super-villains. Customers get the first story, Metropolis Mayhem, for free and then can purchase additional stories including Apokolips Invasion, Metallo Attacks!, and Superman Day Disaster.</p> <p><strong><a href="https://www.amazon.com/Universatile-Travel-Quest/dp/B078WPHCLT/">Travel Quest (Universatile)</a></strong>: This skill delights kids by taking them on a tour around the world, stopping at various countries and teaching them about the culture, history and landmarks. Each country includes ten destinations, 20 questions and 20 fun facts sure to provide hours of entertainment and education. Customers can access 6 countries for free, or can purchase additional themed country packs, such as the “Mediterranean Cruise Pack”, which provide more countries to travel to and learn about.</p> <p><a href="https://www.amazon.com/gp/product/B07HK3XHSW"><strong>Animal Sounds (LC Publishing)</strong></a>: This skill takes kids on a journey across the seven continents and into the vast oceans to learn about animals of different shapes and sizes. All customers will hear the animal sounds, while customers with a screen-enabled device are able to see the animals they’re learning about. Customers can access the continental pack for free, which contains some animal sounds to choose from, or can purchase the mega pack, which grants access to all of the continents plus an Oceanic pack of additional unique sounds. The mega pack also enables customers to use their Echo Buttons to request a new animal sound.</p> <p><strong><a href="https://www.amazon.com/dp/B07KPPMFVN">Master Swords (Touchpress)</a></strong>: This skill teaches kids how to spell through a fun, captivating game. The mission is to retrieve their Uncle’s stolen swords from grubby gremlins, hideous orcs, wicked tongued witches and a number of other fantastical creatures by using words as their weapon. As kids spell words correctly, they advance to higher levels and get closer to retrieving the swords. Customers can access the first kingdom and one sword for free, or can purchase the premium experience which allows them to access four kingdoms with the opportunity to collect up to seven swords across 1,000+ words to spell.</p> <p>We encourage you to engage with these premium kid skills to get a sense of how different developers are building delightful premium experiences for the family. In addition to the above skills, which are live today, we will soon be launching premium kid skills from names that families know and love such as Ghostbusters (Sony) and more. Stay tuned to the <a href="https://www.amazon.com/alexa-skills/b?ie=UTF8&amp;node=13727921011">Alexa Skill Store</a> for updates on these skill launches.</p> <h2><a></a><a>Learn More and Apply for the ISP for Kid Skills Preview</a></h2> <p>Check out the resources below to learn more about how to build premium kids skills. You can also apply to participate in the ISP for kid skills preview, by filling out a short form <a href="https://alexa.design/kid-survey">here</a>. We will notify you if your application is selected.</p> <ul> <li><a href="https://www.youtube.com/watch?v=ShkSbRM-1BQ&amp;feature=youtu.be">Webinar: How to Build Engaging Kid Skills for Alexa</a></li> <li><a href="https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/guide/BuildingStellarKidSkills_asV1?aliId=eyJpIjoieGxTanZQc1wva3NZUDRYaTciLCJ0IjoiVTBBaXBFXC9EVmdVZlwvN3VVeEFnUGR3PT0ifQ%253D%253D">Guide: 6 Tips for Building Stellar Kid Skills</a></li> <li><a href="https://developer.amazon.com/de/blogs/alexa/post/38e7a87d-2ba2-465a-b038-65ac9576027d/10-more-tips-for-building-stellar-alexa-skills-for-kids">Blog: 10 More Tips for Building Stellar Alexa Skills for Kids</a></li> <li><a href="https://developer.amazon.com/blogs/alexa/post/7ffad993-15bf-42b2-9ffb-4e82a5d7cebe/kid-skills-alexa-skills-certification">Blog: Certification Tips for Alexa Kid Skills</a></li> <li><a href="https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/design-assets/ASKMakeMoneyGuide20190325.pdf?aliId=eyJpIjoiSkVvVlFieUpyMjFxY25XMSIsInQiOiJ4U1RleXZSWlNjZHJqXC9UY3lnQUNGUT09In0%253D">Guide: Make Money with Your Alexa Skills</a></li> <li><a href="https://developer.amazon.com/blogs/alexa/post/8019524b-6a98-4b7e-9995-c5d583696905/add-in-skill-purchasing-directly-from-the-alexa-developer-console">Blog: Add In-Skill Purchasing (ISP) Directly from the Alexa Developer Console</a></li> </ul> /blogs/alexa/post/184e2a15-6929-4528-b9d1-0880da6379f1/troubleshoot-skills-beta-testing ベータテストの実施にあたってよく見られる問題 Nahoko Hirabayashi 2019-06-14T07:49:50+00:00 2019-06-14T08:22:59+00:00 <p>Alexaスキルのベータテストツールとは、本番環境にリリースする前にスキルをベータ版としてテストするために使用するツールです。今回は、ベータテストの管理者がスキルのテスト実施者(ベータテスター)にテストの実施を依頼する際によくみられる問題2例と解決策をご紹介します。</p> <p>Alexaスキルのベータテスト機能とは、本番環境にリリースする前にスキルをベータ版としてテストするために使用するツールです。ベータテストの管理者は、他のユーザーを招待してスキルをテストしてもらい、フィードバックを受け取ることができます。<a href="https://developer.amazon.com/ja/docs/custom-skills/skills-beta-testing-for-alexa-skills.html#set-up-a-beta-test-for-a-skill">ベータテストツールのセットアップ方法</a>はこちらを参照してください。</p> <p>今回は、ベータテストの管理者がスキルのテスト実施者(ベータテスター)にテストの実施を依頼する際によくみられる問題2例と解決策をご紹介します。</p> <p>&nbsp;</p> <h3><strong>ケース</strong>1:&nbsp;&nbsp;<strong>ベータテスターに招待メールが届かない</strong></h3> <p>ベータテストのスキル管理者は、次の点をベータテスターに確認してください。</p> <ul> <li>招待メールが迷惑メールフォルダに入っていないか</li> <li>ベータテストに登録されているEメールアドレスに誤りがないか</li> <li>テストを実施しようとしているAlexa対応デバイスにログインしているアカウントおよびアマゾンのお買い物用のアカウントが、ベータテストに登録されているEメールアドレスと異なっていないか</li> </ul> <p>&nbsp;</p> <p>上記の点に問題がない場合、スキル管理者は以下の手順を試してください。</p> <h4>&lt;解決策1&gt; ベータテスターにリマインダーを送信する</h4> <p>1. <a href="https://developer.amazon.com/ja">開発者コンソール</a>にログイン</p> <p>2. スキル一覧の「ベータテストの管理」欄に移動し、ベータテストを展開表示</p> <p>3. 「リマインダーを送信」をクリック</p> <h4>&lt;解決策2&gt; 管理者のEメールアカウントからベータテスターに招待用URLリンクを送信する</h4> <p>1. <a href="https://developer.amazon.com/ja">開発者コンソール</a> &gt; スキル一覧の「ベータテストの管理」欄に移動</p> <p>2. ベータテストを展開表示</p> <p>3. 招待用URLをコピーし、管理者のEメールアカウントからベータテスターに直接送信</p> <pre> <code>注: 日本語スキルの場合、Webブラウザで招待URLにアクセスすると、USのAlexaアプリにリンクされるので、スマホ版(アプリ名:Amazon Alexa)を使用してください。また、あらかじめ日本のアカウントでAlexaアプリにログインしておかないとUSのAlexaアプリにリンクされてしまうので注意しましょう。</code></pre> <h3>&nbsp;</h3> <h3><strong>ケース</strong>2:&nbsp;&nbsp;<strong>スキルを起動できない</strong></h3> <p>招待メールを受信後、スキルを起動できない場合は、ベータテスターが使用するAlexa対応デバイスの設定言語とスキルの言語モデルが一致しているかを確認してください。</p> <p>スキルを使用するには、Alexa対応デバイスの設定言語とスキルの言語モデルが一致する必要があります。例えば、日本語のAlexaスキルをテストするには、日本語版のAlexa対応デバイス・アカウントでないとテストが実施できません。</p> <p>ベータテスターはAlexaアプリにログインして、ホスト名がalexa.amazon.co.jpと表示されているか確認してください。</p> <p>1. Alexaアプリ <a href="https://alexa.amazon.co.jp/">https://alexa.amazon.co.jp</a> にログイン</p> <p>2. 設定タブをクリック</p> <p>3. 一般&gt;Alexaアプリのバージョンをクリック</p> <p>Alexaアプリにログインできないか、またはドメイン名がalexa.amazon.comと表示されている場合は、USのアカウントが作成されてしまっている可能性があります。詳細は「<a href="https://developer.amazon.com/ja/blogs/alexa/post/9f852a38-3a44-48bd-b78f-22050269d7c7/hamaridokoro">Alexa 開発者アカウント作成時のハマりどころ</a>」を参照してください。</p> <p>&nbsp;</p> <p>今回ご紹介したベータテストツールについての詳細は、技術資料の「<a href="https://developer.amazon.com/ja/docs/custom-skills/skills-beta-testing-for-alexa-skills.html">Alexaスキルのベータテストを行う</a>」でもご確認いただけます。</p> /blogs/alexa/post/32f8381b-1b30-4f42-bbcd-4dfad6605eb5/active-learning-algorithmically-selecting-training-data-to-improve-alexa-s-natural-language-understanding Active Learning: Algorithmically Selecting Training Data to Improve Alexa’s Natural-Language Understanding Larry Hardesty 2019-06-13T13:00:00+00:00 2019-06-13T13:23:05+00:00 <p>New approach to &quot;active learning&quot;, or automatically selecting training examples for machine learning, improves the performance of natural-language-understanding system by 7% to 9%.</p> <p>Alexa’s ability to respond to customer requests is largely the result of machine learning models trained on annotated data. The models are fed sample texts such as “Play the Prince song 1999” or “Play River by Joni Mitchell”. In each text, labels are attached to particular words — SongName for “1999” and “River”, for instance, and ArtistName for Prince and Joni Mitchell. By analyzing annotated data, the system learns to classify unannotated data on its own.</p> <p>Regularly retraining Alexa’s models on new data improves their performance. But annotation is expensive, so we would like to annotate only the most informative training examples — the ones that will yield the greatest reduction in Alexa’s error rate. Selecting those examples automatically is known as <em>active learning</em>.</p> <p>Last week, at the annual&nbsp;meeting of the North American Chapter of the Association for Computational Linguistics (NAACL), we presented a <a href="https://arxiv.org/pdf/1810.03450.pdf" target="_blank">new approach</a> to active learning that, in experiments, improved the accuracy of machine learning models by 7% to 9%, relative to training on randomly selected examples.</p> <p>We compared our technique to four other active-learning strategies and showed gains across the board. Our new approach is 1% to 3.5% better than the best-performing approach previously reported. In addition to extensive testing with previously annotated data (in which the labels were suppressed to simulate unannotated data), we conducted a smaller trial with unlabeled data and human annotators and found that our results held, with improvements of 4% to 9% relative to the baseline machine learning models.</p> <p>The goal of active learning is to canvass as many candidate examples as possible to find those with the most informational value. Consequently, the selection mechanism must be efficient. The classical way to select examples is to use a simple linear classifier, which assigns every word in a sentence a weight. The sum of the weights yields a score, and a score greater than zero indicates that the sentence belongs to a particular category.</p> <p>For instance, if the classifier is trying to determine whether a sentence belongs to the category <em>music</em>, it would probably assign the word “play” a positive weight, because music requests frequently begin with the word “play”. But it might assign the word “video” a negative weight, because that’s a word that frequently denotes the customer’s desire to play a video, and the video category is distinct from the music category.&nbsp;</p> <p>Such weights are learned from training examples. During training, the linear classifier is optimized using a <em>loss function</em>, which measures the distance between its performance and perfect classification of the training data.</p> <p>Typically, in active learning, examples are selected for annotation if they receive scores close to zero — whether positive or negative — which means that they are near the decision boundary of the linear classifier. The hypothesis is that hard-to-classify examples are the ones that a model will profit from most.</p> <p>Researchers have also investigated committee-based methods, in which linear models are learned using several different loss functions. Some loss functions emphasize getting the aggregate statistics right across training examples; others emphasize getting the right binary classification for any given example; still others impose particularly harsh penalties for giving the wrong answer with high confidence; and so on.<br /> <img alt="active_learning.jpg" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/default/active_learning.jpg._CB443745932_.jpg?t=true" style="display:block; height:412px; margin-left:auto; margin-right:auto; width:350px" /></p> <p style="text-align:center"><sub><em>A graph showing how different loss functions (black lines) divide training data in different ways. Easily classified examples (red and green X’s) are less informative than examples that fall closer to classification boundaries (grey X’s).&nbsp;</em></sub></p> <p>Traditional committee-based methods also select low-scoring examples, but they add another criterion: at least one of the models must disagree with the others in its classification. Again, the assumption is that hard-to-classify examples will be the most informative.</p> <p>In our experiments, we explored a variant on the committee-based approach. First, we tried selecting low-scoring examples on which the majority of linear models have scores greater than zero. Because this majority positive filter includes examples with all-positive scores, it yields a larger pool of candidates than the filter that enforces dissent. To select the most informative examples from that pool, we experimented with several different re-ranking strategies.</p> <p>Most importantly, we used a conditional-random-field (CRF) model to do the re-ranking. Where the linear models classify requests only according to domain — such as music, weather, smart home, and so on — the CRF models classify the individual words of the request as belonging to categories such as ArtistName or SongName.&nbsp;</p> <p>If the CRF easily classifies the words of a request, the score increases; if the CRF struggles, the score decreases. (Again, low-scoring requests are preferentially selected for annotation.) Adding the CRF classifier does not significantly reduce the efficiency of the algorithm because we execute the re-ranking only on examples where the majority of models agreed.&nbsp;</p> <p>For re-ranking, we add the committee scores and then take the absolute value of the sum. This permits individual models on the committee to provide high-confidence classifications, so long as strong positive scores are offset by strong negative scores.</p> <p>The committee approaches reported in the literature enforced dissent among the models; interestingly, using the criterion of majority scores greater than zero yielded better results, even without the CRF. With the CRF, however, the error rate shrank by an additional 1% to 2%.</p> <p><em>Stan Peshterliev is a senior applied scientist in the Alexa AI Natural Understanding group.</em></p> <p><a href="https://arxiv.org/pdf/1810.03450.pdf" target="_blank"><strong>Paper</strong></a>: “Active Learning for New Domains in Natural Language Understanding”</p> <p><a href="https://developer.amazon.com/alexa/science" target="_blank"><strong>Alexa science</strong></a></p> <p><strong>Acknowledgments</strong>: John Kearney, Abhyuday Jagannatha, Imre Kiss, Spyros Matsoukas</p> <p><strong>Related</strong>:</p> <ul> <li><a href="https://developer.amazon.com/blogs/alexa/post/9e8392c6-5476-4a34-a2d8-c4e479677954/new-speech-recognition-experiments-demonstrate-how-machine-learning-can-scale" target="_blank">New Speech Recognition Experiments Demonstrate How Machine Learning Can Scale</a></li> <li><a href="https://developer.amazon.com/blogs/alexa/post/e5f41b49-0b4d-4aef-9b90-2bb7f68c0705/to-correct-imbalances-in-training-data-don-t-oversample-cluster" target="_blank">To Correct Imbalances in Training Data, Don’t Oversample: Cluster</a></li> <li><a href="https://developer.amazon.com/blogs/alexa/post/6355a6b0-a27d-4baa-94a3-a7b1d74c0afd/leveraging-unannotated-data-to-bootstrap-new-functions-more-quickly">Leveraging Unannotated Data to Bootstrap Alexa Functions More Quickly</a></li> <li><a href="https://developer.amazon.com/blogs/alexa/post/3ac41587-f262-4fec-be60-2df2f64b9af9/the-role-of-context-in-redefining-human-computer-interaction" target="_blank">The Role of Context in Redefining Human-Computer Interaction</a></li> <li><a href="https://developer.amazon.com/blogs/alexa/post/7dde86fa-0a4f-4984-82d1-7a7d1282fb0c/machine-translation-accelerates-how-alexa-learns-new-languages" target="_blank">Machine Translation Accelerates How Alexa Learns New Languages</a></li> </ul> /blogs/alexa/post/6dd2ece8-7dcb-4380-9b25-193916b00938/how-to-make-an-api-request-from-your-alexa-skill-using-python How to Make an API Request from Your Alexa Skill Using Python Jennifer King 2019-06-12T14:00:00+00:00 2019-06-12T14:00:00+00:00 <p>In this example skill, we look at one of the most popular methods you can use to call an external API through your Alexa skill using the “Requests” library in Python.</p> <p style="margin-left:0in; margin-right:0in">As we <a href="https://developer.amazon.com/alexa/voice-design">design and create Alexa skills</a> with increasing complexity and capabilities, the need arises to have skills interact with remote APIs and web servers. Many services we consume are accessible via an API, such as weather forecasts, geolocation services, Twitter feeds, and so on. At some point, every developer will run into a situation where they’ll need to access data by making HTTP requests to an API. HTTP requests allow you to fetch data from a remote source. It could be an API, a website, or something else.</p> <p style="margin-left:0in; margin-right:0in">Making HTTP requests is a core functionality for modern languages, and when it comes to Python there are a fair amount of solutions to this problem, both built into the language and by the developer community. In this example skill, we look at one of the most popular methods you can use to call an external API through your Alexa skill using the “Requests” library in Python.</p> <h2>Understanding the Voice Interaction</h2> <p style="margin-left:0in; margin-right:0in">To make it simple, we’re going to use a fact skill as our base. In this example, our customers will interact with the skill by asking for a fact about a number. Let’s take a look at a simple interaction between our skill and our customer:</p> <p style="margin-left:30.0pt; margin-right:0in"><strong><em>Customer: </em></strong><em>Alexa, ask number facts to give me a fact about seven.</em></p> <p style="margin-left:30.0pt; margin-right:0in"><strong><em>Alexa:</em></strong><em> Seven is the number of main stars in the constellations of the Big Dipper and Orion.</em></p> <p style="margin-left:0in; margin-right:0in">When our customer says, “give me a fact about seven” the <strong>GetNumberFactIntent</strong> is triggered and the <strong>number</strong> slot is set to ‘7’. Our skill code makes an http get request to <a href="http://numbersapi.com/" target="_blank">numbersapi.com</a> to get a random fact about the number ‘7’. You can test out the API by typing: http://numbersapi.com/7 into your browser.</p> <h2>Understanding the Hard-Coded Facts</h2> <p style="margin-left:0in; margin-right:0in">When we first built our number facts skill, we hardcoded our facts straight into the code. Let’s take a moment to understand how the code works before we update our code to get the facts from <a href="http://numbersapi.com/" target="_blank">numbersapi.com.</a></p> <p style="margin-left:0in; margin-right:0in">First, we defined an object called <strong>number_facts</strong>. It functions as a lookup table. Take a moment to look through the table:</p> <pre> <code>number_facts = { &quot;1&quot;: &quot;is the number of moons orbiting the earth.&quot;, &quot;2&quot;: &quot;is the number of stars in a binary star system (a stellar system consisting of two stars orbiting around their center of mass).&quot;, &quot;3&quot;: &quot;is the number of consecutive successful attempts in a hat trick in sports.&quot;, &quot;4&quot;: &quot;is the number of movements in a symphony.&quot;, &quot;5&quot;: &quot;is the number of basic tastes (sweet, salty, sour, bitter, and umami).&quot;, &quot;6&quot;: &quot;is the number of fundamental flight instruments lumped together on a cockpit display.&quot;, &quot;7&quot;: &quot;is the number of main stars in the constellations of the Big Dipper and Orion.&quot;, &quot;8&quot;: &quot;is the number of bits in a byte.&quot;, &quot;9&quot;: &quot;is the number of innings in a regulation, non-tied game of baseball.&quot;, &quot;10&quot;: &quot;is the number of hydrogen atoms in butane, a hydrocarbon.&quot;, &quot;11&quot;: &quot;is the number of players in a football team.&quot; }</code></pre> <p style="margin-left:0in; margin-right:0in">If our customer asked for a fact about ‘7’, we can pass it to <strong>number_facts</strong> to get the fact. The code to do that would look like:</p> <pre> <code>number_facts[&quot;7&quot;]</code></pre> <p style="margin-left:0in; margin-right:0in">Since we don’t want to hardcode the number 7, let’s take a look at how we’d look up the fact for our number slot.</p> <pre> <code>the_number = handlerInput.requestEnvelope.request.intent.slots.number.value the_fact = number_facts[the_number]</code></pre> <p style="margin-left:0in; margin-right:0in">Below is the sample code for GetNumberFactHandler before we make any updates:</p> <pre> <code>class GetNumberFactHandler(AbstractRequestHandler): &quot;&quot;&quot;Handler for get number fact intent.&quot;&quot;&quot; def can_handle(self, handler_input): # type: (HandlerInput) -&gt; bool return (is_request_type(&quot;LaunchRequest&quot;)(handler_input) or is_intent_name(&quot;GetNumberFactIntent&quot;)(handler_input)) def handle(self, handler_input): # type: (HandlerInput) -&gt; Response logger.info(&quot;In GetNumberFactHandler&quot;) # to enable randint, add &quot;from random import randint&quot; at start of file the_number = None if is_request_type(&quot;IntentRequest&quot;)(handler_input): the_number = handler_input.request_envelope.request.intent.slots[&quot;number&quot;].value if the_number is None: the_number = str(randint(1,11)) the_fact = the_number + &quot; &quot; + number_facts[the_number] speech = the_number + &quot; &quot; + the_fact + &quot; Would you like to hear another fact?&quot; handler_input.response_builder.speak(speech).ask(speech) return handler_input.response_builder.response</code></pre> <p style="margin-left:0in; margin-right:0in">We simply access the <strong>number</strong> slot and look up the fact using the <strong>number_facts</strong> object and then have our skill tell the user the fact by returning a response using the <strong>response_builder</strong>.</p> <h2>Using the “Requests” Library</h2> <p>Now that we understand the basics of this fact skill, let’s look at how to access information outside of our skill, by using the requests library to access facts from <a href="http://numbersapi.com/" target="_blank">numbersapi.com</a></p> <p style="margin-left:0in; margin-right:0in">The requests library is the de facto standard for making HTTP requests in Python. It abstracts the complexities of making requests behind a beautiful, simple API so that you can focus on utilizing data and interacting with services in your skill.</p> <p style="margin-left:0in; margin-right:0in">Let’s see how we’ve modified the code to use the “requests” library to call our API.</p> <p style="margin-left:0in; margin-right:0in"><strong>Step 1: Included the requests library in our skill using the import statement.</strong></p> <pre> <code> import requests</code></pre> <p style="margin-left:0in; margin-right:0in"><strong>Step 2: Call the requests.get method from within your intent(GetNumberFactIntent) to send a query (number requested by the user) to the API, and respond back with the result.</strong></p> <pre> <code>class GetNumberFactHandler(AbstractRequestHandler): &quot;&quot;&quot;Handler for get number fact intent.&quot;&quot;&quot; def can_handle(self, handler_input): # type: (HandlerInput) -&gt; bool return (is_request_type(&quot;LaunchRequest&quot;)(handler_input) or is_intent_name(&quot;GetNumberFactIntent&quot;)(handler_input)) def handle(self, handler_input): # type: (HandlerInput) -&gt; Response logger.info(&quot;In GetNumberFactHandler&quot;) the_number = None if is_request_type(&quot;IntentRequest&quot;)(handler_input): the_number = handler_input.request_envelope.request.intent.slots[&quot;number&quot;].value if the_number is None: the_number = str(randint(1,11)) url = &quot;http://numbersapi.com/&quot; + the_number response = requests.get(url) if response.status_code == 200: the_fact = response.text else: the_fact = &quot;I had trouble getting a fact about &quot; + the_number + &quot;.&quot;; speech = the_fact + &quot; Would you like to hear another fact?&quot; handler_input.response_builder.speak(speech).ask(speech) return handler_input.response_builder.response </code></pre> <p style="margin-left:0in; margin-right:0in">As you can see, the “requests” module makes it super simple for us to call our API. All we had to do was specify the URL for the API to be called, and the response is made available to us inside the text property, which we can then use as part of our response. If the response is JSON, you can use the json property instead.</p> <p style="margin-left:0in; margin-right:0in">Whenever calling an API you will want to include error checking. I chose to check the response code to ensure it was a success code (200). You might choose to use a try-except block.</p> <p style="margin-left:0in; margin-right:0in">If you didn’t edit your skill code in the Lambda console, the next step would be to zip up your lambda_function.py file along with other modules to create a deployment package and upload it to your Lambda function. To learn more about how to do that, read <a href="https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html" target="_blank">AWS Lambda Deployment Package in Python</a>.</p> <div style="border-bottom:none windowtext 1.0pt; padding:0in 0in 3.0pt 0in"> <h2>More Resources</h2> <ul> <li><a href="https://developer.amazon.com/post/Tx1UE9W1NQ0GYII/Publishing-Your-Skill-Code-to-Lambda-via-the-Command-Line-Interface">Publishing Your Skill Code to Lambda via the Command Line Interface</a></li> <li><a href="https://developer.amazon.com/docs/smapi/quick-start-alexa-skills-kit-command-line-interface.html">Quick Start Alexa Skills Kit Command Line Interface (ASK CLI)</a></li> <li><a href="https://github.com/alexa/alexa-skills-kit-sdk-for-python">Alexa Skills Kit SDK for Python</a></li> <li><a href="https://aws.amazon.com/sdk-for-python/" target="_blank">AWS SDK for Python</a></li> <li><a href="https://www.npmjs.com/package/request">Requests Library for Python</a></li> <li><a href="https://developer.amazon.com/docs/custom-skills/send-the-user-a-progressive-response.html">Send the User a Progressive Response</a></li> <li><a href="https://developer.amazon.com/blogs/alexa/post/28368692-a0b9-4579-b129-e6793bef7848/alexa-skill-recipe-update-making-http-requests-to-get-data-from-an-external-api-using-the-ask-software-development-kit-for-node-js-version-2">Alexa Skill Recipe Update: Making HTTP Requests to Get Data from an External API Using the ASK Software Development Kit for Node.js Version 2</a></li> </ul> </div> /blogs/alexa/post/6e4350d9-cbae-4279-8c64-813a9e4522af/build-a-strong-language-model-to-get-the-most-out-of-dynamic-entities Build a Strong Language Model to Get the Most Out of Dynamic Entities Jennifer King 2019-06-11T14:00:00+00:00 2019-06-11T14:00:00+00:00 <p><img alt="" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/default/NLU-slot_blog.png._CB459321176_.png?t=true" style="height:480px; width:1908px" /></p> <p>We recently launched dynamic entities, which can help you personalize Alexa skill experiences by adapting your interaction model at run time without edits, builds, or re-certification. Here are some use cases where you can leverage dynamic entities.</p> <p><img alt="" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/default/NLU-slot_blog.png._CB459321176_.png?t=true" style="height:480px; width:1908px" /></p> <p>We recently launched <a href="https://developer.amazon.com/blogs/alexa/post/db4c0ed5-5a05-4037-a3a7-3fe5c29dcb65/use-dynamic-entities-to-create-personalized-voice-experiences">dynamic entities, </a>which can help you personalize Alexa skill experiences by adapting your interaction model at run time without edits, builds, or re-certification. Given dynamic entities offer a new <a href="https://developer.amazon.com/docs/custom-skills/define-synonyms-and-ids-for-slot-type-values-entity-resolution.html#intentrequest-changes">authority</a> source, custom slot values, and a new directive, there's a lot to take in. But where do dynamic entities really shine and how can you best leverage them? I'm excited to share a few use cases where you can leverage dynamic entities to personalize and improve the user experience of your Alexa skill.</p> <h2>Building the Foundation: The Static Language Model</h2> <p>Before you get started with dynamic entities, you'll need a solid foundation in the form of your language model. Just simply throwing all of your slot values into dynamic entities and leaving a skeleton in your static model is going to leave you hearing error messages and failures. Your language model defines the interactions Alexa expects to fulfill with your skill and dynamic entities only exist for a short duration. If you leave your static language model empty, then there isn't much for Alexa to train against and therefore you'll hear more error instances where nothing quite matches. Let's take a look at an example.</p> <p>A trivia skill has an intent to handle user guesses and answers called AnswerIntent. The intent accepts a single slot type of ANSWER. This skill surfaces new questions weekly and dynamic entities will allow me to fill in answers at run time. This is exactly what I was hoping for so I only load a single value in the ANSWER slot since I intend to update so frequently. My static catalog looks something like this:</p> <pre> <code>{ &quot;name&quot;: &quot;ANSWER&quot;, &quot;values&quot;: [ { &quot;name&quot;: { &quot;value&quot;: &quot;pizza&quot; } } ] } </code></pre> <p>Except in testing, none of my responses are routing to the AnswerIntent. The single value I provided is successful, but I can't consistently resolve answers for trivia questions.</p> <p><strong>Define a variety of slot values to reflect the dynamic values you are uploading</strong>. If you have a small set of sample utterances and slots values, then there isn't much for Alexa to train against and you'll see more instances of mismatched intents. My skill is a master of “pizza” but not much else.</p> <p>Instead of that single value, I loaded the ANSWER slot type in my language model with three weeks worth of slot values of a variety of lengths (one word, two word, and three word) and suddenly my AnswerIntent is capturing responses more consistently.</p> <p><strong>Aim to have only one single word intent.</strong> These are intents where there is only a single slot value as the sample utterance.</p> <pre> <code>{ &quot;name&quot;: &quot;AnswerOnlyIntent&quot;, &quot;slots&quot;: [ { &quot;name&quot;: &quot;answer&quot;, &quot;type&quot;: &quot;ANSWER&quot; } ], &quot;samples&quot;: [ &quot;{answer}&quot; ] } </code></pre> <p>Combine sessionAttributes for the the state the user is at in the skill, dynamic entities, and the intent context to determine where to route the user. For my trivia example, I allow users to select a trivia round by number that slots to the SelectRound intent. Both AnswerIntent and SelectRound intent potentially accept numbers as valid slot values. To avoid confusion with my ANSWER slot type, once a user starts a game I can store a state in the sessionAttributes to indicate a game is in progress and route number answers to the AnswerIntent handler rather than the SelectRound handler.</p> <p><strong>Use slot-based grammars where you find yourself otherwise creating similar or overlapping intents. </strong>My trivia skill allows users to select a category. Rather than have an intent for each category I can use a CATEGORY slot type to reflect the user's choice. Slot-based grammars allows me to simplify repeating phrases in my utterances such as “who,” “what,” “when,” and “where.”</p> <p>For a generic example: The InformationIntent includes utterances: &quot;{interrogative} did {event} take place?&quot;, &quot;{interrogative} is {event}&quot;, and &quot;{interrogative} {event}&quot;</p> <ol> <li>Interrogative: &quot;What,&quot; &quot;Where,&quot; &quot;Why,&quot; &quot;How,&quot; &quot;When&quot;</li> <li>Event: &quot;Burning Man,&quot; &quot;The Great Depression,&quot; &quot;Pax Romana,&quot; etc.</li> </ol> <p><strong>Static slot values customize and train a model, dynamic slot values customize a point in time interaction</strong>. Dynamic entities only exist at runtime and only for a portion of an interaction. Keeping with the trivia skill example, one week I have a category of “Trees” and want to capture “fur” as a synonym for “fir tree”. I can have that synonym only exist dynamically so that when I pivot to a “Fabrics” category the “fur” value isn't trying to route to a tree.</p> <p>However, I want “fur” and “fir” to exist as values for my ANSWER slot type for future trivia interactions. Adding those values to my static model ensures the model is trained to expect these types of answers.</p> <h2>Use Case: Frequent Content Updates</h2> <p>Now that I have a good foundation in my language model to start building against, let's look at how to get the most out of dynamic entities for my trivia skill.</p> <p>Fresh and frequently updated content keeps users coming back to a skill. There is both the allure of the unknown in the form of “What is coming this week?” as well as the idea that the interaction can't be exhausted in the short term. However, any change to the language model means going through certification. This ensures that the experience is consistent and reliable for users across releases, but certification also takes time. As exciting as trees are, I doubt my players really want to answer the same tree trivia questions for weeks on end.</p> <p>To create a good balance of dynamic and static content for this use case:</p> <ol> <li><strong>Narrow the acceptable results</strong> - My ANSWER slot type has 150 values, but my dynamic entities only use the acceptable answers for that round.<br /> <br /> <em>Question: The name of the fabric chiffon comes from a French word that translates as which of the following?</em><br /> <em>A. Cloth B. Veil C. Transparent D. Delicate</em><br /> <br /> My dynamic entities would include values for “cloth,” “veil,” “transparent,” and “delicate” for this question. Keep in mind dynamic entities only support 100 values so skills that leverage large dynamic answer sets are not good candidates for this method. An example being a slot type for Books in which over 100 book titles are acceptable answers.<br /> &nbsp;</li> <li><strong>Leverage the AMAZON.Fallback intent and the static catalog for incorrect answers</strong> - In the fabric category example, my static ANSWER slot type has at least 146 values that a user could say but are incorrect (150 less the four valid answer choices). This doesn't mean load a slot with hundreds of incorrect values as you might find that intent triggering for everything, but it makes the static catalog a second source for possible utterances.<br /> <br /> My trivia skill right now has slot values for trees, fabric, and colors. In testing I say “banana” and the skill simply doesn't respond. Digging into the logs I notice that nothing is triggered. “Bananas” is out of the scope of my language model. If I want to catch that phrase because I expect users might say “banana” often then I could add it to the AMAZON.Fallback intent and flag the answer as incorrect.<br /> <br /> Combining the static slot values with the AMAZON.Fallback intent and state management can help me to keep users in the skill by handling wrong answers as something other than errors.<br /> &nbsp;</li> <li><strong>Update synonyms dynamically</strong> <strong>to cover misrecognitions</strong> - We've all had it happen. A skill goes live and users start to throw all manner of phrases at it. Sometimes speech is rushed and words just don't come out right. In the short term my hands are tied, I can't update the language model and in some cases I don't want these minor errors to end up as permanent features. The solution is dynamic synonyms on slot values.<br /> <br /> My fabric category is live. I'm looking at the <strong>Intent History</strong> in the developer console and a lot of users are saying “would” for the AnswerIntent. A little further testing and I realize that “wool” is being misheard as “would.” I don't use utterances with “would” anywhere else in the skill and I could add “would” as a synonym for “wool” but the fabric category is only around for a short period of time and my users are affected now. I can quickly update my dynamic entities for that question to add the synonym, test in my development environment to confirm, and then quickly push the fix live. My users are getting their trivia points and, once the fashion category retires, I don't have to worry about conflicting utterances if I ever need “would” in another part of the skill.</li> </ol> <p>For the frequent content updater, dynamic entities are a great way to supplement the static language model and increase the chances of matching user utterances to the intended result rather than a possible result in a sea of slightly correct answers.</p> <h2>Use Case: State-Specific Content</h2> <p>A use case that <a href="https://developer.amazon.com/blogs/alexa/post/db4c0ed5-5a05-4037-a3a7-3fe5c29dcb65/use-dynamic-entities-to-create-personalized-voice-experiences">our previous blog</a> touched on was using dynamic entities for personalization. Two forms of personalization are user specific and state specific:</p> <ol> <li><strong>Narrow results to the user's preference</strong> - For my example, I have a skill with multiplayer chess as a core feature. Players can add other users to a friends list and select their preferred opponent when the EnterGameLobby intent is triggered.<br /> <br /> Now I certainly don't want to add all these usernames to my slot values. New accounts are created every day and there is no way I can keep up with demand. I also don't want to bulk load these users as dynamic entities. If the skill becomes popular, I will quickly pass the 100 value limit and putting the skill through certification every day is not ideal. Through combining generic slots my skill gets all usernames, but I want to surface the friends list first. This is the easy part. After a user triggers the EnterGameLobby intent to prepare to pair with another player, I can load all of the usernames in their friends list as dynamic slot values. That way if they ask to play with their friend “BlueOranges,” I won't accidentally match them with player “BlueOrange” who is valid player, but not the one they asked for.<br /> &nbsp;</li> <li><strong>Categorize similar values based on the user state </strong>- State specific content means altering slot values based on where a user is at in a skill.<br /> <br /> Let's pivot to another genre: groceries. A user wants milk from the fictional brand Plain. Plain has a large catalog of dairy based products. I could asks for brand and item type individually. However, item type also includes other non-dairy items because I am serving more than one brand. To solve for this, when a user supplies the brand name Plain, I dynamically load the Plain catalog and treat items in the static catalog as incorrect choices. This also works in reverse where when users ask for “cheese” I only load brands that sell cheese. With this setup I have fewer false positives. Keep in mind that dynamic entities last for 30 minutes. Make sure you use the CLEAR updateBehavior to remove unneeded or conflicting dynamic values before the next part of the dialog.</li> </ol> <p>There are many more ways to leverage dynamic entities with other features in Alexa to create language models and experiences that are tailored to your users and their usage. The key takeaways are to build a language model that is robust and to not look at dynamic entities as a way to replace the language model but as a way to augment it.</p> <h2>Related Content</h2> <ul> <li><a href="https://developer.amazon.com/blogs/alexa/post/db4c0ed5-5a05-4037-a3a7-3fe5c29dcb65/use-dynamic-entities-to-create-personalized-voice-experiences">Use Dynamic Entities to Create Personalized Voice Experiences</a></li> <li><a href="https://developer.amazon.com/docs/custom-skills/use-dynamic-entities-for-customized-interactions.html">Technical Documentation: Dynamic Entities</a></li> <li><a href="https://developer.amazon.com/blogs/alexa/post/144d52ad-25d7-4aa6-a155-9aeeca0406df/tailor-your-alexa-skill-responses-to-deliver-personalized-voice-experiences">Hear It from a Skill Builder: Tailor Your Alexa Skill Responses to Deliver Personalized Voice Experiences</a></li> </ul> /blogs/alexa/post/11b51c0b-9794-48bf-81c1-ecadf63fede3/adapting-alexa-to-regional-language-variations Adapting Alexa to Regional Language Variations Larry Hardesty 2019-06-11T13:00:00+00:00 2019-06-11T13:49:16+00:00 <p>Natural-language-understanding system that includes both&nbsp;a generic model for a language and several locale-specific models improves accuracy by an average of 59% over individual locale-specific models.</p> <p>As Alexa expands into new countries, she usually has to be trained on new languages. But sometimes, she has to be re-trained on languages she’s already learned. British English, American English, and Indian English, for instance, are different enough that for each of them, we trained a new machine learning model from scratch.</p> <p>Ideally, we wouldn’t have to do that. When Alexa moves into a new country and encounters a language she’s already familiar with, she should be able to take advantage of her previous experience. That’s the idea behind a new <a href="https://arxiv.org/pdf/1905.00924.pdf" target="_blank">machine learning system</a> that my colleagues and I presented last week&nbsp;at the annual meeting of the North American Chapter of the Association for Computational Linguistics.</p> <p>Our system is a domain classifier, which determines the topic of a customer’s request, such as music, weather, or sports. It can also identify requests as “<a href="https://developer.amazon.com/blogs/alexa/post/ddc28801-8806-4f04-a338-8fc10e0cad28/learning-to-recognize-the-irrelevant" target="_blank">out of domain</a>”, which is important to prevent the mishandling of unintentional or garbled speech.</p> <p>The domain classifier is a multi-task model, which means that it’s trained to perform several tasks simultaneously. One of those tasks is to learn a general statistical model for a particular language, which captures consistencies across regions. Its other tasks are to learn several different locale-specific models for the same language. It bases its domain classifications on the outputs of both the general and the locale-specific models.&nbsp;</p> <p>In experiments in which we trained our model on four different variants of English, it showed accuracy improvements of 18%, 43%, 116%, and 57% versus models trained on each variant individually.</p> <p><img alt="Locale-agnostic_architecture.png" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/default/Locale-agnostic_architecture.png._CB462220682_.png?t=true" style="display:block; height:333px; margin-left:auto; margin-right:auto; width:550px" /></p> <p style="text-align:center"><sub><em>Our new domain classifier includes both a locale-agnostic component (the &quot;shared encoder&quot;) and locale-specific components (the </em>k&nbsp;<em>location encoders). The outputs of both are combined as inputs to a bank of locale-specific classifiers (top).</em><em>&nbsp;</em></sub><br /> &nbsp;</p> <p>One reason multi-task training for domain classification is challenging is that requests to the same domain could look wildly different in different locales. Requests to the restaurant domain, for instance, would feature much different restaurant names in Mumbai than they would in London, even though customers are requesting the same services — address information, menu information, reservations, and so on.</p> <p>In such cases, relying on a single locale-specific classifier, trained on data unique to that locale, would probably yield better results than pooling the outputs of several locale-specific classifiers. In other cases, however, where requests are more uniform across locales, the outputs of several different locale-specific models could reinforce each other, improving accuracy.</p> <p>To strike a balance between these two types of cases, we use an attention mechanism, which gives different emphases — or weights — to the outputs of different locale-specific models, depending on the input. Ideally, in cases like the restaurant example, in which input data is very locale-dependent, the attention mechanism would assign almost of all of its weight to a single locale-specific model, ignoring the outputs of the other locale-specific models.</p> <p>In advance, we can identify domains that should receive this kind of treatment, because their input data is highly locale dependent. But at run time, our system doesn’t know which domain a request is intended for. Answering that question is precisely what it’s trying to do.</p> <p>We resolve this conundrum by modifying the training mechanism. At training time, we <em>do</em> know which domain each input is intended for, because the training data is labeled. During training, we evaluate the system not only on how accurately it classifies domains but also on how consistently the attention mechanism prioritizes the right locale-specific model when it receives locale-dependent data.</p> <p>The outputs of the locale-specific models are combined into a single vector, with heavily weighted outputs contributing more to the vector’s final values than lower-weighted outputs. That vector is concatenated with the output of the locale-independent model, and the combined vector passes to another network layer for domain classification.</p> <p>We evaluated this architecture using English-language data from the U.S., the U.K., India, and Canada. We trained our multi-task model on all four data sets and compared its performance to that of locale-specific models trained separately on the same data sets. That’s the experiment that yielded the accuracy improvements reported above.</p> <p>We also conducted one more experiment, in which we used adversarial training to enforce the neutrality of the locale-independent model. That is, during training, in addition to evaluating the system’s performance on domain classification accuracy and routing of locale-dependent data, we also evaluated it on how <em>badly</em> the locale-independent model predicted locales.</p> <p>This was an attempt to force the locale-independent model to extract only those characteristics of the data that were consistent across locales. In general, however, this hurt the system’s overall performance. The one exception was on the U.K. data set, where adversarial training conferred a slight performance boost. In ongoing work, we’re trying to determine the reason for that improvement.&nbsp;</p> <p><em>Young-Bum Kim is an Amazon science leader in the Alexa AI organization.</em></p> <p><a href="https://arxiv.org/pdf/1905.00924.pdf" target="_blank"><strong>Paper</strong></a>: “Locale-agnostic Universal Domain Classification Model in Spoken Language Understanding”</p> <p><a href="https://developer.amazon.com/alexa/science" target="_blank"><strong>Alexa science</strong></a></p> <p><strong>Acknowledgments</strong>: Jihwan Lee, Ruhi Sarikaya</p> <p><strong>Related</strong>:</p> <ul> <li><a href="https://developer.amazon.com/blogs/alexa/post/45276f8f-83e7-4446-855f-0bb0d5019f07/training-a-machine-learning-model-in-english-improves-its-performance-in-japanese" target="_blank">Training a Machine Learning Model in English Improves Its Performance in Japanese</a></li> <li><a href="https://developer.amazon.com/blogs/alexa/post/0535b1ff-d810-4933-a197-841bfb3fa894/cross-lingual-transfer-learning-for-bootstrapping-ai-systems-reduces-new-language-data-requirements" target="_blank">Cross-Lingual Transfer Learning for Bootstrapping AI Systems Reduces New-Language Data Requirements</a></li> <li><a href="https://developer.amazon.com/blogs/alexa/post/6355a6b0-a27d-4baa-94a3-a7b1d74c0afd/leveraging-unannotated-data-to-bootstrap-new-functions-more-quickly" target="_blank">Leveraging Unannotated Data to Bootstrap Alexa Functions More Quickly</a></li> <li><a href="https://developer.amazon.com/blogs/alexa/post/ddc28801-8806-4f04-a338-8fc10e0cad28/learning-to-recognize-the-irrelevant">Learning to Recognize the Irrelevant</a><br /> &nbsp;</li> </ul> /blogs/alexa/post/c43838d3-a9a8-4024-b28d-131743714bbf/how-to-make-isp-skill-faq-jp Alexaスキル開発トレーニングシリーズ: スキル内課金に関するFAQ Chisato Hiroki 2019-06-11T04:34:42+00:00 2019-06-11T04:34:42+00:00 <p><a href="https://developer.amazon.com/ja/blogs/alexa/post/096dc4fa-6bc0-4896-b7c9-ff8ae72070bc/how-to-make-isp-skill-in-jp">前回の記事</a>ではスキル内課金の開発手順を紹介しました。開発を進める中で様々な疑問も出てくるかと思います。そのような際に参考になるよう、今回の記事ではスキル内課金に関するFAQを紹介します。下記以外のFAQについては<a href="https://developer.amazon.com/ja/docs/in-skill-purchase/isp-faqs.html">こちら</a>のドキュメントや「<a href="https://developer.amazon.com/ja/blogs/alexa/post/146a56df-8d18-4261-928c-f92e6b12f480/">スキル内課金のベストプラクティス</a>」の記事も参考にしてください。</p> <p>&nbsp;</p> <p><a href="https://developer.amazon.com/ja/blogs/alexa/post/096dc4fa-6bc0-4896-b7c9-ff8ae72070bc/how-to-make-isp-skill-in-jp">前回の記事</a>ではスキル内課金の開発手順を紹介しました。開発を進める中で様々な疑問も出てくるかと思います。そのような際に参考になるよう、今回の記事ではスキル内課金に関するFAQを紹介します。下記以外のFAQについては<a href="https://developer.amazon.com/ja/docs/in-skill-purchase/isp-faqs.html">こちら</a>のドキュメントや「<a href="https://developer.amazon.com/ja/blogs/alexa/post/146a56df-8d18-4261-928c-f92e6b12f480/">スキル内課金のベストプラクティス</a>」の記事も参考にしてください。</p> <p>&nbsp;</p> <p><strong>Q.) ユーザはスキル内課金にPINコードを設定できますか?</strong></p> <p>A.) はい、Alexaアプリの「設定 → Alexaアカウント → 音声ショッピング」から確認コードをオンにして登録してください。</p> <p>&nbsp;</p> <p><strong>Q.) Alexaアプリで音声ショッピングがオフの場合に、ユーザがスキル内商品を買おうとするとどうなりますか?</strong></p> <p>A.) Alexa側で、音声ショッピングがオフなのでオンにするよう促す発話を自動的に行います。</p> <p>&nbsp;</p> <p><strong>Q.) 開発者はサブスクリプションの課金頻度をどのように設定できますか?</strong></p> <p>A.) 2019年6月現在は毎月または毎年の課金設定が可能です。</p> <p>&nbsp;</p> <p><strong>Q.) 開発者はサブスクリプションに試用期間を設定することはできますか?</strong></p> <p>A.) はい、1日から31日の間で試用期間を設定でき、試用期間終了時点から課金が開始されます。</p> <p>&nbsp;</p> <p><strong>Q.) ユーザがサブスクリプションをキャンセルした場合、購入したスキル内商品はすぐ無効になりますか?</strong></p> <p>A.) いいえ、次回の課金日からスキル内商品が無効になりますので、それまでは有効です。ただし開発版のスキルでは、キャンセル後すぐに無効になります。</p> <p>&nbsp;</p> <p><strong>Q.) ユーザは購入した買い切り型や消費型のスキル内商品をキャンセルすることができますか?</strong></p> <p>A.) はい、ただし買い切り・消費型をキャンセルするには、Amazonのカスタマーサービスに連絡する必要があります。</p> <p>&nbsp;</p> <p><strong>Q.) 開発者がユーザのスキル内課金をキャンセルすることはできますか?</strong></p> <p>A.) いいえ、スキル内課金のキャンセルはお客様の要求に基づきAmazonが行います。</p> <p>&nbsp;</p> <p><strong>Q.) 開発者はスキル内商品の販売状況をどこで確認することができますか?</strong></p> <p>A.) ASK開発者コンソールの「レポート」から確認可能です。</p> <p>&nbsp;</p> <p><strong>Q.) 子供向けスキルにスキル内課金を導入できますか?</strong></p> <p>A.) いいえ、2019年6月現在ではできません。</p> <p>&nbsp;</p> <p><strong>Q.) ユーザが課金アイテムを購入した後にスキルを無効化・再度有効化すると購入状況は変わりますか?</strong></p> <p>A.) In-Skill Product Serviceにはユーザの購入状況が保持されていますので、スキルが無効化・再有効化されてもユーザ体験が変わらないようにしてください。</p> <p>&nbsp;</p> <p><strong>Q.) スキル内商品のアップセルで必ず説明すべき項目はありますか?</strong></p> <p>A.) 消費型のスキル内商品の場合には、アップセルメッセージの中で商品の利用条件(アイテムの個数・あれば有効期限・何に消費するか等)を明確に説明してください。</p> <p>&nbsp;</p> <p><strong>Q.) スキル内商品のアップセルはどのようなタイミングで行えばよいですか?</strong></p> <p>A.) 例えば、ユーザが有料コンテンツにアクセスしようとした際やヘルプメッセージ内が挙げられますが、それ以外でも問題ありません。スキル内課金を導入したスキルのVUIには、直接購入のためのフローに加えてスキル内商品の説明を含むアップセルのメッセージをどこかに入れるようにしてください。</p> <p>&nbsp;</p> <p><strong>Q.) ユーザがスキル内商品を見つけやすくするにはどうすればよいですか?</strong></p> <p>A.) まずはスキル内商品について聞かれたら明確に答えましょう。「何を買える?」のように聞かれた場合にはスキル内商品の種類と、それを買うことで何ができるのかを説明してください。またスキル内商品について聞かれた場合以外でも、無料の体験をしている最中やヘルプ・終了時など適切なタイミングで、アップセルやまだ利用していない購入済み商品の案内をしてみましょう。スキル内商品の存在が知られないと購入されることもありません。ただしユーザ体験を考慮して、あまりに頻繁にアップセルすることは避けましょう。その他スキル内課金に関するカスタマーエクスペリエンスの設計については、<a href="https://developer.amazon.com/ja/docs/in-skill-purchase/customer-experience.html">こちら</a>のドキュメントも参考にしてください。</p> <p>&nbsp;</p> <p><strong>Q.) 開発者が公開済みのスキル内商品を削除することはできますか?</strong></p> <p>A.) いいえ、スキル内商品を公開後に削除することはできません。代わりにスキル内商品を無効化することは可能です。ただしサブスクリプション型の商品を無効にした場合、全てのユーザが本来の次の課金日を迎えるまでは(つまり月毎のサブスクリプションであれば1ヶ月後まで)スキル内商品のコンテンツをサポートするようにしてください。</p> <p>&nbsp;</p> <p><strong>Q.) スキル内課金を導入した場合、スキル説明文で気をつけることはありますか?</strong></p> <p>A.) &nbsp;スキル説明文およびサンプルフレーズには、スキル内商品の購入を促す発話は入れないでください。スキル内商品の説明自体は問題ありません。</p> <p>&nbsp;</p> <p><strong>Q.) スキル内課金による報酬の受け取りには税に関する情報の入力が必須ですか?</strong></p> <p>A.) はい、開発者コンソールの<a href="https://developer.amazon.com/taxinterview.html">税に関する情報のページ</a>から、ロイヤリティ収入の納税者確認インタビューを完了させてください。</p> <p>&nbsp;</p> <p><strong>Q.) スキル内課金を導入したスキルでは利用規約の用意が必要ですか?</strong></p> <p>A.) はい、スキル内課金を導入したスキルでは利用規約が必要になります。規約のWebページをご用意の上、スキル公開情報の「利用規約のURL」にそのURLを設定してください。</p> <p>&nbsp;</p> <p><strong>Q.) スマートフォンのAlexaアプリでは、スキルからスキル内商品を購入できますか?</strong></p> <p>A.) いいえ、スマートフォンのAlexaアプリや Alexa for PC ではスキル内商品を購入できません。ただし、ユーザが購入済みのコンテンツを利用することは可能です。また、開発者コンソールのシミュレータでもスキル内商品は購入できません。</p> <p>&nbsp;</p> <p><strong>Q.) スキル内商品を購入しようとすると、「すみません、このコンテンツは、お住まいの国では、現在利用できません。」というエラーになり購入できません。どうしたらよいですか?</strong></p> <p>A.) デバイスに登録のアカウントで次の設定値が「日本」になっているかどうか確認の上、なっていない場合には「日本」に設定を変更してください。「Amazon.co.jpのアカウントサービス =&gt; コンテンツと端末の管理 =&gt; 設定 =&gt; 国/地域設定」</p> <p>&nbsp;</p> <p>他にも開発上の疑問点がありましたら、<a href="https://forums.developer.amazon.com/spaces/293/index.html">Alexa開発者フォーラム</a>もご活用ください。この機会にスキル内課金に取り組んでみましょう。</p> <p><a href="https://developer.amazon.com/ja/alexa-skills-kit/training/building-a-skill">■ トレーニングコース目次 ■</a></p> /blogs/alexa/post/c4293154-968b-4707-a5c9-018b91d2846d/getting-started-with-the-cake-walk-course-using-auto-delegation-to-collect-slots-turn-by-turn Getting Started with the Cake Walk Course: Using Auto-Delegation to Collect Slots Turn by Turn Jennifer King 2019-06-10T14:00:00+00:00 2019-06-10T14:00:00+00:00 <p><img alt="" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/default/blog_design-guide_954x240.png._CB464487126_.png" style="height:480px; width:1908px" /></p> <p>In part 2 of my blog series about our new training course called Cake Walk, I share how you can leverage auto-delegation in the Alexa Skills Kit to collect necessary slots.</p> <p><img alt="" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/default/blog_design-guide_954x240.png._CB464487126_.png" style="height:480px; width:1908px" /></p> <p><strong><em>Editor’s Note:</em></strong><em> We <a href="https://developer.amazon.com/blogs/alexa/post/7e3376cf-97d7-41d6-86a6-afcdf1ca1379/new-alexa-skills-training-course-build-your-first-alexa-skill-with-cake-walk">recently launched</a> a new training course called <a href="https://developer.amazon.com/alexa-skills-kit/courses/cake-walk">Cake Walk: Build an Engaging Alexa Skill</a>. The course is a self-paced, skill-building course that offers guidance on how to build a high-quality skill from start to finish. In this 4-part blog series, we’re going to dive deep into the coding modules within the course. You can read part 1 on designing the voice user interface for Cake Walk <a href="https://developer.amazon.com/blogs/alexa/post/f26e61af-82c5-426c-91f7-ed46e581dc48/getting-started-with-the-cake-walk-course-designing-the-voice-user-interface-vui-for-your-alexa-skill">here</a>. </em></p> <p>Unlike a Hollywood movie, real conversations are not scripted. There are many factors that can affect conversation such as the number of participants, time of day, mood, amount of caffeine consumed, and so on. When I’m tired, I find it much more difficult to communicate. Have you ever answered a question when you just woke up and in your mind your response made sense, but your friend says, “What? I can’t understand you.” Or they ask you a bunch of questions and you can only recall the last question so you can only provide one answer. In this case, your friend asks follow-up questions until they have the information that they need.</p> <p>When your Alexa skill lacks all the information necessary to respond effectively to your customer, it needs to ask follow-up questions. Just like our friend. Let’s consider Cake Walk. Cake Walk is a sample skill that celebrates the customer’s birthday. When first opened, it doesn’t know the customer’s birthday, so it asks, “When were you born?” If the customer replies, “November 7, 1983.” The utterance contains the <strong>month</strong>, <strong>day</strong> and <strong>year</strong> slots, which means we have all the information that we need. However, if the customer left off the <strong>year</strong>, then the skill needs to follow up by asking what year they were born.</p> <p>In part 2 of this blog series, I share how we can leverage auto-delegation in the Alexa Skills Kit to collect the necessary slots. I recently hosted a Twitch session on this topic, which you can watch below.</p> <p style="text-align:center"><iframe allowfullscreen="" frameborder="0" height="360" src="//www.youtube.com/embed/AvblxVSvDug" width="640"></iframe></p> <h2>Understanding Situational Design</h2> <p>How do we determine if the skill should ask a follow-up question? We start with <a href="https://developer.amazon.com/alexa-skills-kit/situational-design">situational design</a>, which is a voice-first method to design a voice user interface. Start with a simple dialog that helps keep the focus on the conversation. The situation represents circumstances of the skill. For example, when we first interact with Cake Walk, the customer’s birthday is unknown. If they respond “November 7”, then <strong>month</strong> and <strong>day</strong> are known while <strong>year</strong> is unknown. In this case we need ask a follow-up question. The image below shows how our conversation will differ if our customer omits the <strong>year</strong>.</p> <p><img alt="" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/default/01-cake-walk-one-turn-v-two-turns.png._CB461737647_.png" style="display:block; height:378px; margin-left:auto; margin-right:auto; width:1000px" />It only takes one turn if all the information is provided in one shot; however, it takes two if the <strong>year</strong> is omitted. Did you notice that the skill’s response differs based upon the situtation? When all slots are provided the skill says, “See you later alligator!”, but when <strong>year</strong> is unknown, it asks, “What year were you born” situational design enables us to gracefully handle situations where we don’t have enough information. For example, if our customer just said, “November” the <strong>day</strong> and <strong>year</strong> slots will be unknown, so it will now take three turns to collect all the slots. Unlike a flow chart, situational design grants our design the ultimate flexibilty to handle the uncertainty of a dynamic conversation.</p> <h2>Implementation with Auto-Delegation</h2> <p>Now that we understand the design how do we implement it? The Alexa Skills Kit includes a handy feature called <a href="https://developer.amazon.com/docs/custom-skills/delegate-dialog-to-alexa.html">dialog management</a>. You can use it to have Alexa track which slots need to be required. During each turn of the dialog, your skill will receive a JSON request. From your skill code, you can check the state of the conversation and return the <strong>Dialog.Delegate</strong> directive to have the Alexa service prompt the user for the next slot. You can also use the <strong>Dialog.ElicitSlot</strong> directive to overide which slot is prompted for next. The Cake Walk skill does not require the <strong>Dialog.ElicitSlot</strong> directive. In this case, we can use <a href="https://developer.amazon.com/docs/custom-skills/delegate-dialog-to-alexa.html#automatically-delegate-simple-dialogs-to-alexa">auto-delegation</a>, which does not require any modification to our code. Our skill will only receive one request once all of the slots have been created.</p> <p>Let’s take a look at how take advantage of auto-delegation with Cake Walk.</p> <h3>Define the Intents, Slots, and Utterances</h3> <p>We have three slots that we need to capture with Cake Walk: <strong>month</strong>, <strong>day</strong>, and <strong>year</strong>. We have defined an intent called <strong>CaptureBirthdayIntent</strong> and we’ve defined the following utterances:</p> <p><code>&quot;{month} {day}&quot;,<br /> &quot;{month} {day} {year}&quot;,<br /> &quot;{month} {year}&quot;,<br /> &quot;I was born on {month} {day} &quot;,<br /> &quot;I was born on {month} {day} {year}&quot;,<br /> &quot;I was born on {month} {year}&quot;</code></p> <p>Now that we have defined our slots, we need to mark them required.</p> <h3>Make the Slot Required</h3> <p>To make our slots required we’ll need to scroll to the bottom of the <strong>CaptureBirthdayIntent</strong> edit screen and click on the name of the slot. This will take you to a new page that allows you to edit the slot. Set the “Is this slot required to fulfill the intent?” switch to on so it appears blue.</p> <p><img alt="" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/default/02-required.png._CB461737641_.png" /></p> <p>Upon doing so, two input boxes will appear. <strong>Alexa speech prompts</strong> is where you define what your skill will say to prompt the user to provide the slot. The user utterances allow you to define what the customer might say.</p> <h3>Define Prompts and User Utterances</h3> <p>Let’s consider the <strong>month</strong> slot.</p> <h4>Prompts</h4> <p>To prompt the user to fill this missing slot, our skill will say:</p> <p><code>I was born in November. When what were you born?<br /> What month were you born?</code></p> <p>Notice how we defined two prompts? Alexa will randomly choose a prompt from the two. This will make our skill sound less robotic.</p> <p><img alt="" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/default/03-speech-prompts.png._CB461737640_.png" /></p> <p>With our prompts defined, let’s take a look at the user utterances.</p> <h4>User Utterances</h4> <p>For the <strong>month</strong> slot, the user might say:</p> <p><code>{month}<br /> I was born in {month}<br /> I was born {month} {day}<br /> I was born {month} {day} {year}</code></p> <p><img alt="" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/default/04-user-utterances.png._CB461737642_.png" /></p> <p><strong>Note:</strong> You don’t need to provide the simple month-only slot, “{month}”, as a user utterance for the <strong>month</strong> slot. The Alexa service will do this for you if you choose to omit it.</p> <p>You’ll need to repeat the process for the remaining <strong>year</strong> and <strong>day</strong> slots.</p> <h3>Ensure Auto-Delegation Is On</h3> <p>Since we created a new skill, the <strong>Auto Delegation</strong> interface was turned on at the skill level by default. After marking our slots required, and providing prompts and user utterances, the <strong>Dialog Delegation Strategy</strong> drop down should now say, “fallback to skill setting.”</p> <p><img alt="" src="https://m.media-amazon.com/images/G/01/DeveloperBlogs/AlexaBlogs/default/05-dialog-delegate-strategy.png._CB461737637_.png" /></p> <p>At this point we’re ready to set up our back end.</p> <h3>Defining the CaptureBirthdayIntentHandler</h3> <p>Since our skill will only receive a response once all the slots have been collected, we only need one handler. We’ll call it <strong>CaptureBirthdayIntentHandler</strong>. Let’s take a look at when our <strong>canHandle</strong> will return true so that it can handle the request:</p> <ol> <li>The request type is <strong>IntentRequest</strong></li> <li>The request name is <strong>CaptureBirthdayIntent</strong></li> </ol> <p>In code that looks like:</p> <p><code>canHandle(handlerInput) {<br /> &nbsp;&nbsp;&nbsp; return handlerInput.requestEnvelope.request.type === 'IntentRequest'<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;&amp; handlerInput.requestEnvelope.request.intent.name === 'CaptureBirthdayIntent';<br /> }</code></p> <p>Our code will access the slot values and use an implicit confirmation to indicate to the user that we heard their birthday correctly. Let’s take a look at the handle function in code:</p> <p><code>handle(handlerInput) {<br /> &nbsp;&nbsp;&nbsp; const year = handlerInput.requestEnvelope.request.intent.slots.year.value;<br /> &nbsp;&nbsp;&nbsp; const month = handlerInput.requestEnvelope.request.intent.slots.month.value;<br /> &nbsp;&nbsp;&nbsp; const day = handlerInput.requestEnvelope.request.intent.slots.day.value;<br /> &nbsp;&nbsp;&nbsp;<br /> &nbsp;&nbsp;&nbsp; const speakOutput = `Thanks, I'll remember that you were born ${month} ${day} ${year}.`;<br /> &nbsp;&nbsp;&nbsp; return handlerInput.responseBuilder<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .speak(speakOutput)<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .getResponse();<br /> }</code></p> <p>First we access the <strong>year</strong>, <strong>month,</strong> and <strong>day</strong> slots and store their values to variables. Then we pass the variables to a javascript template literal to build our implicit confirmation string. Finally we use the <strong>responseBuilder</strong> to create the response that our skill returns to the Alexa Service. We still need to remember our customer’s birthday, but that’s a different topic we’ll cover later.</p> <h2>Conclusion</h2> <p>As you can see, <a href="https://developer.amazon.com/docs/custom-skills/delegate-dialog-to-alexa.html#automatically-delegate-simple-dialogs-to-alexa">auto-delegation</a> is a great tool at your disposal that you can use to add conversational flexibility to your skill. Now that you’ve learned how to use auto-delegation, think about how you can use it in your own skills. If you’d like to continue the discussion or have questions, reach out to me on Twitter at <a href="https://twitter.com/sleepydeveloper" target="_blank">@SleepyDeveloper.</a></p> <p>Stay tuned for the next post in this series to learn how to persistent attributes to store information for later use. We’ll be storing our customer’s birthday so we don’t have to ask for it every time they open the skill.</p> <h2>Related Content</h2> <ul> <li><a href="https://developer.amazon.com/blogs/alexa/post/7e3376cf-97d7-41d6-86a6-afcdf1ca1379/new-alexa-skills-training-course-build-your-first-alexa-skill-with-cake-walk">New Alexa Skills Training Course: Build an Engaging Alexa Skill with Cake Walk</a></li> <li><a href="https://developer.amazon.com/blogs/alexa/post/f26e61af-82c5-426c-91f7-ed46e581dc48/getting-started-with-the-cake-walk-course-designing-the-voice-user-interface-vui-for-your-alexa-skill">Getting Started with Cake Walk: Designing the Voice User Interface</a></li> <li><a href="https://developer.amazon.com/alexa-skills-kit/situational-design">About Situational Design</a></li> <li><a href="https://github.com/alexa/alexa-cookbook/tree/master/tools/situational-design">Situational Design Templates</a></li> <li><a href="https://github.com/alexa/skill-sample-nodejs-first-skill/tree/master/design-assets">Cake Walk Design Assets</a></li> <li><a href="https://github.com/alexa/skill-sample-nodejs-first-skill" target="_blank">Cake Walk Source Code</a></li> <li><a href="http://alexa.design/cakewalk">Cake Walk Course</a></li> </ul> /blogs/alexa/post/b986c041-7f14-4c3f-866c-3c1e4466cd6d/about-skill-certification-in-jp Alexaスキル認定へのヒント:サンプル発話 Chisato Hiroki 2019-06-10T09:12:22+00:00 2019-06-11T04:49:49+00:00 <p>みなさまが開発されたAlexaスキルは、スキルストアへの公開に当たり、Alexa審査チームが認定審査をさせていただき、 スキルがよいユーザー体験をお届けできるよう、必要に応じてフィードバックをさせていただいています。このブログでは、審査で改善のフィードバックを受けるスキルの傾向を紹介し、事前にご対応いただく方法を紹介します。今回は「サンプル発話」についてです。</p> <p>みなさまが開発されたAlexaスキルは、スキルストアへの公開に当たり、 Alexa審査チームが認定審査をさせていただき、 スキルがよいユーザー体験をお届けできるよう、必要に応じてフィードバックをさせていただいています。このブログでは、審査で改善のフィードバックを受けるスキルの傾向を紹介し、事前にご対応いただく方法を紹介します。今回は「サンプル発話」についてです。</p> <p>&nbsp;</p> <h2><strong>① いろいろな言い方のサンプル発話がありますか?</strong></h2> <p>サンプル発話にユーザーが発話しそうなフレーズが網羅されていますか?サンプル発話が不足していると、スキルがユーザーのリクエストに正しく反応しない可能性があります。下の再現例をみてみましょう。<br /> <br /> <br /> スキル名:みんなの水族館クイズ<br /> 呼び出し名:みんなの水族館クイズ<br /> <br /> 再現例:<br /> ユーザー:アレクサ、みんなの水族館クイズをスタートして<br /> スキル:「みんなの水族館クイズ」へようこそ。このスキルでは、大人から子どもまで楽しめる海の動物のクイズを出題します。第一問。サイズが一番大きいのはどの動物?ペンギン、タコ、クジラ、どれかな?<br /> <br /> <br /> スキルからの問いに対し、ユーザーがどう答えるか考えてみましょう。ユーザーがもっとも発話するであろう返答は、「クジラ」。即ち、答えのみの返答でしょう。また「クジラだと思う」や「正解はクジラ」のように、答えの前後にいろいろな単語をつなげて答えるユーザーもいるでしょう。サンプル発話にユーザーがもっとも発話するであろうフレーズ(ここでは「クジラ」)、そしてその他の発話する可能性のあるフレーズ(「クジラだと思う」「正解はクジラ」など)が含められていないと、スキルが上手く認識してくれない可能性があります。</p> <pre> <code class="language-java">インテントスキーマ: カスタムインテント:KotaeIntent カスタムスロットタイプ:doubutu サンプル発話(修正前): KotaeIntent   {doubutu} です KotaeIntent   {doubutu} だ スロット値: doubutu   アザラシ, クジラ, ウミガメ, ペンギン, タコ, イルカ, サメ, フグ</code></pre> <p>上記のサンプル発話は、「クジラです」また「クジラだ」というフレーズには対応していますが、「クジラだと思う」や「正解はクジラ」などのフレーズ、またもっとも発話するであろう、答えのみのフレーズ「クジラ」をサポートしていません。</p> <pre> <code class="language-java">サンプル発話(修正後): KotaeIntent   {doubutu} です KotaeIntent   {doubutu} だ KotaeIntent   {doubutu} だと思う KotaeIntent   正解は {doubutu} KotaeIntent   答えは {doubutu} KotaeIntent   答えは {doubutu} だ KotaeIntent   {doubutu} かな KotaeIntent   {doubutu} など </code></pre> <p>修正後のように、サンプル発話にもっともユーザーが発話するであろうフレーズ、また発話する可能性のあるフレーズを網羅することで、スキルがより高い確率でユーザーからの発話を認識できるようになります。各カスタムインテントに対し、いろいろな言い方のサンプル発話が含まれていることを、スキルの認定の前にいま一度ご確認ください。<br /> <br /> サンプル発話の追加については、下記ページもあわせてご参照ください。<br /> <a href="https://developer.amazon.com/ja/docs/custom-skills/best-practices-for-sample-utterances-and-custom-slot-type-values.html">https://developer.amazon.com/ja/docs/custom-skills/best-practices-for-sample-utterances-and-custom-slot-type-values.html</a><br /> <br /> &nbsp;</p> <h2><strong>② ユーザーに提示されているフレーズがサンプル発話に含まれていますか?</strong></h2> <p>Alexaアプリ(コンパニオンアプリ)やスキルのプロンプト(応答)にて提示されているフレーズがサンプル発話として定義されていますか?サンプル発話として定義されていないと、スキルがそのフレーズの認識に失敗し、スキルの機能が動作せず、満足のいくユーザーエクスペリンスを提供できない可能性があります。<br /> <br /> Alexaアプリ上では、サンプルフレーズ、およびスキルの説明文にあるフレーズがサンプル発話として定義されているかどうかをご確認ください。スキル内では、ウェルカムプロンプト、ヘルププロンプト、ユーザーの入力が聞き取れなかった際のリプロンプトにて提示されるフレーズを中心にご確認いただくことが必要です。<br /> &nbsp;</p> <h3>⑴ 下記のスキル「今日の晩御飯レシピ」のサンプルフレーズをみてみましょう。</h3> <pre> <code class="language-java">スキル名:今日の晩御飯レシピ 呼び出し名:今日の晩御飯レシピ Alexaアプリ内: サンプルフレーズ①:アレクサ、今日の晩御飯レシピを開いて サンプルフレーズ②:ハンバーグをお願い サンプルフレーズ③:エビフライにする </code></pre> <p>「今日の晩御飯レシピ」では、3つのサンプルフレーズがユーザーに提示されています。このうち、スキルの機能を動作させる為のフレーズをサンプル発話として定義しておく必要があります。ここでは、誤ってウェイクワード、呼び出し名、起動フレーズ(ワンショットの場合では、つなぎ語)をサンプル発話に含めないよう、ご注意ください。ウェイクワードと呼び出し名、起動フレーズについては、下記のページをご参照ください。<br /> <a href="https://developer.amazon.com/ja/docs/custom-skills/understanding-how-users-invoke-custom-skills.html#invoking-a-skill-with-no-specific-request-no-intent">https://developer.amazon.com/ja/docs/custom-skills/understanding-how-users-invoke-custom-skills.html#invoking-a-skill-with-no-specific-request-no-intent</a><br /> <br /> サンプルフレーズ①「アレクサ、今日の晩御飯レシピを開いて」は、ウェイクワードと呼び出し名、そして起動フレーズで構成されているので、サンプル発話として定義が必要な部分はありません。<br /> <br /> サンプルフレーズ②「ハンバーグをお願い」やサンプルフレーズ③「エビフライにする」は、スキル「今日の晩御飯レシピ」を呼び出した後にスキルの機能を動作させるフレーズである為、該当するカスタムインテントにサンプル発話として必ず定義しておく必要があります。</p> <pre> <code class="language-java">インテントスキーマ: カスタムインテント:CookingIntent カスタムスロットタイプ:food サンプル発話(修正前): CookingIntent   {food} をお願い CookingIntent   {food} にして CookingIntent   {food} スロット値(修正前): food   ハンバーグ, エビフライ, 肉じゃが, コロッケ </code></pre> <p>上記のサンプル発話とスロット値では、サンプルフレーズ②「ハンバーグをお願い」というユーザーのリクエストは、「{food} をお願い」がCookingIntentに、また「ハンバーグ」がfoodスロットに定義されている為、スキルが対応することが可能です。しかしながら、サンプルフレーズ③「エビフライにする」は、「エビフライ」がfoodスロットに存在するものの、「{food} にする」がCookingIntentにない為、スキルが正常に反応しない恐れがあります。ここでは、「{food} にする」をサンプル発話として追加しましょう。<br /> &nbsp;</p> <h3>⑵ 続いて、スキルのプロンプト(ここではウェルカムプロンプト)にて提供されているフレーズをみてみましょう。</h3> <p><br /> スキルのプロンプト:<br /> 再現例:<br /> ユーザー:アレクサ、今日の晩御飯レシピをスタートして<br /> スキル(ウェルカムプロント):ようこそ。「今日の晩御飯レシピ」は、今日の晩御飯をどうしようか迷った時に、料理を提案し、その作り方を教えてくれるスキルです。今晩食べたいのは、ハンバーグ、エビフライ、カレーライスのうち、どれですか?「ハンバーグをお願い」「から揚げがいい」などと答えてください。<br /> <br /> <br /> ウェルカムプロンプトでは、「ハンバーグをお願い」と「から揚げがいい」というフレーズがユーザーがスキル内で試せる発話例として提供されています。サンプルフレーズ同様に、これらのフレーズもサンプル発話として該当のカスタムインテントに定義されている必要があります。前述したとおり「ハンバーグをお願い」はすでに対応されていますが、「から揚げがいい」はCookingIntentのサンプル発話に「{food} がいい」がなく、またfoodスロットに「から揚げ」がない為、ユーザーの入力に対応できない可能性があります。前述の「{food} にする」と共に、「{food} がいい」をCookingIntentに、また「から揚げ」をfoodスロットに追加しましょう。</p> <pre> <code class="language-java">サンプル発話(修正後): CookingIntent   {food} をお願い CookingIntent   {food} にして CookingIntent   {food} にする CookingIntent   {food} がいい CookingIntent   {food} スロット値(修正後): food   ハンバーグ, エビフライ, 肉じゃが, コロッケ, から揚げ </code></pre> <p>ここでは、サンプルフレーズとウェルカムプロンプトを例にあげましたが、スキルの説明文や他のプロンプトにおいてもフレーズをご提示いただく場合は、同様に該当するカスタムインテントに一致するサンプル発話を定義する必要があります。ユーザーが入力したフレーズが確実にスキルの機能を動作できるよう、スキルの認定の前にもう一度ご確認ください。<br /> <br /> サンプルフレーズに関するガイダンスは<a href="https://developer.amazon.com/ja/blogs/alexa/post/a0a3bc83-2247-48e3-a2a4-cf7af7fec843/certification-jp-2nd">こちら</a>、スキルの説明文(詳細な説明)に関するガイダンスは<a href="http://developer.amazon.com/ja/blogs/alexa/post/f396a024-1a74-4869-899d-81269bb806e2/certification-jp-6th">こちら</a>をご参照ください。<br /> <br /> &nbsp;</p> <h2><strong>③ 異なるインテントに重複するサンプル発話がないように!</strong></h2> <p>異なるインテントに定義されているサンプル発話が重複していると、正しいインテントにユーザーのリクエストが届かない場合があります。スキルの機能を正常に動作させるには、各インテントに独自のサンプル発話を定義し、他のインテントのサンプル発話と重複しないようにする必要があります。<br /> <br /> 下記のスキル「日本の植物図鑑」を例に、いっしょに考えてみましょう。</p> <pre> <code class="language-java">スキル名:日本の植物図鑑 インテントスキーマ: カスタムインテント:FlowerIntent, GrassIntent カスタムスロットタイプ:hana, kusa サンプル発話(修正前): FlowerIntent   {hana} について教えて FlowerIntent   {hana} をお願い FlowerIntent   {hana} FlowerIntent   教えて GrassIntent   {kusa} について知りたい GrassIntent   {kusa} をお願い GrassIntent   {kusa} GrassIntent   教えて スロット値: hana   桜, 梅, ツバキ, スミレ kusa   ヨモギ, ネコジャラシ, ナズナ, ドクダミ </code></pre> <p>スキル「日本の植物図鑑」には、FlowerIntentとGrassIntentの二つのカスタムインテントが用意されています。FlowerIntentとGrassIntentに全く同じサンプル発話が存在し、重複していると、ユーザーがそのサンプル発話を入力した際、スキルがどちらのカスタムインテントをリクエストされているか判断できず、ユーザーの意図と反する動作を行う可能性があります。上記では、FlowerIntentにもGrassIntentにも「教えて」というサンプル発話が含まれている為、重複しています。いずれかまたは両方を修正、あるいは削除する必要があります。</p> <pre> <code class="language-java">サンプル発話(修正後): FlowerIntent   {hana} について教えて FlowerIntent   {hana} をお願い FlowerIntent   {hana} FlowerIntent   花について教えて GrassIntent   {kusa} について知りたい GrassIntent   {kusa} をお願い GrassIntent   {kusa} GrassIntent   日本の草 </code></pre> <p>修正後のサンプル発話では、FlowerIntentの「教えて」が「花について教えて」に修正され、GrassIntentの「教えて」が「日本の草」に変更されています。これにより、FlowerIntentとGrassIntentで発生していたサンプル発話の重複が解消され、ユーザーのリクエストが正しいインテントに届くようになりました。<br /> <br /> カスタムインテント同士の重複以外にも、カスタムインテントとビルトインインテントのフレーズが重複している場合は、同様に修正が必要です。ビルトインインテントに含まれるフレーズについては、下記のページをご参照ください。<br /> <a href="https://developer.amazon.com/ja/docs/custom-skills/standard-built-in-intents.html#available-standard-built-in-intents">https://developer.amazon.com/ja/docs/custom-skills/standard-built-in-intents.html#available-standard-built-in-intents</a><br /> <br /> スキルの認定の前に、すべてのサンプル発話を再度ご覧いただき、重複がないことをお確かめください。ユーザーエクスペリンス向上の為、ご協力をお願いいたします。<br /> &nbsp;</p> <h2>スキル認定に関する関連記事</h2> <p><a href="https://developer.amazon.com/ja/blogs/alexa/post/0ce8abf3-2b86-4a1d-9c6f-cee639d8bddf/certification-jp">Alexaスキル認定へのヒント集</a><br /> <a href="https://developer.amazon.com/ja/blogs/alexa/post/de085f2a-3cfb-4549-9f23-52cdef6f263a/certification-jp-3rd">Alexaスキル内の広告について</a><br /> <a href="https://developer.amazon.com/ja/blogs/alexa/post/a0a3bc83-2247-48e3-a2a4-cf7af7fec843/certification-jp-2nd">Alexaスキル認定へのヒント:サンプルフレーズ編</a><br /> <a href="https://developer.amazon.com/blogs/alexa/post/51eb71ea-1711-4719-8d67-ddb38df5dc0b/certification-jp-4th">Alexaスキル認定へのヒント : スマートホームスキル編</a><br /> <a href="https://developer.amazon.com/ja/blogs/alexa/post/3e2a13b3-3435-414e-8b3f-79220fd42dd4/certification-jp-5th">Alexaスキル認定へのヒント : ヘルプインテント編</a><br /> <a href="https://developer.amazon.com/blogs/alexa/post/f396a024-1a74-4869-899d-81269bb806e2/certification-jp-6th">Alexaスキル認定へのヒント: 詳細な説明編</a></p> <hr /> <p>皆様からのフィードバックは、私たちにとってとても貴重なものです。スキルの認定に関するご意見がありましたら、<a href="https://developer.amazon.com/ja/support/contact-us?subjectCategory=ALEXA">お問い合わせフォーム</a>からいつでもお送りください。<br /> また、 スキル開発時に分からないことがあれば、<a href="https://forums.developer.amazon.com/spaces/293/index.html">Alexa開発者フォーラム</a>もご利用ください。フォーラム上でいただいたご質問に、担当がお答えいたします。<br /> <br /> <br /> <br /> <br /> &nbsp;</p>