alexa_modelmd 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/alexa_modelmd.rb +51 -2
- metadata +3 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b20c6194beeaa1d8fb84f9ce5a59c3f9bf549b0b7d5d5a1637e2a04747d06e21
|
|
4
|
+
data.tar.gz: 712fbd8174c146dba3bc30b56d50d771998b0c163dd72bd3fb7a0aa6a5fb6f1a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c89604e28796aafd4ed1a051d71fc960e24cad40ea9c620e5d05dd41b18bdcf1957f80ef58e2d6386fe94b798beada50b418c76d0039e8543abd61a2b133dfcd
|
|
7
|
+
data.tar.gz: dadea5aa25be37daf2dbbb62c6f6772d0403bf35e6c9c635f2fc6b465eaf5ded93b15cdca81243faded6375b9e40ad27ed7bd53b471a800a725bed7885cc9f5c
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data.tar.gz.sig
CHANGED
|
Binary file
|
data/lib/alexa_modelmd.rb
CHANGED
|
@@ -17,7 +17,7 @@ class AlexaModelMd < WikiMd
|
|
|
17
17
|
|
|
18
18
|
def initialize(s)
|
|
19
19
|
|
|
20
|
-
doc = Rexle.new("<
|
|
20
|
+
doc = Rexle.new("<root9>%s</root9>" % \
|
|
21
21
|
Kramdown::Document.new(Martile.new(s).to_s).to_html)
|
|
22
22
|
@name = doc.root.element('h2/text()').to_s
|
|
23
23
|
@utterances = doc.root.xpath('ul/li/text()').map(&:to_s)
|
|
@@ -42,6 +42,13 @@ class AlexaModelMd < WikiMd
|
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
end
|
|
45
|
+
|
|
46
|
+
# This generates a plain text file representing the Alexa Model to be
|
|
47
|
+
# built using the alexa_modelbuilder gem
|
|
48
|
+
#
|
|
49
|
+
def to_modelb
|
|
50
|
+
Rexslt.new(modelbuilder_xslt(), to_xml()).to_s
|
|
51
|
+
end
|
|
45
52
|
|
|
46
53
|
def to_xml()
|
|
47
54
|
|
|
@@ -91,5 +98,47 @@ class AlexaModelMd < WikiMd
|
|
|
91
98
|
Rexle.new(a).xml pretty: true
|
|
92
99
|
|
|
93
100
|
end
|
|
94
|
-
|
|
101
|
+
|
|
102
|
+
private
|
|
103
|
+
|
|
104
|
+
def modelbuilder_xslt()
|
|
105
|
+
<<EOF
|
|
106
|
+
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
|
|
107
|
+
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
|
|
108
|
+
|
|
109
|
+
<xsl:template match='model'>name: <xsl:value-of select='summary/title' />
|
|
110
|
+
invocation: <xsl:value-of select='summary/invocation' />
|
|
111
|
+
<xsl:text>
|
|
112
|
+
</xsl:text>
|
|
113
|
+
<xsl:apply-templates select='entries/entry' />
|
|
114
|
+
endpoint: <xsl:value-of select='summary/endpoint' />
|
|
115
|
+
|
|
116
|
+
</xsl:template>
|
|
117
|
+
|
|
118
|
+
<xsl:template match='entries/entry'>
|
|
119
|
+
# <xsl:value-of select='topic' /><xsl:text>
|
|
120
|
+
</xsl:text>
|
|
121
|
+
<xsl:apply-templates select='intents/intent' />
|
|
122
|
+
</xsl:template>
|
|
123
|
+
|
|
124
|
+
<xsl:template match='intents/intent'>
|
|
125
|
+
<xsl:text>
|
|
126
|
+
</xsl:text>
|
|
127
|
+
<xsl:value-of select='name' />
|
|
128
|
+
<xsl:apply-templates select='utterances/utterance' />
|
|
129
|
+
<xsl:text>
|
|
130
|
+
</xsl:text>
|
|
131
|
+
</xsl:template>
|
|
132
|
+
|
|
133
|
+
<xsl:template match='utterances/utterance'>
|
|
134
|
+
<xsl:text>
|
|
135
|
+
</xsl:text>
|
|
136
|
+
<xsl:value-of select='.' />
|
|
137
|
+
|
|
138
|
+
</xsl:template>
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
</xsl:stylesheet>
|
|
142
|
+
EOF
|
|
143
|
+
end
|
|
95
144
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: alexa_modelmd
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- James Robertson
|
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
|
35
35
|
RiKpAQ+I6BbdLUJTK2K+PB/nbZ6mul1+aS64XsSo/h49h7MP3lGxHFZyfX1RuE4j
|
|
36
36
|
Uv6UCmrr9La+izsyIDyQli0u
|
|
37
37
|
-----END CERTIFICATE-----
|
|
38
|
-
date: 2019-01
|
|
38
|
+
date: 2019-02-01 00:00:00.000000000 Z
|
|
39
39
|
dependencies:
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: wiki_md
|
|
@@ -87,5 +87,5 @@ rubygems_version: 3.0.2
|
|
|
87
87
|
signing_key:
|
|
88
88
|
specification_version: 4
|
|
89
89
|
summary: Using a WikiMd foramtted document, generates a basic Amazon Alexa model in
|
|
90
|
-
XML format, as well as other formats
|
|
90
|
+
XML format, as well as other formats.
|
|
91
91
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|