alexa_modelbuilder 0.2.1 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d23646bfea4deb8765ec5664ee8958475523fd7
4
- data.tar.gz: 96567d60c6137fa69cdcbefb55c18f4618b04259
3
+ metadata.gz: 7adaae5e55c22c5a56b8638f9d4136ccd3c26f79
4
+ data.tar.gz: 415679be2f5e3495c35aa270dd32d2bb44128e61
5
5
  SHA512:
6
- metadata.gz: dd5fa1f4b63dd4621567cb38e2cf1199bd60cc07a297078ac1d21f59d95d8785f5418be959a75ea02e6a07c19f23ec42590bbf054cf32c07ecdefee3d9b1fa04
7
- data.tar.gz: fca4f608d6480c91d34222dbc43f4a085fe86ffb268555d19c9ddc9b52dc68898b1273c4c471f8f2e5daba4e7fc674976924107e60b8fe0b5a3c729e07b30a34
6
+ metadata.gz: 967e8ca5b53a155590556be2647677325514d92e74706044846d02aa5287e51e4e7364d54696196ce5f38d1b165cf3ae9e390a98687a01eba1259928fe74172f
7
+ data.tar.gz: d36b7804a5cbfd00fcc2931e5a5389f464e19d08873f124de4b05a151da1fe94c42d10be2b24c4b3c22531a9e1231c49c826d056202722a4f8638cdb7f3b1828
checksums.yaml.gz.sig CHANGED
Binary file
@@ -9,8 +9,9 @@ require 'lineparser'
9
9
 
10
10
  class AlexaModelBuilder
11
11
 
12
- def initialize(s=nil)
12
+ def initialize(s=nil, debug: false)
13
13
 
14
+ @debug = debug
14
15
  parse(s) if s
15
16
 
16
17
  end
@@ -24,26 +25,33 @@ class AlexaModelBuilder
24
25
 
25
26
  out = []
26
27
  out << 'invocation: ' + lm[:invocationName] + "\n"
27
-
28
+ puts lm[:intents].inspect if @debug
29
+
28
30
  lm[:intents].each do |intent|
29
31
 
32
+ puts 'intent: ' + intent[:name].inspect if @debug
30
33
  out << intent[:name] + "\n"
31
- intent[:samples].each do |utterance|
32
- out << " " + utterance
33
- end
34
+
35
+ if intent[:samples] then
36
+
37
+ intent[:samples].each do |utterance|
38
+ puts 'utterance: ' + utterance.inspect if @debug
39
+ out << " " + utterance
40
+ end
34
41
 
35
- if intent[:slots] and intent[:slots].any? then
42
+ if intent[:slots] and intent[:slots].any? then
36
43
 
37
- out << "\n slots:"
44
+ out << "\n slots:"
45
+
46
+ intent[:slots].each do |slot|
47
+ out << " %s: %s" % [slot[:name], slot[:type]]
48
+ end
38
49
 
39
- intent[:slots].each do |slot|
40
- out << " %s: %s" % [slot[:name], slot[:type]]
41
50
  end
42
51
 
52
+ out << "\n" if intent[:samples].any?
43
53
  end
44
54
 
45
- out << "\n" if intent[:samples].any?
46
-
47
55
  end
48
56
 
49
57
  if lm[:types] and lm[:types].any? then
@@ -51,8 +59,16 @@ class AlexaModelBuilder
51
59
  out << "types:"
52
60
 
53
61
  lm[:types].each do |type|
54
- values = lm[:types][0][:values].map {|x| x[:name][:value] }.join(', ')
55
- out << " %s: %s" % [type[:name], values]
62
+
63
+ values = type[:values].map do |x|
64
+
65
+ synonyms = x[:name][:synonyms]
66
+ val = x[:name][:value]
67
+ val += ' (' + synonyms.join(', ') + ')' if synonyms and synonyms.any?
68
+ val
69
+ end
70
+
71
+ out << " %s: %s" % [type[:name], values.join(', ')]
56
72
  end
57
73
 
58
74
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alexa_modelbuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
@@ -1 +1,2 @@
1
- Ez
1
+ Zf��W���t{��v��k�%Q̬��Ƕ��c�D�,�,B邞�`��!�_y�9�y
2
+ ���h&ԑ��4��7yJ<K$H�7�>�t�׏Ƈ2V�fW�I8@�'�G�����j���㄁l~�^%< �*��c� �T_-^��Z��a��,!^Cv�/Ӳg��ӛ�1j&����� �^���sH�h�> ՟�3�OP 6��u� G�MNoA�F�>���