200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > 亚马逊echo中国使用_我如何编程我的第一个Amazon Alexa技能并赢得了的Echo Dot...

亚马逊echo中国使用_我如何编程我的第一个Amazon Alexa技能并赢得了的Echo Dot...

时间:2019-07-19 20:10:58

相关推荐

亚马逊echo中国使用_我如何编程我的第一个Amazon Alexa技能并赢得了的Echo Dot...

亚马逊echo中国使用

by Lorrie Pearson

洛里·皮尔森(Lorrie Pearson)

我如何编程我的第一个Amazon Alexa技能并赢得了免费的Echo Dot (How I programmed my first Amazon Alexa Skill and won a free Echo Dot)

It’s been a year since I began learning to code. I became interested in coding because of my desire to work with others in the beauty, fashion and luxury lifestyle world. I wanted to create amazing websites with animated elements and other digital media.

自从我开始学习编码已经一年了。 由于对与美丽,时尚和奢侈生活方式世界中的其他人一起工作的渴望,我对编码产生了兴趣。 我想用动画元素和其他数字媒体创建出色的网站。

I started with an online course and a month later, I discovered freeCodeCamp. That’s when learning to code became more exciting and insightful.

我从一个在线课程开始,一个月后,我发现了freeCodeCamp。 那时,学习编码变得更加令人兴奋和深刻。

There is real-time communication with fellow coders ready to help you work through interactive challenges. They provide feedback and references for further learning. This helped my confidence grow and coding skills improve.

可以与其他编码人员进行实时通信,以帮助您应对交互式挑战。 他们提供反馈和参考,以供进一步学习。 这帮助我增强了信心,提高了编码技能。

In early June, a friend told me about an online webinar titled “Build Voice Enabled Experiences with Amazon Alexa.” The idea of the webinar increased my curiosity because at the time, I had only seen commercials, but had not used an Alexa enabled product. I signed up and was fascinated.

6月初,一个朋友告诉我一个在线研讨会,名为“使用Amazon Alexa构建启用语音的体验”。 网络研讨会的想法增加了我的好奇心,因为当时我只看过广告,但没有使用支持Alexa的产品。 我签约后着迷。

At the end of the webinar attendees received information about a promotion. If within 30 days you created a Skill and got it published, you were eligible to win a free Echo Dot. I didn’t know if I had enough knowledge to succeed, but I decided to give it a try to learn.

网络研讨会结束时,与会者收到了有关促销的信息。 如果您在30天内创建了一项技能并将其发布,则有资格赢得免费的Echo Dot。 我不知道我是否有足够的知识来成功,但是我决定尝试学习。

The thought of creating my first app was exciting. At that moment, my Alexa learning experience began.

创建我的第一个应用程序的想法令人兴奋。 那时,我的Alexa学习经历开始了。

什么是Alexa,它如何运作?(What is Alexa and how does it work?)

Alexa is a cloud-based voice service that powers millions of voice experiences in the home. Devices Alexa powers includes Amazon Echo, Echo Dot, Amazon Tap and Amazon Fire TV.

Alexa是基于云的语音服务,可为数百万个家庭语音体验提供支持。 Alexa的功能包括Amazon Echo,Echo Dot,Amazon Tap和Amazon Fire TV。

A Skill is a voice-driven application for Alexa.

技能是Alexa的语音驱动应用程序。

Alexa provides “Skills”, which allows users to interact with the devices. Skills can be created to do many things. They can answer questions, play trivia games, play music, set an alarms, tell jokes and more.

Alexa提供了“技能”,使用户可以与设备进行交互。 可以创造技能去做很多事情。 他们可以回答问题,玩琐事游戏,播放音乐,设置闹钟,讲笑话等等。

The Alexa Skills Kit (ASK) is a collection of tools, API’s, documentation, code samples and templates with links to GitHub. The ASK helps developers create Skills for Alexa enabled devices.

Alexa Skills Kit(ASK)是工具,API,文档,代码示例和模板的集合,并带有指向GitHub的链接。 ASK帮助开发人员为支持Alexa的设备创建技能。

An Alexa Skill has two main components: a Skill Service and a Skill Interface.

Alexa技能具有两个主要组件:技能服务和技能界面。

