Exemplo n.º 1
0
    def get_menu_ssml(self, include_dishes=True):
        """Get menu for this meal as SSML (speech synthesis markup language)

        https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/speech-synthesis-markup-language-ssml-reference
        """
        from htk.utils import lookahead
        meal_dict = copy.copy(self.meal)
        dishes = self.get_pretty_dishes(ssml=True)
        dishes = [('<p>%s%s</p>' % ('' if has_more else 'and ', dish,)) for dish, has_more in lookahead(dishes)]
        meal_dict['restaurant_cuisine'] = ssml_sanitized(meal_dict['restaurant_cuisine'])
        meal_dict['restaurant_name'] = ssml_sanitized(meal_dict['restaurant_name'])
        meal_dict['dishes'] = ', '.join(dishes)
        ssml = """<speak>%(restaurant_cuisine)s cuisine from <emphasis level="moderate">%(restaurant_name)s</emphasis>, with %(dishes)s</speak>""" % meal_dict
        return ssml
Exemplo n.º 2
0
    def get_menu_ssml(self, include_dishes=True):
        """Get menu for this meal as SSML (speech synthesis markup language)

        https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/speech-synthesis-markup-language-ssml-reference
        """
        from htk.utils import lookahead
        meal_dict = copy.copy(self.meal)
        dishes = self.get_pretty_dishes(ssml=True)
        dishes = [('<p>%s%s</p>' % (
            '' if has_more else 'and ',
            dish,
        )) for dish, has_more in lookahead(dishes)]
        meal_dict['restaurant_cuisine'] = ssml_sanitized(
            meal_dict['restaurant_cuisine'])
        meal_dict['restaurant_name'] = ssml_sanitized(
            meal_dict['restaurant_name'])
        meal_dict['dishes'] = ', '.join(dishes)
        ssml = """<speak>%(restaurant_cuisine)s cuisine from <emphasis level="moderate">%(restaurant_name)s</emphasis>, with %(dishes)s</speak>""" % meal_dict
        return ssml
Exemplo n.º 3
0
 def get_ssml_phrase(self):
     dish = self._get_dict()
     dish['name'] = ssml_sanitized(dish['name'])
     dish['description'] = ssml_sanitized(dish['description'])
     ssml_phrase = '<emphasis level="moderate">%(name)s</emphasis><break strength="medium" /> made from %(description)s' % dish
     return ssml_phrase
Exemplo n.º 4
0
 def get_ssml_phrase(self):
     dish = self._get_dict()
     dish['name'] = ssml_sanitized(dish['name'])
     dish['description'] = ssml_sanitized(dish['description'])
     ssml_phrase = '<emphasis level="moderate">%(name)s</emphasis><break strength="medium" /> made from %(description)s' % dish
     return ssml_phrase