ruby_speech 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. data/CHANGELOG.md +15 -0
  2. data/README.md +108 -14
  3. data/lib/ruby_speech/generic_element.rb +71 -10
  4. data/lib/ruby_speech/grxml.rb +4 -1
  5. data/lib/ruby_speech/grxml/element.rb +4 -0
  6. data/lib/ruby_speech/grxml/grammar.rb +177 -46
  7. data/lib/ruby_speech/grxml/item.rb +12 -11
  8. data/lib/ruby_speech/grxml/match.rb +16 -0
  9. data/lib/ruby_speech/grxml/no_match.rb +10 -0
  10. data/lib/ruby_speech/grxml/one_of.rb +4 -11
  11. data/lib/ruby_speech/grxml/rule.rb +0 -11
  12. data/lib/ruby_speech/grxml/ruleref.rb +0 -11
  13. data/lib/ruby_speech/grxml/tag.rb +0 -11
  14. data/lib/ruby_speech/grxml/token.rb +8 -11
  15. data/lib/ruby_speech/ssml.rb +6 -0
  16. data/lib/ruby_speech/ssml/audio.rb +1 -12
  17. data/lib/ruby_speech/ssml/break.rb +0 -11
  18. data/lib/ruby_speech/ssml/desc.rb +24 -0
  19. data/lib/ruby_speech/ssml/emphasis.rb +1 -12
  20. data/lib/ruby_speech/ssml/mark.rb +43 -0
  21. data/lib/ruby_speech/ssml/p.rb +25 -0
  22. data/lib/ruby_speech/ssml/phoneme.rb +72 -0
  23. data/lib/ruby_speech/ssml/prosody.rb +1 -12
  24. data/lib/ruby_speech/ssml/s.rb +25 -0
  25. data/lib/ruby_speech/ssml/say_as.rb +0 -11
  26. data/lib/ruby_speech/ssml/speak.rb +2 -44
  27. data/lib/ruby_speech/ssml/sub.rb +42 -0
  28. data/lib/ruby_speech/ssml/voice.rb +1 -12
  29. data/lib/ruby_speech/version.rb +1 -1
  30. data/spec/ruby_speech/grxml/grammar_spec.rb +478 -35
  31. data/spec/ruby_speech/grxml/item_spec.rb +5 -2
  32. data/spec/ruby_speech/grxml/match_spec.rb +49 -0
  33. data/spec/ruby_speech/grxml/no_match_spec.rb +17 -0
  34. data/spec/ruby_speech/grxml/one_of_spec.rb +1 -1
  35. data/spec/ruby_speech/grxml/rule_spec.rb +1 -1
  36. data/spec/ruby_speech/grxml/ruleref_spec.rb +1 -1
  37. data/spec/ruby_speech/grxml/tag_spec.rb +1 -1
  38. data/spec/ruby_speech/grxml/token_spec.rb +11 -1
  39. data/spec/ruby_speech/grxml_spec.rb +64 -5
  40. data/spec/ruby_speech/ssml/audio_spec.rb +5 -6
  41. data/spec/ruby_speech/ssml/break_spec.rb +1 -1
  42. data/spec/ruby_speech/ssml/desc_spec.rb +57 -0
  43. data/spec/ruby_speech/ssml/emphasis_spec.rb +1 -4
  44. data/spec/ruby_speech/ssml/mark_spec.rb +53 -0
  45. data/spec/ruby_speech/ssml/p_spec.rb +96 -0
  46. data/spec/ruby_speech/ssml/phoneme_spec.rb +65 -0
  47. data/spec/ruby_speech/ssml/prosody_spec.rb +9 -4
  48. data/spec/ruby_speech/ssml/s_spec.rb +92 -0
  49. data/spec/ruby_speech/ssml/say_as_spec.rb +1 -1
  50. data/spec/ruby_speech/ssml/speak_spec.rb +1 -6
  51. data/spec/ruby_speech/ssml/sub_spec.rb +57 -0
  52. data/spec/ruby_speech/ssml/voice_spec.rb +1 -6
  53. data/spec/spec_helper.rb +0 -4
  54. data/spec/support/matchers.rb +13 -53
  55. metadata +200 -113
@@ -1,57 +1,18 @@
1
1
  def be_a_valid_grxml_document
2
- GRXMLMatcher.new
2
+ SpeechDocMatcher.new 'GRXML', GRXML_SCHEMA
3
3
  end
4
4
 
5
5
  def be_a_valid_ssml_document
