您将如何设计字母和数字代码的插槽?
How would you design slots for letter and number codes?
我希望我的技能能够提及 4 到 5 个字符的代码,其中可以包含字母和数字,例如 AB05
或 ABC12
。我如何为 Alexa 设计插槽和话语来理解这些并将它们传递给我的技能?
您应该可以使用 AMAZON.LITERAL
作为广告位类型
{
"intent": "GetCodeIntent",
"slots": [
{
"name": "code",
"type": "AMAZON.LITERAL"
}
]
}
对于你的话语,它有点奇怪,因为你可能必须根据我的经验定义最长的话语,但如果最长的是 5 个字符,你应该能够做类似的事情
GetCodeIntent update code {one two three four five|code}
GetCodeIntent set code {one two three four five|code}
GetCodeIntent change code {one two three four five|code}
您仍将使用代码 var
引用您的意图槽
"GetCodeIntent": function (intent, session, response) {
var codeSlot = intent.slots.code;
//Do all of your amazingness with your code here
},
这个技能https://github.com/maihde/alexa-qrz是通过以下方式实现的:
意图架构
1 {
2 "intents": [
3 {
4 "intent": "GetQRZ",
5 "slots": [
6 {
7 "name": "CallSignA",
8 "type": "LETTER_OR_NUMBER"
9 },
10 {
11 "name": "CallSignB",
12 "type": "LETTER_OR_NUMBER"
13 },
14 {
15 "name": "CallSignC",
16 "type": "LETTER_OR_NUMBER"
17 },
18 {
19 "name": "CallSignD",
20 "type": "LETTER_OR_NUMBER"
21 },
22 {
23 "name": "CallSignE",
24 "type": "LETTER_OR_NUMBER"
25 },
26 {
27 "name": "CallSignF",
28 "type": "LETTER_OR_NUMBER"
29 },
30 {
31 "name": "CallSignG",
32 "type": "LETTER_OR_NUMBER"
33 }
34 ]
35 },
36 {
37 "intent": "AMAZON.YesIntent"
38 },
39 {
40 "intent": "AMAZON.NoIntent"
41 },
42 {
43 "intent": "AMAZON.StopIntent"
44 },
45 {
46 "intent": "AMAZON.CancelIntent"
47 }
48 ]
49 }
自定义栏位LETTER_OR_NUMBER
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
zero
one
two
three
four
five
six
seven
eight
nine
alfa
alpha
bravo
charlie
delta
echo
foxtrot
golf
hotel
india
juliett
juliet
kilo
lima
mike
november
oscar
papa
quebec
romeo
sierra
tango
uniform
victor
whiskey
x-ray
xray
yankee
zulu
示例话语:
GetQRZ {CallSignA} {CallSignB} {CallSignC}
GetQRZ {CallSignA} {CallSignB} {CallSignC} please
GetQRZ {CallSignA} {CallSignB} {CallSignC} stop
GetQRZ {CallSignA} {CallSignB} {CallSignC} over
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD}
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} please
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} stop
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} over
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} {CallSignE}
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} {CallSignE} please
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} {CallSignE} stop
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} {CallSignE} over
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} {CallSignE} {CallSignF}
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} {CallSignE} {CallSignF} please
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} {CallSignE} {CallSignF} stop
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} {CallSignE} {CallSignF} over
enter code here
我希望我的技能能够提及 4 到 5 个字符的代码,其中可以包含字母和数字,例如 AB05
或 ABC12
。我如何为 Alexa 设计插槽和话语来理解这些并将它们传递给我的技能?
您应该可以使用 AMAZON.LITERAL
作为广告位类型
{
"intent": "GetCodeIntent",
"slots": [
{
"name": "code",
"type": "AMAZON.LITERAL"
}
]
}
对于你的话语,它有点奇怪,因为你可能必须根据我的经验定义最长的话语,但如果最长的是 5 个字符,你应该能够做类似的事情
GetCodeIntent update code {one two three four five|code}
GetCodeIntent set code {one two three four five|code}
GetCodeIntent change code {one two three four five|code}
您仍将使用代码 var
引用您的意图槽"GetCodeIntent": function (intent, session, response) {
var codeSlot = intent.slots.code;
//Do all of your amazingness with your code here
},
这个技能https://github.com/maihde/alexa-qrz是通过以下方式实现的:
意图架构
1 {
2 "intents": [
3 {
4 "intent": "GetQRZ",
5 "slots": [
6 {
7 "name": "CallSignA",
8 "type": "LETTER_OR_NUMBER"
9 },
10 {
11 "name": "CallSignB",
12 "type": "LETTER_OR_NUMBER"
13 },
14 {
15 "name": "CallSignC",
16 "type": "LETTER_OR_NUMBER"
17 },
18 {
19 "name": "CallSignD",
20 "type": "LETTER_OR_NUMBER"
21 },
22 {
23 "name": "CallSignE",
24 "type": "LETTER_OR_NUMBER"
25 },
26 {
27 "name": "CallSignF",
28 "type": "LETTER_OR_NUMBER"
29 },
30 {
31 "name": "CallSignG",
32 "type": "LETTER_OR_NUMBER"
33 }
34 ]
35 },
36 {
37 "intent": "AMAZON.YesIntent"
38 },
39 {
40 "intent": "AMAZON.NoIntent"
41 },
42 {
43 "intent": "AMAZON.StopIntent"
44 },
45 {
46 "intent": "AMAZON.CancelIntent"
47 }
48 ]
49 }
自定义栏位LETTER_OR_NUMBER
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
zero
one
two
three
four
five
six
seven
eight
nine
alfa
alpha
bravo
charlie
delta
echo
foxtrot
golf
hotel
india
juliett
juliet
kilo
lima
mike
november
oscar
papa
quebec
romeo
sierra
tango
uniform
victor
whiskey
x-ray
xray
yankee
zulu
示例话语:
GetQRZ {CallSignA} {CallSignB} {CallSignC}
GetQRZ {CallSignA} {CallSignB} {CallSignC} please
GetQRZ {CallSignA} {CallSignB} {CallSignC} stop
GetQRZ {CallSignA} {CallSignB} {CallSignC} over
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD}
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} please
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} stop
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} over
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} {CallSignE}
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} {CallSignE} please
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} {CallSignE} stop
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} {CallSignE} over
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} {CallSignE} {CallSignF}
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} {CallSignE} {CallSignF} please
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} {CallSignE} {CallSignF} stop
GetQRZ {CallSignA} {CallSignB} {CallSignC} {CallSignD} {CallSignE} {CallSignF} over
enter code here