Introducing the alexa_modelmd gem
require 'alexa_modelmd'
wm = AlexaModelMd.new 'leo.md'
puts wm.to_xml
The above example takes a kind of Markdown file containing an Amazon Alexa model using headings, lists etc. and returns an XML representation.
file: leo.md
title: leo invocation: leo endpoint: http://a2.jamesrobertson.eu/do/leo/ask --# # Radio ## RadioPlay * play the radio * to play radio radio.play 'I am now playing the radio.' + radio # Journey ## JourneyOutbound * I'm leaving now * bye `rsc.sps.notice 'jamesio: leaving' 'Okay, bye!` ## JourneyInbound * I have arrived * I'm back `rsc.sps.notice 'jamesio: arrived' 'Welcome back!` + Journey inbound outbound
Output XML:
<?xml version='1.0' encoding='UTF-8'?> <model> <summary> <title>leo</title> <invocation>leo</invocation> <endpoint>http://a2.jamesrobertson.eu/do/leo/ask</endpoint> </summary> <entries> <entry> <topic>Radio</topic> <intents> <intent> <name>RadioPlay</name> <utterances> <utterance>play the radio</utterance> <utterance>to play the radio</utterance> </utterances> <code><![CDATA[ radio.play 'I am now playing the radio.' ]]></code> </intent> </intents> </entry> <entry> <topic>Journey</topic> <intents> <intent> <name>JourneyOutbound</name> <utterances> <utterance>I’m leaving now</utterance> <utterance>bye</utterance> </utterances> <code><![CDATA[rsc.sps.notice 'jamesio: leaving' 'Okay, bye!]]></code> </intent> <intent> <name>JourneyInbound</name> <utterances> <utterance>I have arrived</utterance> <utterance>I’m back</utterance> </utterances> <code><![CDATA[rsc.sps.notice 'jamesio: arrived' 'Welcome back!]]></code> </intent> </intents> </entry> </entries> </model>
Resources
- alexa_modelmd https://rubygems.org/gems/alexa_modelmd
alexa wikimd amazon bot model builder