alexa_modelbuilder 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +2 -0
- data.tar.gz.sig +0 -0
- data/lib/alexa_modelbuilder.rb +80 -0
- metadata +86 -0
- metadata.gz.sig +1 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c44e124875b4740defdf51be9c5595e8350462dc
|
4
|
+
data.tar.gz: 3c020c59c2b8176bb40d22288402ef7ac161f3d3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c83b559c32bafdfe230f28ba4dd31ba93814b44c2230611b6afd8d951acf2512248c664552b5986a4f1c6ed7e362e1e39187459d7598f3b4fffef5ac1e97bdd6
|
7
|
+
data.tar.gz: 07aa420de775265458e5aa5d22bdfd33fc12436b4a26fefae47b0d40df7d0c2dddbf04604b692035d1c777a5cbfdaa5a86e7acc413c1ff3dcb7c364fa9830c8b
|
checksums.yaml.gz.sig
ADDED
data.tar.gz.sig
ADDED
Binary file
|
@@ -0,0 +1,80 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: alexa_modelbuilder.rb
|
4
|
+
|
5
|
+
|
6
|
+
require 'json'
|
7
|
+
require 'lineparser'
|
8
|
+
|
9
|
+
|
10
|
+
class AlexaModelBuilder
|
11
|
+
|
12
|
+
attr_reader :to_h, to_json
|
13
|
+
|
14
|
+
def initialize(s)
|
15
|
+
|
16
|
+
parse(s)
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def parse(lines)
|
23
|
+
|
24
|
+
patterns = [
|
25
|
+
[:root, 'invocation: :invocation', :invocation],
|
26
|
+
[:root, 'types: :types', :types],
|
27
|
+
[:types, /(.*)/, :type],
|
28
|
+
[:root, ':intent', :intent],
|
29
|
+
[:intent, ':utterance', :utterance],
|
30
|
+
[:intent, 'slots: :slots', :slots],
|
31
|
+
[:slots, /(.*)/, :slot],
|
32
|
+
[:all, /#/, :comment]
|
33
|
+
]
|
34
|
+
|
35
|
+
lp = LineParser.new patterns
|
36
|
+
r = lp.parse lines
|
37
|
+
|
38
|
+
h = {
|
39
|
+
'interactionModel' => {
|
40
|
+
'languageModel' => {
|
41
|
+
'invocationName' => '',
|
42
|
+
'intents' => [],
|
43
|
+
'types' => []
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
lm = h['interactionModel']['languageModel']
|
49
|
+
lm['invocationName'] = r[0][1].values.first
|
50
|
+
|
51
|
+
raw_intents = r.select {|x| x.first == :intent}
|
52
|
+
|
53
|
+
intents = raw_intents.map do |x|
|
54
|
+
|
55
|
+
{'name' => x[1].values.first, 'samples' => [] }
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
lm['intents'] = intents
|
60
|
+
|
61
|
+
raw_types = r.find {|x| x.first == :types}
|
62
|
+
|
63
|
+
if raw_types then
|
64
|
+
|
65
|
+
name, raw_val = raw_types[2][1].first.split(/: */)
|
66
|
+
values = raw_val.split(/, */)
|
67
|
+
|
68
|
+
types = {'name' => name, 'values' => values.map {|x| {'name' => {'value' => x }} } }
|
69
|
+
|
70
|
+
lm['types'] = types
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
@to_h = h
|
75
|
+
@to_json = h.to_json
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: alexa_modelbuilder
|
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
|
+
MIIDXjCCAkagAwIBAgIBATANBgkqhkiG9w0BAQU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7cDQmBXSxviivsX4YYNY1OGK2WkHuZi31lXOaOo0zNObswfG6UH1IBFFgNiaAH
|
29
|
+
4aH16391VH5ffyj3592yd3c4glwYF+s/KA/+Yi52GlOSSD1a8DuugLIfQar5ndiZ
|
30
|
+
EgZc9/Cpxo+WohlXR69qWm5QxX8PvdLu5ZjGD2OH5pBAPToJQyk9O8kZB9OdDMZT
|
31
|
+
tns=
|
32
|
+
-----END CERTIFICATE-----
|
33
|
+
date: 2018-06-18 00:00:00.000000000 Z
|
34
|
+
dependencies:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: lineparser
|
37
|
+
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0.1'
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 0.1.16
|
45
|
+
type: :runtime
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - "~>"
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0.1'
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.1.16
|
55
|
+
description:
|
56
|
+
email: james@jamesrobertson.eu
|
57
|
+
executables: []
|
58
|
+
extensions: []
|
59
|
+
extra_rdoc_files: []
|
60
|
+
files:
|
61
|
+
- lib/alexa_modelbuilder.rb
|
62
|
+
homepage: https://github.com/jrobertson/alexa_modelbuilder
|
63
|
+
licenses:
|
64
|
+
- MIT
|
65
|
+
metadata: {}
|
66
|
+
post_install_message:
|
67
|
+
rdoc_options: []
|
68
|
+
require_paths:
|
69
|
+
- lib
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
requirements: []
|
81
|
+
rubyforge_project:
|
82
|
+
rubygems_version: 2.6.13
|
83
|
+
signing_key:
|
84
|
+
specification_version: 4
|
85
|
+
summary: Builds an Alexa Interaction Model in JSON format from plain text
|
86
|
+
test_files: []
|
metadata.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*U��|L]�w�������`5�QF�x��w�b�=��>�zt~"�.z��=:��:®���nZ͔2=�e����m6���e_T���\��θ��պ=�p.Q&+�%�Y�я�ITd`u:Hr�jA)V�9���5uπ���s�P�q?��;K����G�,����U\���~�zZ�1K���ю�qt�/M���=�4��҂\���P@u���mk��'�_�e��ȻLF��U��_;�y�Y_���;)��v�P7!
|