コード例 #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
コード例 #2
0
ファイル: test_pyssml.py プロジェクト: Jaidan/pyssml
 def test_to_object(self):
     s = PySSML()
     s.say("Hello")
     s.paragraph("Nick")
     self.assertEqual(s.to_object(), {
         "type": 'SSML',
         "speech": "<speak>Hello <p>Nick</p></speak>"
     })