chuckie.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:Project-Violet-Sloth 作者: Violet-Sloth 项目源码 文件源码
def lambda_handler(event, context):
    wotd = table.query(
        KeyConditionExpression=Key('language').eq(event['request']['intent']['slots']["Language"]["value"].lower()) & Key('id').gt(0),
        FilterExpression=Attr('isActive').eq(True)
    )
    print(wotd['Items'])
    item = wotd["Items"]
    print(item)
    parsed = '<speak>The ' + event["request"]["intent"]["slots"]["Language"]["value"] + ' word of the day is <audio src="' + item[0]["word_sound"] + \
    '"/> which means ' + item[0]["word_translation"] + \
    '. Here is the word used in a sentence. <audio src="' + item[0]["sentence_sound"] + \
    '"/> which means ' + item[0]["sentence_translation"] + '</speak>'
    response = {
        'version': '1.0',
        'response': {
            'outputSpeech': {
                'type': 'SSML',
                'ssml' : parsed
            }
        }
    }
    return response
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号