Your code is written in Node.js for the Skill Service which lives in the Cloud (Amazon AWS, Lambda, an HTTPS service). It receives instructions to determine the actions to take in response to the user requests from the Alexa enabled device.

您的代码是使用Node.js编写的,用于Cloud中的技能服务( Amazon AWS,Lambda和HTTPS服务)。 它从启用了Alexa的设备接收指令,以确定响应用户请求采取的措施。

The Skill Service implements event handlers that define how the Skill will behave. The event is triggered when the user speaks into an Alexa enabled device.

技能服务实现事件处理程序,这些事件处理程序定义技能的行为方式。 当用户对启用了Alexa的设备讲话时会触发该事件。

Then you configure the Skill Interface with the Skill Developer Portal. The interface processes the users’ words to trigger the events that the Skill Service handles. In this area you determine what to call your Skill so the user can invoke it by name. This also is where you define the Skill interaction model. This is so it knows how to listen to users’ spoken words and respond with the information intended.

然后,您可以使用Skill Developer Portal配置Skill Interface。 该界面处理用户的单词以触发技能服务处理的事件。 在此区域中,您可以确定调用技能的方式,以便用户可以按名称调用它。 这也是定义技能交互模型的地方。 这样一来,它便知道如何听用户说的话并以所需的信息进行响应。

It’s the interaction of the two components that make the Skill work.

正是两个组件的相互作用才使这项技能发挥作用。

The Amazon Team provided links to three Skill Templates. These templates are great to help you get started and to learn how Alexa interacts and responds.

亚马逊团队提供了指向三个技能模板的链接。 这些模板非常有助于您入门并了解Alexa如何进行交互和响应。

Fact Skill template

事实技能模板

to create something like a “fact” or “joke” of the day.

创造类似一天的“事实”或“笑话”之类的东西。

Decision Tree template

决策树模板

to create simple adventure games and quizzes

创建简单的冒险游戏和测验

How To template

如何模板

to create skills like recipes content with similar step by step processes.

通过类似的逐步过程来创建食谱内容之类的技能。

Plus many more intermediate and advanced templates available .

加上更多可用的中级和高级模板。

I now have three published skills, Makeup Facts, Fashion Facts and Girls Can Code . I work as a freelance makeup artist and fashion stylist and decided to start with what I know best.

我现在拥有三个已发布的技能: 化妆事实 , 时尚事实和女孩可以编码 。 我是一名自由化妆师和时尚设计师,因此决定从我最了解的地方开始。

To create these “Fact Skills” I reviewed the topic and information on creating a Skill. Then I created my list of facts that would be integrated into the Fact Skill Template. All Skills were accepted and published within a couple of days.

为了创建这些“基本技能”,我回顾了有关创建技能的主题和信息。 然后,我创建了事实列表,这些事实将被整合到事实技能模板中。 几天之内就接受并发布了所有技能。

我如何创建我的第一个技能(How I created my first Skill)

Go to Amazon Developer Portal sign in, click Alexa at top of the screen.

转到Amazon Developer Portal登录,单击屏幕顶部的Alexa。

On the Alexa page, choose the “Get Started” for the Alexa Skills Kit.

在Alexa页面上,为Alexa技能套件选择“入门”。

On the next page..select “Add New Skill.”

在下一页上。选择“添加新技能”。

Then fill out theInformationpage.

然后填写信息页面。

Skill Type:Custom

技能类型:自定义

Language:English

语言:英语

Name:Makeup Facts

名称:化妆事实

Invocation Name: (what your user will need to say to start the Skill)Makeup Facts

调用名称:(您的用户将需要说些什么来启动此技能)化妆事实

Click next to go toInteraction Modelpage. This is where you createintentsor what users will ask Alexa to do. Then createutterancesor possible ways the user will ask Alexa about the Skill you’ve created. I found this GitHub repository to be helpful. The Samples include: give me a fact, tell me a fact.

单击下一步转到“交互模型”页面。 这是您创建意图或用户将要求Alexa做什么的地方。 然后创建语音或用户可能会询问Alexa有关您创建的技能的可能方式。 我发现此GitHub存储库很有帮助。 样本包括:给我一个事实,告诉我一个事实。

MyIntentsin theInteractive ModelforMakeup Facts

我在化妆事实互动模型中的意图

