ruby_speech 2.1.0-java

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.
Files changed (90) hide show
  1. data/.gitignore +12 -0
  2. data/.rspec +3 -0
  3. data/.travis.yml +17 -0
  4. data/CHANGELOG.md +144 -0
  5. data/Gemfile +3 -0
  6. data/Guardfile +9 -0
  7. data/LICENSE.md +20 -0
  8. data/README.md +314 -0
  9. data/Rakefile +34 -0
  10. data/assets/grammar-core.xsd +317 -0
  11. data/assets/grammar.xsd +37 -0
  12. data/assets/synthesis-core.xsd +445 -0
  13. data/assets/synthesis.xsd +63 -0
  14. data/assets/xml.xsd +287 -0
  15. data/ext/ruby_speech/RubySpeechGRXMLMatcher.java +64 -0
  16. data/ext/ruby_speech/RubySpeechService.java +23 -0
  17. data/ext/ruby_speech/extconf.rb +7 -0
  18. data/ext/ruby_speech/ruby_speech.c +97 -0
  19. data/lib/ruby_speech/generic_element.rb +169 -0
  20. data/lib/ruby_speech/grxml/element.rb +29 -0
  21. data/lib/ruby_speech/grxml/grammar.rb +189 -0
  22. data/lib/ruby_speech/grxml/item.rb +144 -0
  23. data/lib/ruby_speech/grxml/match.rb +16 -0
  24. data/lib/ruby_speech/grxml/matcher.rb +126 -0
  25. data/lib/ruby_speech/grxml/max_match.rb +6 -0
  26. data/lib/ruby_speech/grxml/no_match.rb +10 -0
  27. data/lib/ruby_speech/grxml/one_of.rb +31 -0
  28. data/lib/ruby_speech/grxml/potential_match.rb +10 -0
  29. data/lib/ruby_speech/grxml/rule.rb +73 -0
  30. data/lib/ruby_speech/grxml/ruleref.rb +69 -0
  31. data/lib/ruby_speech/grxml/tag.rb +29 -0
  32. data/lib/ruby_speech/grxml/token.rb +31 -0
  33. data/lib/ruby_speech/grxml.rb +39 -0
  34. data/lib/ruby_speech/nlsml/builder.rb +34 -0
  35. data/lib/ruby_speech/nlsml/document.rb +120 -0
  36. data/lib/ruby_speech/nlsml.rb +18 -0
  37. data/lib/ruby_speech/ruby_speech.jar +0 -0
  38. data/lib/ruby_speech/ssml/audio.rb +47 -0
  39. data/lib/ruby_speech/ssml/break.rb +62 -0
  40. data/lib/ruby_speech/ssml/desc.rb +24 -0
  41. data/lib/ruby_speech/ssml/element.rb +23 -0
  42. data/lib/ruby_speech/ssml/emphasis.rb +44 -0
  43. data/lib/ruby_speech/ssml/mark.rb +43 -0
  44. data/lib/ruby_speech/ssml/p.rb +25 -0
  45. data/lib/ruby_speech/ssml/phoneme.rb +72 -0
  46. data/lib/ruby_speech/ssml/prosody.rb +172 -0
  47. data/lib/ruby_speech/ssml/s.rb +25 -0
  48. data/lib/ruby_speech/ssml/say_as.rb +100 -0
  49. data/lib/ruby_speech/ssml/speak.rb +27 -0
  50. data/lib/ruby_speech/ssml/sub.rb +42 -0
  51. data/lib/ruby_speech/ssml/voice.rb +108 -0
  52. data/lib/ruby_speech/ssml.rb +39 -0
  53. data/lib/ruby_speech/version.rb +3 -0
  54. data/lib/ruby_speech/xml/language.rb +13 -0
  55. data/lib/ruby_speech/xml.rb +11 -0
  56. data/lib/ruby_speech.rb +36 -0
  57. data/ruby_speech.gemspec +42 -0
  58. data/spec/ruby_speech/grxml/grammar_spec.rb +341 -0
  59. data/spec/ruby_speech/grxml/item_spec.rb +192 -0
  60. data/spec/ruby_speech/grxml/match_spec.rb +15 -0
  61. data/spec/ruby_speech/grxml/matcher_spec.rb +688 -0
  62. data/spec/ruby_speech/grxml/max_match_spec.rb +17 -0
  63. data/spec/ruby_speech/grxml/no_match_spec.rb +17 -0
  64. data/spec/ruby_speech/grxml/one_of_spec.rb +49 -0
  65. data/spec/ruby_speech/grxml/potential_match_spec.rb +17 -0
  66. data/spec/ruby_speech/grxml/rule_spec.rb +125 -0
  67. data/spec/ruby_speech/grxml/ruleref_spec.rb +55 -0
  68. data/spec/ruby_speech/grxml/tag_spec.rb +41 -0
  69. data/spec/ruby_speech/grxml/token_spec.rb +62 -0
  70. data/spec/ruby_speech/grxml_spec.rb +339 -0
  71. data/spec/ruby_speech/nlsml_spec.rb +353 -0
  72. data/spec/ruby_speech/ssml/audio_spec.rb +121 -0
  73. data/spec/ruby_speech/ssml/break_spec.rb +100 -0
  74. data/spec/ruby_speech/ssml/desc_spec.rb +57 -0
  75. data/spec/ruby_speech/ssml/emphasis_spec.rb +110 -0
  76. data/spec/ruby_speech/ssml/mark_spec.rb +53 -0
  77. data/spec/ruby_speech/ssml/p_spec.rb +96 -0
  78. data/spec/ruby_speech/ssml/phoneme_spec.rb +65 -0
  79. data/spec/ruby_speech/ssml/prosody_spec.rb +309 -0
  80. data/spec/ruby_speech/ssml/s_spec.rb +92 -0
  81. data/spec/ruby_speech/ssml/say_as_spec.rb +71 -0
  82. data/spec/ruby_speech/ssml/speak_spec.rb +166 -0
  83. data/spec/ruby_speech/ssml/sub_spec.rb +57 -0
  84. data/spec/ruby_speech/ssml/voice_spec.rb +200 -0
  85. data/spec/ruby_speech/ssml_spec.rb +285 -0
  86. data/spec/ruby_speech_spec.rb +124 -0
  87. data/spec/spec_helper.rb +21 -0
  88. data/spec/support/match_examples.rb +43 -0
  89. data/spec/support/matchers.rb +46 -0
  90. metadata +405 -0
