- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
Alexa 技能适用于第一个问题,但不适用于第二个问题。这是一个使用以下数组的困惑字母测验
var arr = [{"Q":"dcha","A":"chad"},{"Q":"goto","A":"togo"},{"Q":"alim","A":"mali"}];
多哥的 JSON 输出
{
"version": "1.0",
"session": {
"new": false,
"sessionId": "amzn1.echo-api.session.9dfd014c-e3b7-489c-bdeb-f5771de1ca6b",
"application": {
"applicationId": "amzn1.ask.skill.f2d596ad-f75b-48fc-a48e-c7eb48ad8415"
},
"attributes": {
"Game": {
"count": 3,
"score": 1,
"index": 1,
"end": 0
}
},
"user": {
"userId": "amzn1.ask.account.AETGLHBMP4M7D4AOVQ2ZHB74O7XLYO66NDYSYVOKWBF4TQCINSUCRQTIIPTV3LIIVONHKX3B5LYKCLDXRWWVZWMMMPJXVAZZML63IJDB3AD5FBP4MNOIPOKJLXGSPN6BFM4CJJI5NIMROXVML5EIRWYJBB6CQBQRMROWVNJPXI4MQCH6ITJEJIVSJFD3DW54DEZNQS4QWAJXHLY"
}
},
"context": {
"System": {
"application": {
"applicationId": "amzn1.ask.skill.f2d596ad-fa48e-c7eb48ad8415"
},
"user": {
"userId": "amzn1.ask.account.AETGLHBMP4M7D4AOVQ2ZHB74O7XLYO66NDYSYVOKWBF4TQCINSUCRQTIIPTV3LIIVONHKX3B5LYKCLDXRWWVZWMMMPJXVAZZML63IJDB3AD5FBP4MNOIPOKJLXGSPN6BFM4CJJI5NIMROXVML5EIRWYJBB6CQBQRMROWVNJQWAJXHLY"
},
"device": {
"deviceId": "amzn1.ask.device.AF2B7XVYMPUBHAESIYFYP7NNPRBBONKYO2Y6BEVNUZGCFAR3CHFFQS7CJVD4GYLJIC3VBJLMDWKSP4SWNY4QLJPHIBIY7LS3J43Y4VJIO45WERQHOXW6IKBPKAC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P_O8pcJMhN_H8xLfDroxmoHzjVfXKRPP02s6BCzWFbDmV1VrUDB0FRocGUHGOvhfnk-kLbdwnsRHLgutjaiXg"
}
},
"request": {
"type": "IntentRequest",
"requestId": "amzn1.echo-api.request.6864f5ff-45a9--58373e035519",
"timestamp": "2018-09-03T16:04:04Z",
"locale": "en-US",
"intent": {
"name": "AnswerIntent",
"confirmationStatus": "NONE",
"slots": {
"LetterOne": {
"name": "LetterOne",
"value": "T.",
"resolutions": {
"resolutionsPerAuthority": [
{
"authority": "amzn1.er-authority.echo-sdk.amzn1.ask.skill.-f75b-48fc-a48e-c7eb48ad8415.Alphabets",
"status": {
"code": "ER_SUCCESS_MATCH"
},
"values": [
{
"value": {
"name": "t",
"id": "e358efa489f58062f10dd7316b65649e"
}
}
]
}
]
},
"confirmationStatus": "NONE"
},
"Guess": {
"name": "Guess",
"value": "Togo",
"resolutions": {
"resolutionsPerAuthority": [
{
"authority": "amzn1.er-authority.echo-sdk.amzn1.ask.skill.f2d596ad-f75b-48fc-a48e-c7eb48ad8415.Answers",
"status": {
"code": "ER_SUCCESS_MATCH"
},
"values": [
{
"value": {
"name": "togo",
"id": "da6f471bab1662dafc3e6845c312dd5f"
}
}
]
}
]
},
"confirmationStatus": "NONE"
},
"LetterFour": {
"name": "LetterFour",
"value": "O.",
"resolutions": {
"resolutionsPerAuthority": [
{
"authority": "amzn1.er-authority.echo-sdk.amzn1.ask.skill.-f75b-48fc-a48e-c7eb48ad8415.Alphabets",
"status": {
"code": "ER_SUCCESS_MATCH"
},
"values": [
{
"value": {
"name": "o",
"id": "d95679752134a2d9eb61dbd7b91c4bcc"
}
}
]
}
]
},
"confirmationStatus": "NONE"
},
"LetterTwo": {
"name": "LetterTwo",
"value": "O.",
"resolutions": {
"resolutionsPerAuthority": [
{
"authority": "amzn1.er-authority.echo-sdk.amzn1.ask.skill.-f75b-48fc-a48e-c7eb48ad8415.Alphabets",
"status": {
"code": "ER_SUCCESS_MATCH"
},
"values": [
{
"value": {
"name": "o",
"id": "d95679752134a2d9eb61dbd7b91c4bcc"
}
}
]
}
]
},
"confirmationStatus": "NONE"
},
"LetterThree": {
"name": "LetterThree",
"value": "g.",
"resolutions": {
"resolutionsPerAuthority": [
{
"authority": "amzn1.er-authority.echo-sdk.amzn1.ask.skill.-f75b-48fc-a48e-c7eb48ad8415.Alphabets",
"status": {
"code": "ER_SUCCESS_MATCH"
},
"values": [
{
"value": {
"name": "g",
"id": "b2f5ff47436671b6e533d8dc3614845d"
}
}
]
}
]
},
"confirmationStatus": "NONE"
}
}
}
}
}
"user strict";
var Alexa = require('alexa-sdk');
var arr = [{"Q":"dcha","A":"chad"},{"Q":"goto","A":"togo"},{"Q":"alim","A":"mali"}];
exports.handler = function(event,context,callback) {
var alexa = Alexa.handler(event,context, callback);
alexa.dynamoDBTableName = "CountryLetters";
alexa.appId = "amzn1.ask.skill.f2d596ad-c7eb48ad8415";
alexa.registerHandlers(handler);
initialize(event, function() {
alexa.execute();
});
};
function initialize(event, callback){
if(event.session.attributes.Game === undefined) {
event.session.attributes.Game = {};
}
callback();
}
function getWish() {
var myDate = new Date();
var hours = myDate.getUTCHours();
if (hours < 0) {
hours = hours + 24;
}
if (hours < 12) {
return "Morning ";
} else if (hours < 18) {
return "Afternoon ";
} else {
return "Evening ";
}
}
var handler = {
"start" : function(){
this.attributes.Game.score = 0;
this.attributes.Game.index = 0;
this.attributes.Game.count = 3;
var question = arr[0].Q;
var q = "<break time='0.5s'/>" + question.split('').join("<break time='0.5s'/>") + "<break time='0.5s'/>";
var qc = question.split('').join(" ") ;
var speech = "Welcome to Jumbled Letters, let's begin, here are your jumbled letters " + q + " . Guess the word, you have 3 attempts left ";
this.emit(":askWithCard",speech,speech,"Jumbled letters",qc);
},
"resume" : function(){
var index = this.attributes.Game.index;
var count = this.attributes.Game.count;
var question = arr[index].Q;
var q = "<break time='0.5s'/>" + question.split('').join("<break time='0.5s'/>") + "<break time='0.5s'/>";
var qc = question.split('').join(" ") ;
var speech = "Welcome back, here are your jumbled letters " + q + " . Guess the word, you have " + count + " attempts left ";
this.emit(":askWithCard",speech,speech,"Jumbled letters",qc);
},
"LaunchRequest": function(){
if(this.attributes.Game.score === undefined){
this.emit('start');
}else if(this.attributes.Game.end === 1){
var score = this.attributes.Game.score;
var speech1 = "I have asked all the questions that I have, you have scored " + score + " If you wish to delete this game and start over again, say delete my previous game.";
this.emit(":askWithCard",speech1,speech1,"The End","You have played all the thirty questions, to start over say, DELETE MY GAME");
}else{
var speech = "You have already played the game. Your score is " + this.attributes.Game.score + " . To resume your game say, resume my game, or to delete your previous game and start again, say delete my previous game ";
this.emit(':askWithCard',speech,speech,"Game Already Exists","To resume say, RESUME MY GAME or to delete say, DELETE MY GAME");
}
},
"AMAZON.StartOverIntent" : function(){
if(this.attributes.Game.score === undefined){
this.emit('start');
}else if(this.attributes.Game.end === 1){
var score = this.attributes.Game.score;
var speech1 = "I have asked all the questions that I have, you have scored " + score + " If you wish to delete this game and start over again, say delete my previous game.";
this.emit(":askWithCard",speech1,speech1,"The End","You have played all the thirty questions, to start over say, DELETE MY GAME");
}else{
var speech = "You have already played the game. Your score is " + this.attributes.Game.score + " . To resume your game say, resume my game, or to delete your previous game and start again, say delete my previous game ";
this.emit(':askWithCard',speech,speech,"Game Already Exists","To resume say, RESUME MY GAME or to delete say, DELETE MY GAME");
}
},
"AnswerIntent" : function(){
var guess = this.event.request.intent.slots.Guess.value;
var l1 = this.event.request.intent.slots.LetterOne.value;
var l2 = this.event.request.intent.slots.LetterTwo.value;
var l3 = this.event.request.intent.slots.LetterThree.value;
var l4 = this.event.request.intent.slots.LetterFour.value;
var index = this.attributes.Game.index;
var count = this.attributes.Game.count;
var answer = arr[index].A;
var a = answer.split('');
if(guess !== undefined && l1 !== undefined && l2 !== undefined && l3 !== undefined && l4 !== undefined){
l1 = l1.toLowerCase();
l2 = l2.toLowerCase();
l3 = l3.toLowerCase();
l4 = l4.toLowerCase();
if(guess === answer && (l1 === a[0] || l1 === a[0] + ".") && (l2 === a[1] || l2 === a[1] + ".") && (l3 === a[2] || l3 === a[2] + ".") && (l4 === a[3] || l4 === a[3] + ".") ){
this.attributes.Game.score += 1;
var score = this.attributes.Game.score;
var speech = "Good job, you have guessed it right in " + (4-count) + " attempts. Your score is " + score + " . Do you wish to play again? say Yes to play again and No to quit.";
this.emit(":askWithCard",speech,speech, "Good Job", "Score is " + score + ". To play again say, YES or to quit say, NO");
}else{
this.attributes.Game.count -= 1;
count = this.attributes.Game.count;
var question = arr[index].Q;
var q = "<break time='0.5s'/>" + question.split('').join("<break time='0.5s'/>") + "<break time='0.5s'/>";
if(count > 0){
var speech1 = "Please try again, your jumbled letters were " + q + ". You have " + count + " attempts left";
this.emit(":askWithCard",speech1,speech1,"Attempts Left: " + count, " Try again, your guess " + l1 + " "+ l2 + " "+l3 + " "+ l4 + " " + guess + " is incorrect");
}else{
var ans = "<break time='0.5s'/>" + answer.split('').join("<break time='0.5s'/>") + "<break time='0.5s'/>";
var speech2 = "Sorry, there are no attempts left, the correct word is " + ans + answer + ". Do you wish to play again? say Yes to play again and No to quit";
this.emit(":askWithCard",speech2,speech2,"NO MORE ATTEMPTS LEFT", "The correct word is " + answer);
}
}
}else{
this.emit(":askWithCard","Please guess by spelling out the word","Please guess by spelling out the word","Please Spell the Word","The guess should have the letters spelled out in the right order, followed by the word after that");
}
},
"AMAZON.YesIntent" : function(){
if(this.attributes.Game.index === arr.length - 1){
this.attributes.Game.end = 1;
var score = this.attributes.Game.score;
var speech = "I have asked all the questions that I have, you have scored " + score + " If you wish to delete this game and start over again, say delete my previous game.";
this.emit(":askWithCard",speech,speech,"The End","You have played all the thirty questions, to start over say, DELETE MY GAME");
}else{
this.attributes.Game.index += 1;
this.attributes.Game.count = 3;
this.emit('resume');
}
},
"AMAZON.NoIntent" : function(){
if(this.attributes.Game.index === arr.length - 1){
this.attributes.Game.end = 1;
this.emit(":tell","Thank You");
}else{
this.attributes.Game.index += 1;
this.attributes.Game.count = 3;
this.emit(":tell","Thank you");
}
},
"AMAZON.ResumeIntent" : function(){
if(this.attributes.Game.score === undefined){
var speech = "You have not started the game yet, to start the game say, start a game";
this.emit(":ask",speech,speech);
}
else if(this.attributes.Game.end === 1){
var score = this.attributes.Game.score;
var speech1 = "I have asked all the questions that I have, you have scored " + score + " If you wish to delete this game and start over again, say delete my previous game.";
this.emit(":askWithCard",speech1,speech1,"The End","You have played all the 10 questions, to start over say, DELETE MY GAME");
}else{
this.emit('resume');
}
},
"DeleteIntent" : function(){
if(this.attributes.Game.score === undefined){
var speech = "You have not started the game yet, to start the game say, start a game";
this.emit(":ask",speech,speech);
}else{
this.attributes.Game.end = 0;
this.emit('start');
}
},
"AMAZON.StopIntent" : function(){
this.emit(":tell","Thank you");
},
"AMAZON.CancelIntent" : function(){
this.emit(":tell","Thank you");
},
"AMAZON.HelpIntent" : function(){
this.emit(":askWithCard","I will spell out the jumbled letters of a meaningful word, you have to guess the word by spelling out the letters in the right order and also tell the word, to continue say, resume my game, or to start from the begining say, delete my previous game.","I will spell out the jumbled letters of a meaningful word, you have to guess the word by spelling out the letters in the right order and also tell the word, to continue say, resume my game, or to start from the begining say, delete my previous game.","Help","I will spell out the jumbled letters of a meaningful word, you should guess the word by spelling it out in the Right order and tell the word. For example, a guess should be like B A N K BANK");
},
'Unhandled' : function(){
this.emit("tell", "I did not get any response from you, please open the skill again");
}
};
检查了 Alexa 技能套件仪表板上的插槽值和类型,并确保它们与 3 个国家/地区匹配,也不适用于马里
最佳答案
我认为问题是你没有在正确答案上增加索引变量。给定您的示例对话框,如果您开始游戏,给出答案,然后再次开始游戏,而不说"is",索引将保持在 0。在这种情况下,下一个答案“togo”仍然与“chad”进行比较。
关于javascript - Alexa 技能 : Works for the first question but not the second question,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52162379/
Alexa 技能适用于第一个问题,但不适用于第二个问题。这是一个使用以下数组的困惑字母测验 var arr = [{"Q":"dcha","A":"chad"},{"Q":"goto","A":"to
我正在制作一个小问答 ios 应用程序。我希望第一个问题是随机的。我的代码如下。 let allQuestions = QuestionBank() var pickedAnswer : Bool =
我对 Dialogflow 比较陌生,我正在尝试创建一个医疗保健诊断语音聊天机器人,其工作方式如下。 用户体验 用户调用系统并受到聊天机器人的欢迎。 聊天机器人开始询问与分流相关的问题(例如,“您有慢
我正在尝试将一个表单(包含测试问题)提交到一个名为 Questions 的 mongo 集合中。我已经引用了运行服务器端代码的文件,我认为它应该都可以正常工作。这是我的代码: //add.html
import 'dart:async'; import 'question.dart'; import 'package:http/http.dart' as http; import 'dart:c
我想添加用户输入到列表中的任何字符串 run :- write('How many students you have: '),read(x),nl. enterNameOfStuden
我正在努力提高我的 JAVA 水平。现在我有一个关于线程的问题我不明白。 我尝试的代码是这样的, public class MyThread implements Runnable { pri
我正在为一个项目构建一个 XML 反序列化器,我经常遇到这种类型的代码情况: var myVariable = ParseNDecimal(xml.Element("myElement")) == n
我有一个 JSF 页面,它将创建一个新的 Comment。我将该页面的托管 bean 设为 RequestScoped 托管 bean。 @ManagedBean(name="PostComment"
房间和应用程序之间存在一对一的关系,意味着应用程序必须占用一个房间。如果我想获取未被应用占用的房间,如何写sql查询 最佳答案 select * from room r where not exist
我有一个 css 布局,其中我有一个单页网站 问题是我不想要滚动条所以我确实隐藏了溢出并且它工作正常但是当有不同的屏幕分辨率时,所以底部的内容被切断有没有办法解决这个问题 我的意思是,当内容适合首页时
我做了一个简单的算法,用于将整数转换为二进制,并将二进制作为字符串返回。目前,这些位被添加到列表的前面。在每一步连接字符串而不是附加到列表会更有效(就时间或空间而言)吗?为什么/为什么不? def t
我经常听说 mongodb 可以在一个集合级别执行原子性。您知道为什么以及如何将其与分片联系起来吗? replication 和 replicasets 之间的唯一区别是两者都是主/从(主要/次要),
我有几个关于线程的问题。能否请您澄清一下。 假设进程有一个或多个线程。如果进程被抢占/挂起,线程是否也被抢占或线程是否继续运行? 当挂起的进程被重新调度时,进程线程是否也被调度了?如果进程有进程有多个
我最近接受了一次采访,他问我单例设计模式是如何实现的,我告诉他使用静态变量和静态方法我们可以实现单例设计模式。 他似乎对答案满意但我想知道 我们可以有多少种不同的方式实现单例设计模式在 Java 中?
我以前使用 has_and_belongs_to_many,并已转换为 has_many :through。下面是它如何查找可以有很多用户玩的游戏列表。有了这个,我可以做 game.users 和 u
这是我的代码的骨架: var myArray: (Array | null); if (cnd) { myArray = []; myArray?.push(elt); // Question
使用ORLite时放置sqlite_unicode设置的正确位置在哪里? 最佳答案 不幸的是,没有一个真正好的地方。请参阅bug #61191: Enable sqllite_unicode in t
我承认我已经有一段时间没有使用 Perl 了,但这让我很难过。 这是问题: #!/usr/bin/perl use CGI::Carp qw(fatalsToBrowser); use DBI; pr
我有一个名为 Question 的模型。模型允许用户创建新问题。我正在尝试使用对象查询集填充多个表单。当我尝试使用查询集进行初始化时,会出现问题。我收到此错误 'Question' object i
我是一名优秀的程序员,十分优秀!