{ “intents”: [ { “intent”: “GetNewFactIntent” }, { “intent”: “AMAZON.HelpIntent” }, { “intent”: “AMAZON.StopIntent” }, { “intent”: “AMAZON.CancelIntent” } ] }

MyUtterancesin theInteractive ModelforMakeup Facts.

我在互动模式话语化妆事实。

GetNewFactIntent a factGetNewFactIntent tell me a factGetNewFactIntent tell me a makeup factGetNewFactIntent give me a factGetNewFactIntent give me a makeup factGetNewFactIntent tell me triviaGetNewFactIntent give me triviaGetNewFactIntent give me some informationGetNewFactIntent tell me somethingGetNewFactIntent give me something

Now it’s time to set up Lambda. Go to / and sign into the console. Then go toservices-Lambda.

现在是时候设置Lambda了。 转到/并登录到控制台。 然后转到services-Lambda

On the top right of your page, make sure yourAWS RegionisN. Virginia.

在页面右上角,确保您的AWS区域N. Virginia

Then click the blue button to create a Lamda function.

然后单击蓝色按钮以创建Lamda函数。

Choose the blueprint that looks like this:

选择如下所示的蓝图:

Configure your trigger. Make sure you chooseAlexa Skills Kitin the drop down menu.

配置触发器。 确保在下拉菜单中选择Alexa技能套件

Configure your function. Make sure your function name is written in camelBack. You can leave the description blank, but you are building this in Node.js.

配置您的功能。 确保您的函数名称写在camelBack中。 您可以将描述保留为空白,但是要在Node.js中进行构建。

Add your updated code.

添加您的更新代码。

There is an AlexaSkill.js file written with specific event handlers. It specifies output, prompt and speech. There is also an Index.js file that you customize to meet the needs of your Skill.

有一个用特定事件处理程序编写的AlexaSkill.js文件。 它指定输出,提示和语音。 您还可以自定义一个Index.js文件来满足您的技能需求。

Girls Can Code (index.js)

‘use strict’;var Alexa = require(‘alexa-sdk’);

var APP_ID = “amzn1.ask.skill.1f2c85a9-b1b6–49a8-b94d-8a795d545d98”;

var SKILL_NAME = “Girls Can Code”;var GET_FACT_MESSAGE = “Here’s your fact: “;var HELP_MESSAGE = “You can say tell me a code fact, or, you can say exit… What can I help you with?”;var HELP_REPROMPT = “What can I help you with?”;var STOP_MESSAGE = “Goodbye!”;

var data = [ “Coding is awesome.”, “You can create tools that will change the world.”, “Coding is creative.”, “Coding is like solving a puzzle.”, “Coding work can be done remotely”, “Learning code is empowering.”, “Technology and coding help create the future.”, “Girls who can code have the edge”, “Anyone can code. You’ll discover something new.”, “Coding promotes critical thinking”, “Women make great coders”, “Girls who code are role models for all women.”, “Girls who code know that technology is not just for boys.”, “Jobs in tech are in demand.”, “Coding is the language of the 21st century”, “Girls who code help close the gender gap.”, “Coding can be done anywhere, anytime”, “Working in tech can be a very lucrative career choice”, “Coding is not just about building robots and website, you learn to create things that don’t exist”, “A girl who codes could create the next new social media app”, “A girl with tech skills can change the ways businesses communicate”, “Girls who code love to learn.”];

exports.handler = function(event, context, callback) { var alexa = Alexa.handler(event, context); alexa.APP_ID = APP_ID; alexa.registerHandlers(handlers); alexa.execute();};

var handlers = { ‘LaunchRequest’: function () { this.emit(‘GetNewFactIntent’); }, ‘GetNewFactIntent’: function () { var factArr = data; var factIndex = Math.floor(Math.random() * factArr.length); var randomFact = factArr[factIndex]; var speechOutput = GET_FACT_MESSAGE + randomFact; this.emit(‘:tellWithCard’, speechOutput, SKILL_NAME, randomFact) }, ‘AMAZON.HelpIntent’: function () { var speechOutput = HELP_MESSAGE; var reprompt = HELP_REPROMPT; this.emit(‘:ask’, speechOutput, reprompt); }, ‘AMAZON.CancelIntent’: function () { this.emit(‘:tell’, STOP_MESSAGE); }, ‘AMAZON.StopIntent’: function () { this.emit(‘:tell’, STOP_MESSAGE); }};