6
- SSMLMatcher.new
6
+ SpeechDocMatcher.new 'SSML', SSML_SCHEMA
7
7
  end
8
8
 
9
- class SSMLMatcher
10
- attr_reader :subject
9
+ class SpeechDocMatcher
10
+ attr_reader :subject, :type, :schema
11
11
 
12
- def subject=(s)
13
- if s.is_a? Nokogiri::XML::Document
14
- @subject = s
15
- else
16
- doc = Nokogiri::XML::Document.new
17
- doc << s
18
- @subject = doc
19
- end
20
- end
21
-
22
- def failure_message
23
- " expected #{subject} to be a valid SSML document\n#{errors}"
24
- end
25
-
26
- def negative_failure_message
27
- " expected #{subject} not to be a valid SSML document"
28
- end
29
-
30
- def description
31
- "to be a valid SSML document"
32
- end
33
-
34
- def matches?(s)
35
- self.subject = s
36
- SSML_SCHEMA.valid? subject
12
+ def initialize(type, schema)
13
+ @type, @schema = type, schema
37
14
  end
38
15
 
39
- def does_not_match?(s)
40
- !matches? s
41
- end
42
-
43
- private
44
-
45
- def errors
46
- SSML_SCHEMA.validate(subject).map(&:message).join "\n"
47
- end
48
-
49
- end
50
-
51
-
52
- class GRXMLMatcher
53
- attr_reader :subject
54
-
55
16
  def subject=(s)
56
17
  if s.is_a? Nokogiri::XML::Document
57
18
  @subject = s
@@ -63,20 +24,20 @@ class GRXMLMatcher
63
24
  end
64
25
 
65
26
  def failure_message
66
- " expected #{subject} to be a valid GRXML document\n#{errors}"
27
+ " expected #{subject} to be a valid #{type} document\n#{errors}"
67
28
  end
68
29
 
69
30
  def negative_failure_message
70
- " expected #{subject} not to be a valid GRXML document"
31
+ " expected #{subject} not to be a valid #{type} document"
71
32
  end
72
33
 
73
34
  def description
74
- "to be a valid GRXML document"
35
+ "to be a valid #{type} document"
75
36
  end
76
37
 
77
38
  def matches?(s)
78
39
  self.subject = s
79
- GRXML_SCHEMA.valid? subject
40
+ schema.valid? subject
80
41
  end
81
42
 
82
43
  def does_not_match?(s)
@@ -85,8 +46,7 @@ class GRXMLMatcher
85
46
 
86
47
  private
87
48
 
88
- def errors
89
- GRXML_SCHEMA.validate(subject).map(&:message).join "\n"
90
- end
91
-
49
+ def errors
50
+ schema.validate(subject).map(&:message).join "\n"
51
+ end
92
52
  end
metadata CHANGED
@@ -1,155 +1,215 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ruby_speech
3
- version: !ruby/object:Gem::Version
4
- version: 0.4.0
3
+ version: !ruby/object:Gem::Version
4
+ hash: 11
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 5
9
+ - 0
10
+ version: 0.5.0
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Ben Langfeld
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2011-12-30 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2012-01-03 00:00:00 +00:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
15
22
  name: niceogiri
16
- requirement: &2152682720 !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
17
25
  none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 25
30
+ segments:
31
+ - 0
32
+ - 1
33
+ - 1
21
34
  version: 0.1.1
22
35
  type: :runtime
23
- prerelease: false
24
- version_requirements: *2152682720
25
- - !ruby/object:Gem::Dependency
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
26
38
  name: activesupport
27
- requirement: &2152682100 !ruby/object:Gem::Requirement
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
28
41
  none: false
29
- requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 9
46
+ segments:
47
+ - 3
48
+ - 0
49
+ - 7
32
50
  version: 3.0.7
33
51
  type: :runtime
34
- prerelease: false
35
- version_requirements: *2152682100
36
- - !ruby/object:Gem::Dependency
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
37
54
  name: bundler
38
- requirement: &2152681560 !ruby/object:Gem::Requirement
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
39
57
  none: false
40
- requirements:
58
+ requirements:
41
59
  - - ~>
42
- - !ruby/object:Gem::Version
60
+ - !ruby/object:Gem::Version
61
+ hash: 23
62
+ segments:
63
+ - 1
64
+ - 0
65
+ - 0
43
66
  version: 1.0.0
44
67
  type: :development
