我是编写Alexa技能的新手,我想写一种技能来存储演讲者的话。
例如,如果我说,'Alexa,save {无论我说什么}‘,它应该将单词保存在某个字符串中。
据我所知,意图模式应该是这样的
{
intents:[
"intent" : "SaveIntent"
]
}以及像这样的话语
SaveIntent save
SaveIntent store在这种情况下,我该如何存储‘{ this say}'?
发布于 2016-05-17 06:17:04
要捕获自由格式的语音输入(而不是定义的可能值列表),需要使用AMAZON.LITERAL插槽类型。Amazon documentation for the Literal slot type描述了一个与您的用例类似的用例,其中创建了一个技能,用于获取任何短语并将其发布到社交媒体站点。这是通过创建StatusUpdate意图来完成的:
{
"intents": [
{
"intent": "StatusUpdate",
"slots": [
{
"name": "UpdateText",
"type": "AMAZON.LITERAL"
}
]
}
]
}因为它使用AMAZON.LITERAL插槽类型,所以这种意图将能够捕获任何任意短语。但是,为了确保语音引擎能够很好地捕获真实世界中的短语,您需要提供与您期望用户所说的内容相似的各种示例语句。
假设在您描述的场景中,您正在尝试捕获非常动态的短语,那么在文档中有几件事您需要额外考虑:
如果您使用AMAZON.LITERAL类型来收集可能存在于槽中的字数变化很大的自由格式文本,请注意以下事项:
涵盖整个范围(最小、最大和所有范围)的
冗长的口语输入可能会导致准确性体验降低,因此避免设计需要多个单词作为时隙值的口语界面。对于时隙值来说,用户不停顿就无法说出的短语太长了。
也就是说,下面是文档中的示例语句:
StatusUpdate发布更新{已到达|更新文本}
StatusUpdate发布更新{晚餐时间|更新文本}
StatusUpdate发布更新{out at lunch|UpdateText} ...(更多示例显示4-10个单词的短语)
StatusUpdate发布更新{今晚将在杂货店停留|更新文本}
如果您提供了足够的不同长度的示例来准确描述预期用户话语的范围,那么您的意图将能够准确地捕获实际用例中的动态短语,您可以在UpdateText插槽中访问这些动态短语。在此基础上,您应该能够实现特定于您需求的意图。
发布于 2018-11-16 16:39:05
重要提示:从2018年10月22日起,不推荐使用AMAZON.LITERAL。使用AMAZON.LITERAL构建的旧技能仍然有效,但当您更新这些旧技能和所有新技能时,您必须从AMAZON.LITERAL迁移。
你可以不使用AMAZON.LITERAL,而是使用一个自定义的槽来欺骗alexa将自由流动的文本传递到后端。
您可以使用此配置来执行此操作:
{
"interactionModel": {
"languageModel": {
"invocationName": "siri",
"intents": [
{
"name": "SaveIntent",
"slots": [
{
"name": "text",
"type": "catchAll"
}
],
"samples": [
"{text}"
]
}
],
"types": [
{
"name": "catchAll",
"values": [
{
"name": {
"value": "allonymous isoelectrically salubrity apositia phantomize Sangraal externomedian phylloidal"
}
},
{
"name": {
"value": "imbreviate Bertie arithmetical undramatically braccianite eightling imagerially leadoff"
}
},
{
"name": {
"value": "mistakenness preinspire tourbillion caraguata chloremia unsupportedness squatarole licitation"
}
},
{
"name": {
"value": "Cimbric sigillarid deconsecrate acceptableness balsamine anostosis disjunctively chafflike"
}
},
{
"name": {
"value": "earsplitting mesoblastema outglow predeclare theriomorphism prereligious unarousing"
}
},
{
"name": {
"value": "ravinement pentameter proboscidate unexigent ringbone unnormal Entomophila perfectibilism"
}
},
{
"name": {
"value": "defyingly amoralist toadship psoatic boyology unpartizan merlin nonskid"
}
},
{
"name": {
"value": "broadax lifeboat progenitive betel ashkoko cleronomy unpresaging pneumonectomy"
}
},
{
"name": {
"value": "overharshness filtrability visual predonate colisepsis unoccurring turbanlike flyboy"
}
},
{
"name": {
"value": "kilp Callicarpa unforsaken undergarment maxim cosenator archmugwump fitted"
}
},
{
"name": {
"value": "ungutted pontificially Oudenodon fossiled chess Unitarian bicone justice"
}
},
{
"name": {
"value": "compartmentalize prenotice achromat suitability molt stethograph Ricciaceae ultrafidianism"
}
},
{
"name": {
"value": "slotter archae contrastimulant sopper Serranus remarry pterygial atactic"
}
},
{
"name": {
"value": "superstrata shucking Umbrian hepatophlebotomy undreaded introspect doxographer tractility"
}
},
{
"name": {
"value": "obstructionist undethroned unlockable Lincolniana haggaday vindicatively tithebook"
}
},
{
"name": {
"value": "unsole relatively Atrebates Paramecium vestryish stockfish subpreceptor"
}
},
{
"name": {
"value": "babied vagueness elabrate graphophonic kalidium oligocholia floccus strang"
}
},
{
"name": {
"value": "undersight monotriglyphic uneffete trachycarpous albeit pardonableness Wade"
}
},
{
"name": {
"value": "minacious peroratory filibeg Kabirpanthi cyphella cattalo chaffy savanilla"
}
},
{
"name": {
"value": "Polyborinae Shakerlike checkerwork pentadecylic shopgirl herbary disanagrammatize shoad"
}
}
]
}
]
}
}
}发布于 2018-04-04 00:45:13
您可以尝试使用插槽类型AMAZON.SearchQuery。所以你的意图应该是这样的
{
"intents": [
{
"intent": "SaveIntent",
"slots": [
{
"name": "UpdateText",
"type": "AMAZON.SearchQuery"
}
]
}
]
}https://stackoverflow.com/questions/37249475
复制相似问题