Create a compressed file with the above two files and upload the zipfile into Lambda.

使用上述两个文件创建一个压缩文件,然后将zipfile上传到Lambda。

Skip the Advanced settings.

跳过高级设置。

Copy the ARN # in the top right hand corner of your screen.

将ARN#复制到屏幕的右上角。

Go back to theAmazon Developerpage. Select your skill and click on theConfigurationtab located in the left sidebar menu.

返回到Amazon Developer页面。 选择您的技能,然后单击左侧边栏菜单中的“配置”选项卡。

Select theAWS Lambdaoption. Check theNorth Americabox. Paste thearn#that you copied from your Lambda dashboard.

选择AWS Lambda选项。 选中北美框。 粘贴您从Lambda仪表板复制的arn#

Test your Skill. If necessary, update it so that it works properly.This GitHub Repository gives you the sample code for creating a Fact Skill. Check it, clone it and update it to write your own.

测试您的技能。如有必要,请对其进行更新以使其正常运行。该GitHub存储库为您提供了创建事实技能的示例代码。 检查它,克隆它并更新它以编写自己的。

You can test your code in the Developer Console, in the Lambda functions, on your Echo and at Echoism.io.

您可以在开发人员控制台,Lambda函数,Echo和Echoism.io上测试代码。

Enter your Publishing and Privacy information.

输入您的发布和隐私信息。

Congrats..you’re ready to submit for certification.

恭喜。您已准备好提交认证。

It takes a few days to hear back from the Amazon Developer Team. If your Skill is approved, then everything works and all of the information is compliant. Your Skill will be certified and published and available for others to use.

几天后才能收到Amazon开发团队的回音。 如果您的技能获得批准,则一切正常,并且所有信息均符合要求。 您的技能将得到认证和发布,并可供其他人使用。

If not, you will receive feedback and suggestions on what you need to to to resolve any issues so you can re-submit.

如果没有,您将收到解决任何问题所需的反馈和建议,以便重新提交。

我学到的是(What I learned)

It’s helpful to have some familiarity with JavaScript and Node.js.熟悉JavaScript和Node.js很有帮助。 You will need an AWS (Amazon Web Services) account and an Amazon Developer Account to complete and submit Skills.您将需要一个AWS(Amazon Web Services)帐户和一个Amazon Developer帐户来完成和提交技能。 Review the words you cannot use that will conflict with how Alexa responds.查看您无法使用的词,这些词会与Alexa的响应方式冲突。 Listen to the preview of your Skill. It’s extremely helpful to know your information flows.聆听您的技能预览。 了解您的信息流非常有帮助。 It’s very different creating something that is voice activated by an end user as compared to reading on a screen.与在屏幕上阅读相比,创建由最终用户语音激活的东西是非常不同的。 Pretend you are the end user when writing your Skill. It helped me understand how the user would ask Alexa for information.编写技能时,假装您是最终用户。 它帮助我了解了用户如何向Alexa询问信息。 If your Skill is not accepted review the feedback from the Alexa Skills Team. They provide great information that will help you get your skill certification ready.如果您的技能未被接受,请查看Alexa技能团队的反馈。 他们提供了重要的信息,可帮助您准备好技能证书。 If you provide improvements to one of your existing Skills, the improved Skill has to go through the same process.如果您对现有技能之一进行了改进,则改进后的技能必须经过相同的过程。 You need an icon or image for your Skill to upload with submission.您需要一个图标或图像以供您的技能上载并提交。 Once your skill is accepted and certified, it is live on Amazon.一旦您的技能被接受和认证,它就会在Amazon上发布。

I am currently working on two Skills. One uses the “Decision Tree template” and the other uses the “How To template”. These are a little more complex to build, but I’m confident will have them published soon.

我目前正在研究两项技能。 一种使用“决策树模板”,另一种使用“操作方法模板”。 这些构建起来要复杂一些,但是我相信它们会很快发布。

I also have my free Echo Dot. Interacting with this device has given me ideas for developing more Skills.

我也有免费的回声点。 与该设备互动为我提供了开发更多技能的想法。

翻译自: /news/how-to-use-your-tech-skill-to-create-alexa-skills-a3e9f210a952/

亚马逊echo中国使用

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。