45
- prerelease: false
46
- version_requirements: *2152681560
47
- - !ruby/object:Gem::Dependency
68
+ version_requirements: *id003
69
+ - !ruby/object:Gem::Dependency
48
70
  name: rspec
49
- requirement: &2152681040 !ruby/object:Gem::Requirement
71
+ prerelease: false
72
+ requirement: &id004 !ruby/object:Gem::Requirement
50
73
  none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ hash: 19
78
+ segments:
79
+ - 2
80
+ - 7
81
+ - 0
54
82
  version: 2.7.0
55
83
  type: :development
56
- prerelease: false
57
- version_requirements: *2152681040
58
- - !ruby/object:Gem::Dependency
84
+ version_requirements: *id004
85
+ - !ruby/object:Gem::Dependency
59
86
  name: ci_reporter
60
- requirement: &2152680460 !ruby/object:Gem::Requirement
87
+ prerelease: false
88
+ requirement: &id005 !ruby/object:Gem::Requirement
61
89
  none: false
62
- requirements:
63
- - - ! '>='
64
- - !ruby/object:Gem::Version
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ hash: 9
94
+ segments:
95
+ - 1
96
+ - 6
97
+ - 3
65
98
  version: 1.6.3
66
99
  type: :development
67
- prerelease: false
68
- version_requirements: *2152680460
69
- - !ruby/object:Gem::Dependency
100
+ version_requirements: *id005
101
+ - !ruby/object:Gem::Dependency
70
102
  name: yard
71
- requirement: &2152679960 !ruby/object:Gem::Requirement
103
+ prerelease: false
104
+ requirement: &id006 !ruby/object:Gem::Requirement
72
105
  none: false
73
- requirements:
106
+ requirements:
74
107
  - - ~>
75
- - !ruby/object:Gem::Version
108
+ - !ruby/object:Gem::Version
109
+ hash: 3
110
+ segments:
111
+ - 0
112
+ - 7
113
+ - 0
76
114
  version: 0.7.0
77
115
  type: :development
78
- prerelease: false
79
- version_requirements: *2152679960
80
- - !ruby/object:Gem::Dependency
116
+ version_requirements: *id006
117
+ - !ruby/object:Gem::Dependency
81
118
  name: rake
82
- requirement: &2152679440 !ruby/object:Gem::Requirement
119
+ prerelease: false
120
+ requirement: &id007 !ruby/object:Gem::Requirement
83
121
  none: false
84
- requirements:
85
- - - ! '>='
86
- - !ruby/object:Gem::Version
87
- version: '0'
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ hash: 3
126
+ segments:
127
+ - 0
128
+ version: "0"
88
129
  type: :development
89
- prerelease: false
90
- version_requirements: *2152679440
91
- - !ruby/object:Gem::Dependency
130
+ version_requirements: *id007
131
+ - !ruby/object:Gem::Dependency
92
132
  name: mocha
93
- requirement: &2152678860 !ruby/object:Gem::Requirement
133
+ prerelease: false
134
+ requirement: &id008 !ruby/object:Gem::Requirement
94
135
  none: false
95
- requirements:
96
- - - ! '>='
97
- - !ruby/object:Gem::Version
98
- version: '0'
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ hash: 3
140
+ segments:
141
+ - 0
142
+ version: "0"
99
143
  type: :development
100
- prerelease: false
101
- version_requirements: *2152678860
102
- - !ruby/object:Gem::Dependency
144
+ version_requirements: *id008
145
+ - !ruby/object:Gem::Dependency
103
146
  name: i18n
104
- requirement: &2152678360 !ruby/object:Gem::Requirement
147
+ prerelease: false
148
+ requirement: &id009 !ruby/object:Gem::Requirement
105
149
  none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ hash: 3
154
+ segments:
155
+ - 0
156
+ version: "0"
110
157
  type: :development
111
- prerelease: false
112
- version_requirements: *2152678360
113
- - !ruby/object:Gem::Dependency
158
+ version_requirements: *id009
159
+ - !ruby/object:Gem::Dependency
114
160
  name: guard
115
- requirement: &2152677860 !ruby/object:Gem::Requirement
161
+ prerelease: false
162
+ requirement: &id010 !ruby/object:Gem::Requirement
116
163
  none: false
117
- requirements:
118
- - - ! '>='
119
- - !ruby/object:Gem::Version
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ hash: 59
168
+ segments:
169
+ - 0
170
+ - 9
171
+ - 0
120
172
  version: 0.9.0
121
173
  type: :development