@@ -0,0 +1,317 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
3
+ <xsd:annotation>
4
+ <xsd:documentation>SRGS 1.0 Core Schema (20031204)</xsd:documentation>
5
+ </xsd:annotation>
6
+ <xsd:annotation>
7
+ <xsd:documentation>
8
+ Copyright 1998-2003 W3C (MIT, ERCIM, Keio),
9
+ All Rights Reserved. Permission to use, copy, modify and
10
+ distribute the SRGS core schema and its accompanying documentation
11
+ for any purpose and without fee is hereby granted in
12
+ perpetuity, provided that the above copyright notice and this
13
+ paragraph appear in all copies. The copyright holders make no
14
+ representation about the suitability of the schema for any purpose.
15
+ It is provided "as is" without expressed or implied warranty.
16
+ </xsd:documentation>
17
+ </xsd:annotation>
18
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace"
19
+ schemaLocation="xml.xsd"/>
20
+ <!--<xsd:import namespace="http://www.w3.org/XML/1998/namespace"
21
+ schemaLocation="http://www.w3.org/2001/xml.xsd"/>-->
22
+ <xsd:annotation>
23
+ <xsd:documentation>General Datatypes</xsd:documentation>
24
+ </xsd:annotation>
25
+ <xsd:annotation>
26
+ <xsd:documentation>Grammar-specific datatypes</xsd:documentation>
27
+ </xsd:annotation>
28
+ <xsd:simpleType name="tag">
29
+ <xsd:restriction base="xsd:string"/>
30
+ </xsd:simpleType>
31
+ <xsd:simpleType name="example">
32
+ <xsd:restriction base="xsd:string"/>
33
+ </xsd:simpleType>
34
+ <xsd:simpleType name="Id.datatype">
35
+ <xsd:annotation>
36
+ <xsd:documentation>
37
+ does not expression the constraint that NULL VOID GARBAGE are illegal as rule name
38
+ </xsd:documentation>
39
+ </xsd:annotation>
40
+ <xsd:restriction base="xsd:ID">
41
+ <xsd:pattern value="[^.:\-]+"/>
42
+ </xsd:restriction>
43
+ </xsd:simpleType>
44
+ <xsd:simpleType name="Scope.datatype">
45
+ <xsd:restriction base="xsd:NMTOKEN">
46
+ <xsd:enumeration value="private"/>
47
+ <xsd:enumeration value="public"/>
48
+ </xsd:restriction>
49
+ </xsd:simpleType>
50
+ <xsd:simpleType name="Special.datatype">
51
+ <xsd:restriction base="xsd:NMTOKEN">
52
+ <xsd:enumeration value="NULL"/>
53
+ <xsd:enumeration value="VOID"/>
54
+ <xsd:enumeration value="GARBAGE"/>
55
+ </xsd:restriction>
56
+ </xsd:simpleType>
57
+ <xsd:simpleType name="Repeat-prob.datatype">
58
+ <xsd:restriction base="xsd:decimal">
59
+ <xsd:minInclusive value="0.0"/>
60
+ <xsd:maxInclusive value="1.0"/>
61
+ </xsd:restriction>
62
+ </xsd:simpleType>
63
+ <xsd:simpleType name="Repeat.datatype">
64
+ <xsd:annotation>
65
+ <xsd:documentation>
66
+ does not expression the constraint in n-m that m must be greater than n
67
+ </xsd:documentation>
68
+ </xsd:annotation>
69
+ <xsd:restriction base="xsd:string">
70
+ <xsd:pattern value="[0-9]+"/>
71
+ <xsd:pattern value="[0-9]+-([0-9]+)?"/>
72
+ <xsd:pattern value="([0-9]+)?-[0-9]+"/>
73
+ </xsd:restriction>
74
+ </xsd:simpleType>
75
+ <xsd:simpleType name="Weight.datatype">
76
+ <xsd:restriction base="xsd:string">
77
+ <xsd:pattern value="[0-9]+[.]?"/>
78
+ <xsd:pattern value="([0-9]+)?[.][0-9]+"/>
79
+ </xsd:restriction>
80
+ </xsd:simpleType>
81
+ <xsd:simpleType name="Tag-format.datatype">
82
+ <xsd:restriction base="xsd:anyURI"/>
83
+ </xsd:simpleType>
84
+ <xsd:simpleType name="Version.datatype">
85
+ <xsd:restriction base="xsd:NMTOKEN"/>
86
+ </xsd:simpleType>
87
+ <xsd:simpleType name="Root.datatype">
88
+ <xsd:annotation>
89
+ <xsd:documentation>does not expression the constraint that NULL VOID GARBAGE
90
+ are illegal as rule name</xsd:documentation>
91
+ </xsd:annotation>
92
+ <xsd:restriction base="xsd:IDREF">
93
+ <xsd:pattern value="[^.:\-]+"/>
94
+ </xsd:restriction>
95
+ </xsd:simpleType>
96
+ <xsd:simpleType name="Mode.datatype">
97
+ <xsd:restriction base="xsd:NMTOKEN">
98
+ <xsd:enumeration value="voice"/>
99
+ <xsd:enumeration value="dtmf"/>
100
+ </xsd:restriction>
101
+ </xsd:simpleType>
102
+ <xsd:simpleType name="Type.datatype">
103
+ <xsd:restriction base="xsd:string"/>
104
+ </xsd:simpleType>
105
+ <xsd:annotation>
106
+ <xsd:documentation>Grammar Attributes</xsd:documentation>
107
+ </xsd:annotation>
108
+ <xsd:attributeGroup name="Tag-format.attrib">
109
+ <xsd:annotation>
110
+ <xsd:documentation/>
111
+ </xsd:annotation>
112
+ <xsd:attribute name="tag-format" type="Tag-format.datatype"/>
113
+ </xsd:attributeGroup>
114
+ <xsd:attributeGroup name="Version.attrib">
115
+ <xsd:annotation>
116
+ <xsd:documentation/>
117
+ </xsd:annotation>
118
+ <xsd:attribute name="version" type="Version.datatype"/>
119
+ </xsd:attributeGroup>
120
+ <xsd:attributeGroup name="Mode.attrib">
121
+ <xsd:annotation>
122
+ <xsd:documentation/>
123
+ </xsd:annotation>
124
+ <xsd:attribute name="mode" type="Mode.datatype" default="voice"/>
125
+ </xsd:attributeGroup>
126
+ <xsd:attributeGroup name="Root.attrib">
127
+ <xsd:annotation>
128
+ <xsd:documentation/>
129
+ </xsd:annotation>
130
+ <xsd:attribute name="root" type="Root.datatype"/>
131
+ </xsd:attributeGroup>
132
+ <xsd:attributeGroup name="Special.attrib">
133
+ <xsd:annotation>
134
+ <xsd:documentation/>
135
+ </xsd:annotation>
136
+ <xsd:attribute name="special" type="Special.datatype"/>
137
+ </xsd:attributeGroup>
138
+ <xsd:attributeGroup name="Repeat-prob.attrib">
139
+ <xsd:annotation>
140
+ <xsd:documentation/>
141
+ </xsd:annotation>
142
+ <xsd:attribute name="repeat-prob" type="Repeat-prob.datatype"/>
143
+ </xsd:attributeGroup>
144
+ <xsd:attributeGroup name="Repeat.attrib">
145
+ <xsd:annotation>
146
+ <xsd:documentation/>
147
+ </xsd:annotation>
148
+ <xsd:attribute name="repeat" type="Repeat.datatype"/>
149
+ </xsd:attributeGroup>
150
+ <xsd:attributeGroup name="Type.attrib">
151
+ <xsd:annotation>
152
+ <xsd:documentation/>
153
+ </xsd:annotation>
154
+ <xsd:attribute name="type" type="Type.datatype"/>
155
+ </xsd:attributeGroup>
156
+ <xsd:attributeGroup name="Weight.attrib">
157
+ <xsd:annotation>
158
+ <xsd:documentation/>
159
+ </xsd:annotation>
160
+ <xsd:attribute name="weight" type="Weight.datatype"/>
161
+ </xsd:attributeGroup>
162
+ <xsd:attributeGroup name="Id.attrib">
163
+ <xsd:annotation>
164
+ <xsd:documentation/>
165
+ </xsd:annotation>
166
+ <xsd:attribute name="id" type="Id.datatype" use="required"/>
167
+ </xsd:attributeGroup>
168
+ <xsd:attributeGroup name="Scope.attrib">
169
+ <xsd:annotation>
170
+ <xsd:documentation/>
171
+ </xsd:annotation>
172
+ <xsd:attribute name="scope" type="Scope.datatype" default="private"/>
173
+ </xsd:attributeGroup>
174
+ <xsd:attributeGroup name="Token.attribs">
175
+ <xsd:annotation>
176
+ <xsd:documentation/>
177
+ </xsd:annotation>
178
+ <xsd:attribute ref="xml:lang"/>
179
+ </xsd:attributeGroup>
180
+ <xsd:attributeGroup name="One-of.attribs">
181
+ <xsd:annotation>
182
+ <xsd:documentation/>
183
+ </xsd:annotation>
184
+ <xsd:attribute ref="xml:lang"/>
185
+ </xsd:attributeGroup>
186
+ <xsd:attributeGroup name="Item.attribs">
187
+ <xsd:annotation>
188
+ <xsd:documentation/>
189
+ </xsd:annotation>
190
+ <xsd:attributeGroup ref="Repeat-prob.attrib"/>
191
+ <xsd:attributeGroup ref="Repeat.attrib"/>
192
+ <xsd:attributeGroup ref="Weight.attrib"/>
193
+ <xsd:attribute ref="xml:lang"/>
194
+ </xsd:attributeGroup>
195
+ <xsd:attributeGroup name="Grammar.attribs">
196
+ <xsd:annotation>
197
+ <xsd:documentation/>
198
+ </xsd:annotation>
199
+ <xsd:attributeGroup ref="Tag-format.attrib"/>
200
+ <xsd:attributeGroup ref="Version.attrib"/>
201
+ <xsd:attribute ref="xml:lang"/>
202
+ <xsd:attribute ref="xml:base"/>
203
+ <xsd:attributeGroup ref="Root.attrib"/>
204
+ <xsd:attributeGroup ref="Mode.attrib"/>
205
+ </xsd:attributeGroup>
206
+ <xsd:attributeGroup name="Ruleref.attribs">
207
+ <xsd:annotation>
208
+ <xsd:documentation/>
209
+ </xsd:annotation>
210
+ <xsd:attributeGroup ref="Type.attrib"/>
211
+ <xsd:attribute name="uri" type="xsd:anyURI"/>
212
+ <xsd:attributeGroup ref="Special.attrib"/>
213
+ </xsd:attributeGroup>
214
+ <xsd:attributeGroup name="Rule.attribs">
215
+ <xsd:annotation>
216
+ <xsd:documentation/>
217
+ </xsd:annotation>
218
+ <xsd:attributeGroup ref="Id.attrib"/>
219
+ <xsd:attributeGroup ref="Scope.attrib"/>
220
+ </xsd:attributeGroup>
221
+ <xsd:attributeGroup name="Lexicon.attribs">
222
+ <xsd:annotation>
223
+ <xsd:documentation/>
224
+ </xsd:annotation>
225
+ <xsd:attribute name="uri" type="xsd:anyURI" use="required"/>
226
+ <xsd:attributeGroup ref="Type.attrib"/>
227
+ </xsd:attributeGroup>
228
+ <xsd:attributeGroup name="Meta.attribs">
229
+ <xsd:annotation>
230
+ <xsd:documentation/>
231
+ </xsd:annotation>
232
+ <xsd:attribute name="name" type="xsd:NMTOKEN"/>
233
+ <xsd:attribute name="content" type="xsd:string" use="required"/>
234
+ <xsd:attribute name="http-equiv" type="xsd:NMTOKEN"/>
235
+ </xsd:attributeGroup>
236
+ <xsd:annotation>
237
+ <xsd:documentation>Content Models</xsd:documentation>
238
+ </xsd:annotation>
239
+ <xsd:group name="rule-expansion">
240
+ <xsd:choice>
241
+ <xsd:element name="token" type="token"/>
242
+ <xsd:element name="ruleref" type="ruleref"/>
243
+ <xsd:element name="item" type="item"/>
244
+ <xsd:element name="one-of" type="one-of"/>
245
+ <xsd:element name="tag" type="tag"/>
246
+ </xsd:choice>
247
+ </xsd:group>
248
+ <xsd:complexType name="ruleref">
249
+ <xsd:attributeGroup ref="Ruleref.attribs"/>
250
+ </xsd:complexType>
251
+ <xsd:complexType name="token" mixed="true">
252
+ <xsd:annotation>
253
+ <xsd:documentation>does not expression the constraint that empty content is illegal
254
+ </xsd:documentation>
255
+ </xsd:annotation>
256
+ <xsd:attributeGroup ref="Token.attribs"/>
257
+ </xsd:complexType>
258
+ <xsd:complexType name="one-of">
259
+ <xsd:sequence maxOccurs="unbounded">
260
+ <xsd:element name="item" type="item"/>
261
+ </xsd:sequence>
262
+ <xsd:attributeGroup ref="One-of.attribs"/>
263
+ </xsd:complexType>
264
+ <xsd:complexType name="item" mixed="true">
265
+ <xsd:group ref="rule-expansion" minOccurs="0" maxOccurs="unbounded"/>
266
+ <xsd:attributeGroup ref="Item.attribs"/>
267
+ </xsd:complexType>
268
+ <xsd:complexType name="rule" mixed="true">
269
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
270
+ <xsd:group ref="rule-expansion"/>
271
+ <xsd:element name="example" type="example"/>
272
+ </xsd:choice>
273
+ <xsd:attributeGroup ref="Rule.attribs"/>
274
+ </xsd:complexType>
275
+ <xsd:complexType name="lexicon">
276
+ <xsd:attributeGroup ref="Lexicon.attribs"/>
277
+ </xsd:complexType>
278
+ <xsd:complexType name="meta">
279
+ <xsd:attributeGroup ref="Meta.attribs"/>
280
+ </xsd:complexType>
281
+ <xsd:complexType name="metadata">
282
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
283
+ <xsd:any namespace="##other" processContents="lax"/>
284
+ </xsd:choice>
285
+ <xsd:anyAttribute namespace="##any" processContents="strict"/>
286
+ </xsd:complexType>
287
+
288
+ <xsd:group name="grammar.class">
289
+ <xsd:annotation>
290
+ <xsd:documentation>grammar content model</xsd:documentation>
291
+ </xsd:annotation>
292
+ <xsd:sequence>
293
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
294
+ <xsd:element name="lexicon" type="lexicon"/>
295
+ <xsd:element name="meta" type="meta"/>
296
+ <xsd:element name="metadata" type="metadata"/>
297
+ <xsd:element name="tag" type="tag"/>
298
+ </xsd:choice>
299
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
300
+ <xsd:element name="rule" type="rule"/>
301
+ </xsd:choice>
302
+ </xsd:sequence>
303
+ </xsd:group>
304
+
305
+ <xsd:complexType name="grammar">
306
+ <xsd:annotation>
307
+ <xsd:documentation>grammar type with grammar content model and attributes</xsd:documentation>
308
+ </xsd:annotation>
309
+ <xsd:group ref="grammar.class"/>
310
+ <xsd:attributeGroup ref="Grammar.attribs"/>
311
+ </xsd:complexType>
312
+
313
+ <xsd:annotation>
314
+ <xsd:documentation>Global Elements</xsd:documentation>
315
+ </xsd:annotation>
316
+ <xsd:element name="grammar" type="grammar"/>
317
+ </xsd:schema>
@@ -0,0 +1,37 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <xsd:schema targetNamespace="http://www.w3.org/2001/06/grammar"
4
+ xmlns="http://www.w3.org/2001/06/grammar"
5
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
6
+ elementFormDefault="qualified">
7
+ <xsd:annotation>
8
+ <xsd:documentation>SRGS 1.0 Schema (20031204)</xsd:documentation>
9
+ </xsd:annotation>
10
+ <xsd:annotation>
11
+ <xsd:documentation>Copyright 1998-2003 W3C (MIT, ERCIM, Keio),
12
+ All Rights Reserved. Permission to use, copy, modify and
13
+ distribute the SRGS schema and its accompanying documentation
14
+ for any purpose and without fee is hereby granted in
15
+ perpetuity, provided that the above copyright notice and this
16
+ paragraph appear in all copies. The copyright holders make no
17
+ representation about the suitability of the schema for any purpose.
18
+ It is provided "as is" without expressed or implied warranty.
19
+ </xsd:documentation>
20
+ </xsd:annotation>
21
+
22
+ <xsd:redefine schemaLocation="grammar-core.xsd">
23
+ <xsd:annotation>
24
+ <xsd:documentation>restricted grammar type so that version attribute is mandatory</xsd:documentation>
25
+ </xsd:annotation>
26
+ <xsd:complexType name="grammar">
27
+ <xsd:complexContent>
28
+ <xsd:restriction base="grammar">
29
+ <xsd:group ref="grammar.class"/>
30
+ <xsd:attribute name="version" type="Version.datatype" use="required"/>
31
+ </xsd:restriction>
32
+ </xsd:complexContent>
33
+ </xsd:complexType>
34
+ </xsd:redefine>
35
+
36
+
37
+ </xsd:schema>