alexa_modelmd 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: '0962283dce62f578e6098b4e9c1cf534310e8ecdc64d70c4c5c6283fe352d337'
4
+ data.tar.gz: 9678af1d084f391252d9df8617e57724454aa44c244228b7e704041a356049c1
5
+ SHA512:
6
+ metadata.gz: e7def1132cebf82be7d36532ee52f0584ac20fd3b65eaca1c523cbac6490c118b146270ef3610d7b89174592c9f8b758aeeba5c46f2f598cd0b571aaa591cf88
7
+ data.tar.gz: cc790962d939851a4a83fcecdd275f37d7ca42ee2746723acbe1a34e699c966877f43a9ecdfee0387c410791ce3b34a967469660bd68ff265b8b50d1f64b4813
checksums.yaml.gz.sig ADDED
Binary file
data.tar.gz.sig ADDED
Binary file
@@ -0,0 +1,95 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: alexa_modelmd.rb
4
+
5
+ # description: Using a WikiMd foramtted document, generates a basic Amazon
6
+ # Alexa model in XML format, as well as other formats ... soon.
7
+
8
+
9
+ require 'wiki_md'
10
+
11
+
12
+ class AlexaModelMd < WikiMd
13
+
14
+ class Intent
15
+
16
+ attr_reader :name, :utterances, :code
17
+
18
+ def initialize(s)
19
+
20
+ doc = Rexle.new("<root>%s</root>" % \
21
+ Kramdown::Document.new(Martile.new(s).to_s).to_html)
22
+ @name = doc.root.element('h2/text()').to_s
23
+ @utterances = doc.root.xpath('ul/li/text()').map(&:to_s)
24
+ @code = doc.root.element('//code/text()').to_s
25
+
26
+ end
27
+
28
+ end
29
+
30
+ def entries()
31
+
32
+ r = super()
33
+
34
+ r.map do |entry|
35
+
36
+ def entry.intents()
37
+ self.body().split(/(?=^## )/).map {|x| Intent.new(x)}
38
+ end
39
+
40
+ entry
41
+
42
+ end
43
+
44
+ end
45
+
46
+ def to_xml()
47
+
48
+ a = RexleBuilder.build do |xml|
49
+
50
+ xml.model do
51
+
52
+ xml.summary do
53
+ xml.title @dxsx.dx.title
54
+ xml.invocation @dxsx.dx.invocation
55
+ xml.endpoint @dxsx.dx.endpoint
56
+ end
57
+
58
+ xml.entries do
59
+ entries.each do |entry|
60
+
61
+ xml.entry do
62
+ xml.topic entry.heading
63
+
64
+ xml.intents do
65
+ entry.intents.each do |intent|
66
+
67
+ xml.intent do
68
+
69
+ xml.name intent.name
70
+
71
+ xml.utterances do
72
+ intent.utterances.each do |utterance|
73
+ xml.utterance utterance
74
+ end
75
+ end
76
+
77
+ xml.code do
78
+ xml.cdata! intent.code
79
+ end
80
+ end #/intent
81
+ end
82
+ end #/intents
83
+
84
+ end
85
+ end
86
+ end #/entries
87
+
88
+ end #/model
89
+ end
90
+
91
+ Rexle.new(a).xml pretty: true
92
+
93
+ end
94
+
95
+ end
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: alexa_modelmd
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
14
+ YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTkwMTMwMTUwNDAxWhcN
15
+ MjAwMTMwMTUwNDAxWjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
16
+ cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQChhg29
17
+ Utz2a0AcnBz1y7sE0siVEKTtEoijE9LIdHJFrXTwaglCd6lCdHD+safoojXWOEBv
18
+ 1zxRtd501uGDq4WXJXSRSC6RSuJginkJfqHGtaJNxMsyYwJk8hSt/Pf1aMS+KM7L
19
+ c6hVvoXuDDHY6q+pCqrIpYKXnkh6q6p9rXvjX8kbsjxN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pAQ+I6BbdLUJTK2K+PB/nbZ6mul1+aS64XsSo/h49h7MP3lGxHFZyfX1RuE4j
36
+ Uv6UCmrr9La+izsyIDyQli0u
37
+ -----END CERTIFICATE-----
38
+ date: 2019-01-30 00:00:00.000000000 Z
39
+ dependencies:
40
+ - !ruby/object:Gem::Dependency
41
+ name: wikimd
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '0.7'
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 0.7.5
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - "~>"
55
+ - !ruby/object:Gem::Version
56
+ version: '0.7'
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: 0.7.5
60
+ description:
61
+ email: james@jamesrobertson.eu
62
+ executables: []
63
+ extensions: []
64
+ extra_rdoc_files: []
65
+ files:
66
+ - lib/alexa_modelmd.rb
67
+ homepage: https://github.com/jrobertson/alexa_modelmd
68
+ licenses:
69
+ - MIT
70
+ metadata: {}
71
+ post_install_message:
72
+ rdoc_options: []
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubygems_version: 3.0.2
87
+ signing_key:
88
+ specification_version: 4
89
+ summary: Using a WikiMd foramtted document, generates a basic Amazon Alexa model in
90
+ XML format, as well as other formats ... soon.
91
+ test_files: []
metadata.gz.sig ADDED
Binary file