122
- prerelease: false
123
- version_requirements: *2152677860
124
- - !ruby/object:Gem::Dependency
174
+ version_requirements: *id010
175
+ - !ruby/object:Gem::Dependency
125
176
  name: guard-rspec
126
- requirement: &2152677380 !ruby/object:Gem::Requirement
177
+ prerelease: false
178
+ requirement: &id011 !ruby/object:Gem::Requirement
127
179
  none: false
128
- requirements:
129
- - - ! '>='
130
- - !ruby/object:Gem::Version
131
- version: '0'
180
+ requirements:
181
+ - - ">="
182
+ - !ruby/object:Gem::Version
183
+ hash: 3
184
+ segments:
185
+ - 0
186
+ version: "0"
132
187
  type: :development
133
- prerelease: false
134
- version_requirements: *2152677380
135
- - !ruby/object:Gem::Dependency
188
+ version_requirements: *id011
189
+ - !ruby/object:Gem::Dependency
136
190
  name: ruby_gntp
137
- requirement: &2152676820 !ruby/object:Gem::Requirement
191
+ prerelease: false
192
+ requirement: &id012 !ruby/object:Gem::Requirement
138
193
  none: false
139
- requirements:
140
- - - ! '>='
141
- - !ruby/object:Gem::Version
142
- version: '0'
194
+ requirements:
195
+ - - ">="
196
+ - !ruby/object:Gem::Version
197
+ hash: 3
198
+ segments:
199
+ - 0
200
+ version: "0"
143
201
  type: :development
144
- prerelease: false
145
- version_requirements: *2152676820
202
+ version_requirements: *id012
146
203
  description: Prepare SSML and GRXML documents with ease
147
- email:
204
+ email:
148
205
  - ben@langfeld.me
149
206
  executables: []
207
+
150
208
  extensions: []
209
+
151
210
  extra_rdoc_files: []
152
- files:
211
+
212
+ files:
153
213
  - .gitignore
154
214
  - .rspec
155
215
  - .travis.yml
@@ -170,6 +230,8 @@ files:
170
230
  - lib/ruby_speech/grxml/element.rb
171
231
  - lib/ruby_speech/grxml/grammar.rb
172
232
  - lib/ruby_speech/grxml/item.rb
233
+ - lib/ruby_speech/grxml/match.rb
234
+ - lib/ruby_speech/grxml/no_match.rb
173
235
  - lib/ruby_speech/grxml/one_of.rb
174
236
  - lib/ruby_speech/grxml/rule.rb
175
237
  - lib/ruby_speech/grxml/ruleref.rb
@@ -178,11 +240,17 @@ files:
178
240
  - lib/ruby_speech/ssml.rb
179
241
  - lib/ruby_speech/ssml/audio.rb
180
242
  - lib/ruby_speech/ssml/break.rb
243
+ - lib/ruby_speech/ssml/desc.rb
181
244
  - lib/ruby_speech/ssml/element.rb
182
245
  - lib/ruby_speech/ssml/emphasis.rb
246
+ - lib/ruby_speech/ssml/mark.rb
247
+ - lib/ruby_speech/ssml/p.rb
248
+ - lib/ruby_speech/ssml/phoneme.rb
183
249
  - lib/ruby_speech/ssml/prosody.rb
250
+ - lib/ruby_speech/ssml/s.rb
184
251
  - lib/ruby_speech/ssml/say_as.rb
185
252
  - lib/ruby_speech/ssml/speak.rb
253
+ - lib/ruby_speech/ssml/sub.rb
186
254
  - lib/ruby_speech/ssml/voice.rb
187
255
  - lib/ruby_speech/version.rb
188
256
  - lib/ruby_speech/xml.rb
@@ -190,6 +258,8 @@ files:
190
258
  - ruby_speech.gemspec
191
259
  - spec/ruby_speech/grxml/grammar_spec.rb
192
260
  - spec/ruby_speech/grxml/item_spec.rb
261
+ - spec/ruby_speech/grxml/match_spec.rb
262
+ - spec/ruby_speech/grxml/no_match_spec.rb
193
263
  - spec/ruby_speech/grxml/one_of_spec.rb
194
264
  - spec/ruby_speech/grxml/rule_spec.rb
195
265
  - spec/ruby_speech/grxml/ruleref_spec.rb
@@ -198,47 +268,59 @@ files:
198
268
  - spec/ruby_speech/grxml_spec.rb
199
269
  - spec/ruby_speech/ssml/audio_spec.rb
