【问题标题】:How to split a long speech in Alexa Amazon如何在 Alexa Amazon 中拆分长演讲
【发布时间】:2020-04-24 10:28:17
【问题描述】:

我正在 Alexa 中开发一种简单的“技能”,我会在其中问她问题,而答案是代码中的“硬编码”,因为它们是固定答案。

其中一个意图是通过“告诉我...的 9 条规则”来激活的。问题是这些规则很长,用户很快就会感到厌烦。

我希望 Alexa 告诉我规则 1、2 和 3,然后问:“你想继续听吗?”如果你说:

  • 是的,她告诉我以下三个规则,依此类推。
  • 不,她回到初始菜单,“技能调用”。

有可能这样做吗?

这是我现在拥有的那个 Intent 的代码:

class TheNineRulesIntentHandler(AbstractRequestHandler):
"""Handler for TheNineRulesIntent."""
def can_handle(self, handler_input):
    # type: (HandlerInput) -> bool
    return ask_utils.is_intent_name("TheNineRulesIntent")(handler_input)

def handle(self, handler_input):
    # type: (HandlerInput) -> Response
    speak_output = 
      "The Nine Rules are:\
    1. Long Text...\
    2. Long Text...\
    3. Long Text...\
    4. Long Text...\
    5. Long Text...\
    6. Long Text...\
    7. Long Text...\
    8. Long Text...\
    9. Long Text... "

    return (
        handler_input.response_builder
            .speak(speak_output)
            .ask(speak_output)
            .response
    )

【问题讨论】:

    标签: alexa alexa-skill


    【解决方案1】:

    【讨论】:

      【解决方案2】:

      是的,这是可能的。您需要做的就是记住 Alexa 已经说出了多少条规则(使用 Session Attriubutes。每次用户询问规则时,都会使用不长太多的规则和关于进一步聆听的问题来构建响应。

      【讨论】:

        猜你喜欢
        • 2020-05-04
        • 2022-11-17
        • 1970-01-01
        • 2012-10-22
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-02-24
        相关资源
        最近更新 更多