Exemplo n.º 1
0
def handle_story_intent(intent, alexa_session):
    s = PySSML()
    s.paragraph(
        "Once upon a time there was an old woman who loved baking gingerbread. She would bake gingerbread cookies, cakes, houses and gingerbread people, all decorated with chocolate and peppermint, caramel candies and colored frosting."
    )
    s.pause("200ms")
    s.say("Give me a")
    s.spell_slowly("Tigers", "100ms")
    s.say("Go Tigers!")

    result = {
        'version': '1.0',
        'sessionAttributes': {},
        'response': {
            'outputSpeech': s.to_object(),
            'card': {
                'type': 'Simple',
                'title': 'Story',
                'content': s.card()
            },
            'reprompt': {
                'outputSpeech': {
                    'type': 'PlainText',
                    'text': 'Are you there?'
                }
            },
            'shouldEndSession': False
        }
    }
    return result
Exemplo n.º 2
0
 def _build_ssml_title(self, title):
     """Wrap article title in SSML-compatible markup with pause at the end"""
     s = PySSML()
     s.paragraph(title)
     s.pause('500ms')
     return s.ssml(True)
Exemplo n.º 3
0
 def test_pause(self):
     s = PySSML()
     s.pause('100ms')
     self.assertEqual(s.ssml(), "<speak><break time='100ms'/></speak>")