200
270
  - spec/ruby_speech/ssml/break_spec.rb
271
+ - spec/ruby_speech/ssml/desc_spec.rb
201
272
  - spec/ruby_speech/ssml/emphasis_spec.rb
273
+ - spec/ruby_speech/ssml/mark_spec.rb
274
+ - spec/ruby_speech/ssml/p_spec.rb
275
+ - spec/ruby_speech/ssml/phoneme_spec.rb
202
276
  - spec/ruby_speech/ssml/prosody_spec.rb
277
+ - spec/ruby_speech/ssml/s_spec.rb
203
278
  - spec/ruby_speech/ssml/say_as_spec.rb
204
279
  - spec/ruby_speech/ssml/speak_spec.rb
280
+ - spec/ruby_speech/ssml/sub_spec.rb
205
281
  - spec/ruby_speech/ssml/voice_spec.rb
206
282
  - spec/ruby_speech/ssml_spec.rb
207
283
  - spec/spec_helper.rb
208
284
  - spec/support/matchers.rb
285
+ has_rdoc: true
209
286
  homepage: https://github.com/benlangfeld/ruby_speech
210
287
  licenses: []
288
+
211
289
  post_install_message:
212
290
  rdoc_options: []
213
- require_paths:
291
+
292
+ require_paths:
214
293
  - lib
215
- required_ruby_version: !ruby/object:Gem::Requirement
294
+ required_ruby_version: !ruby/object:Gem::Requirement
216
295
  none: false
217
- requirements:
218
- - - ! '>='
219
- - !ruby/object:Gem::Version
220
- version: '0'
221
- segments:
296
+ requirements:
297
+ - - ">="
298
+ - !ruby/object:Gem::Version
299
+ hash: 3
300
+ segments:
222
301
  - 0
223
- hash: -633963194735147828
224
- required_rubygems_version: !ruby/object:Gem::Requirement
302
+ version: "0"
303
+ required_rubygems_version: !ruby/object:Gem::Requirement
225
304
  none: false
226
- requirements:
227
- - - ! '>='
228
- - !ruby/object:Gem::Version
229
- version: '0'
230
- segments:
305
+ requirements:
306
+ - - ">="
307
+ - !ruby/object:Gem::Version
308
+ hash: 3
309
+ segments:
231
310
  - 0
232
- hash: -633963194735147828
311
+ version: "0"
233
312
  requirements: []
313
+
234
314
  rubyforge_project: ruby_speech
235
- rubygems_version: 1.8.10
315
+ rubygems_version: 1.6.2
236
316
  signing_key:
237
317
  specification_version: 3
238
318
  summary: A ruby library for TTS & ASR document preparation
239
- test_files:
319
+ test_files:
240
320
  - spec/ruby_speech/grxml/grammar_spec.rb
241
321
  - spec/ruby_speech/grxml/item_spec.rb
322
+ - spec/ruby_speech/grxml/match_spec.rb
323
+ - spec/ruby_speech/grxml/no_match_spec.rb
242
324
  - spec/ruby_speech/grxml/one_of_spec.rb
243
325
  - spec/ruby_speech/grxml/rule_spec.rb
244
326
  - spec/ruby_speech/grxml/ruleref_spec.rb
@@ -247,12 +329,17 @@ test_files:
247
329
  - spec/ruby_speech/grxml_spec.rb
248
330
  - spec/ruby_speech/ssml/audio_spec.rb
249
331
  - spec/ruby_speech/ssml/break_spec.rb
332
+ - spec/ruby_speech/ssml/desc_spec.rb
250
333
  - spec/ruby_speech/ssml/emphasis_spec.rb
334
+ - spec/ruby_speech/ssml/mark_spec.rb
335
+ - spec/ruby_speech/ssml/p_spec.rb
336
+ - spec/ruby_speech/ssml/phoneme_spec.rb
251
337
  - spec/ruby_speech/ssml/prosody_spec.rb
338
+ - spec/ruby_speech/ssml/s_spec.rb
252
339
  - spec/ruby_speech/ssml/say_as_spec.rb
253
340
  - spec/ruby_speech/ssml/speak_spec.rb
341
+ - spec/ruby_speech/ssml/sub_spec.rb
254
342
  - spec/ruby_speech/ssml/voice_spec.rb
255
343
  - spec/ruby_speech/ssml_spec.rb
256
344
  - spec/spec_helper.rb
257
345
  - spec/support/matchers.rb
258
- has_rdoc: