ruby_speech 2.1.2-java → 2.2.0-java
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -2
- data/CHANGELOG.md +8 -0
- data/README.md +23 -0
- data/ext/ruby_speech/extconf.rb +3 -1
- data/ext/ruby_speech/ruby_speech.c +4 -1
- data/lib/ruby_speech/generic_element.rb +141 -29
- data/lib/ruby_speech/grxml/element.rb +6 -6
- data/lib/ruby_speech/grxml/grammar.rb +29 -12
- data/lib/ruby_speech/grxml/item.rb +13 -0
- data/lib/ruby_speech/grxml/matcher.rb +5 -1
- data/lib/ruby_speech/grxml/one_of.rb +4 -0
- data/lib/ruby_speech/grxml/rule.rb +10 -0
- data/lib/ruby_speech/grxml/token.rb +3 -0
- data/lib/ruby_speech/grxml.rb +16 -22
- data/lib/ruby_speech/nlsml.rb +3 -9
- data/lib/ruby_speech/ruby_speech.jar +0 -0
- data/lib/ruby_speech/ssml/audio.rb +17 -0
- data/lib/ruby_speech/ssml/desc.rb +4 -0
- data/lib/ruby_speech/ssml/element.rb +5 -3
- data/lib/ruby_speech/ssml/emphasis.rb +17 -0
- data/lib/ruby_speech/ssml/mark.rb +2 -0
- data/lib/ruby_speech/ssml/p.rb +21 -0
- data/lib/ruby_speech/ssml/phoneme.rb +2 -0
- data/lib/ruby_speech/ssml/prosody.rb +15 -0
- data/lib/ruby_speech/ssml/s.rb +20 -0
- data/lib/ruby_speech/ssml/say_as.rb +2 -0
- data/lib/ruby_speech/ssml/speak.rb +19 -1
- data/lib/ruby_speech/ssml/sub.rb +2 -0
- data/lib/ruby_speech/ssml/voice.rb +19 -0
- data/lib/ruby_speech/ssml.rb +20 -22
- data/lib/ruby_speech/version.rb +1 -1
- data/lib/ruby_speech.rb +6 -19
- data/ruby_speech.gemspec +2 -3
- data/spec/ruby_speech/grxml/grammar_spec.rb +35 -30
- data/spec/ruby_speech/grxml/item_spec.rb +8 -6
- data/spec/ruby_speech/grxml/one_of_spec.rb +7 -3
- data/spec/ruby_speech/grxml/rule_spec.rb +14 -12
- data/spec/ruby_speech/grxml/ruleref_spec.rb +5 -3
- data/spec/ruby_speech/grxml/tag_spec.rb +6 -2
- data/spec/ruby_speech/grxml/token_spec.rb +6 -2
- data/spec/ruby_speech/grxml_spec.rb +57 -69
- data/spec/ruby_speech/ssml/audio_spec.rb +20 -16
- data/spec/ruby_speech/ssml/break_spec.rb +14 -10
- data/spec/ruby_speech/ssml/desc_spec.rb +9 -5
- data/spec/ruby_speech/ssml/emphasis_spec.rb +17 -13
- data/spec/ruby_speech/ssml/mark_spec.rb +7 -3
- data/spec/ruby_speech/ssml/p_spec.rb +18 -14
- data/spec/ruby_speech/ssml/phoneme_spec.rb +10 -6
- data/spec/ruby_speech/ssml/prosody_spec.rb +29 -25
- data/spec/ruby_speech/ssml/s_spec.rb +17 -13
- data/spec/ruby_speech/ssml/say_as_spec.rb +11 -7
- data/spec/ruby_speech/ssml/speak_spec.rb +48 -32
- data/spec/ruby_speech/ssml/sub_spec.rb +9 -5
- data/spec/ruby_speech/ssml/voice_spec.rb +23 -19
- data/spec/ruby_speech/ssml_spec.rb +64 -63
- data/spec/spec_helper.rb +0 -3
- metadata +12 -35
- data/lib/ruby_speech/xml.rb +0 -11
@@ -3,10 +3,14 @@ require 'spec_helper'
|
|
3
3
|
module RubySpeech
|
4
4
|
module SSML
|
5
5
|
describe Sub do
|
6
|
+
let(:doc) { Nokogiri::XML::Document.new }
|
7
|
+
|
8
|
+
subject { described_class.new doc }
|
9
|
+
|
6
10
|
its(:name) { should == 'sub' }
|
7
11
|
|
8
12
|
describe "setting options in initializers" do
|
9
|
-
subject { Sub.new :alias => 'foo' }
|
13
|
+
subject { Sub.new doc, :alias => 'foo' }
|
10
14
|
|
11
15
|
its(:alias) { should == 'foo' }
|
12
16
|
end
|
@@ -27,18 +31,18 @@ module RubySpeech
|
|
27
31
|
|
28
32
|
describe "comparing objects" do
|
29
33
|
it "should be equal if the content and alias are the same" do
|
30
|
-
Sub.new(:alias => 'jp', :content => "Hello there").should == Sub.new(:alias => 'jp', :content => "Hello there")
|
34
|
+
Sub.new(doc, :alias => 'jp', :content => "Hello there").should == Sub.new(doc, :alias => 'jp', :content => "Hello there")
|
31
35
|
end
|
32
36
|
|
33
37
|
describe "when the content is different" do
|
34
38
|
it "should not be equal" do
|
35
|
-
Sub.new(:content => "Hello").should_not == Sub.new(:content => "Hello there")
|
39
|
+
Sub.new(doc, :content => "Hello").should_not == Sub.new(doc, :content => "Hello there")
|
36
40
|
end
|
37
41
|
end
|
38
42
|
|
39
43
|
describe "when the alias is different" do
|
40
44
|
it "should not be equal" do
|
41
|
-
Sub.new(:alias => 'jp').should_not == Sub.new(:alias => 'en')
|
45
|
+
Sub.new(doc, :alias => 'jp').should_not == Sub.new(doc, :alias => 'en')
|
42
46
|
end
|
43
47
|
end
|
44
48
|
end
|
@@ -49,7 +53,7 @@ module RubySpeech
|
|
49
53
|
end
|
50
54
|
|
51
55
|
it "should raise InvalidChildError with non-acceptable objects" do
|
52
|
-
lambda { subject << Voice.new }.should raise_error(InvalidChildError, "A Sub can only accept Strings as children")
|
56
|
+
lambda { subject << Voice.new(doc) }.should raise_error(InvalidChildError, "A Sub can only accept Strings as children")
|
53
57
|
end
|
54
58
|
end
|
55
59
|
end # Desc
|
@@ -3,11 +3,15 @@ require 'spec_helper'
|
|
3
3
|
module RubySpeech
|
4
4
|
module SSML
|
5
5
|
describe Voice do
|
6
|
+
let(:doc) { Nokogiri::XML::Document.new }
|
7
|
+
|
8
|
+
subject { described_class.new doc }
|
9
|
+
|
6
10
|
its(:node_name) { should == 'voice' }
|
7
11
|
its(:name) { should be_nil }
|
8
12
|
|
9
13
|
describe "setting options in initializers" do
|
10
|
-
subject { Voice.new :language => 'jp', :gender => :male, :age => 25, :variant => 2, :name => "paul" }
|
14
|
+
subject { Voice.new doc, :language => 'jp', :gender => :male, :age => 25, :variant => 2, :name => "paul" }
|
11
15
|
|
12
16
|
its(:language) { should == 'jp' }
|
13
17
|
its(:gender) { should == :male }
|
@@ -102,42 +106,42 @@ module RubySpeech
|
|
102
106
|
|
103
107
|
describe "comparing objects" do
|
104
108
|
it "should be equal if the content, language, gender, age, variant, name are the same" do
|
105
|
-
Voice.new(:language => 'jp', :gender => :male, :age => 25, :variant => 2, :name => "paul", :content => "hello").should == Voice.new(:language => 'jp', :gender => :male, :age => 25, :variant => 2, :name => "paul", :content => "hello")
|
109
|
+
Voice.new(doc, :language => 'jp', :gender => :male, :age => 25, :variant => 2, :name => "paul", :content => "hello").should == Voice.new(doc, :language => 'jp', :gender => :male, :age => 25, :variant => 2, :name => "paul", :content => "hello")
|
106
110
|
end
|
107
111
|
|
108
112
|
describe "when the content is different" do
|
109
113
|
it "should not be equal" do
|
110
|
-
Voice.new(:content => "Hello").should_not == Voice.new(:content => "Hello there")
|
114
|
+
Voice.new(doc, :content => "Hello").should_not == Voice.new(doc, :content => "Hello there")
|
111
115
|
end
|
112
116
|
end
|
113
117
|
|
114
118
|
describe "when the language is different" do
|
115
119
|
it "should not be equal" do
|
116
|
-
Voice.new(:language => "Hello").should_not == Voice.new(:language => "Hello there")
|
120
|
+
Voice.new(doc, :language => "Hello").should_not == Voice.new(doc, :language => "Hello there")
|
117
121
|
end
|
118
122
|
end
|
119
123
|
|
120
124
|
describe "when the gender is different" do
|
121
125
|
it "should not be equal" do
|
122
|
-
Voice.new(:gender => :male).should_not == Voice.new(:gender => :female)
|
126
|
+
Voice.new(doc, :gender => :male).should_not == Voice.new(doc, :gender => :female)
|
123
127
|
end
|
124
128
|
end
|
125
129
|
|
126
130
|
describe "when the age is different" do
|
127
131
|
it "should not be equal" do
|
128
|
-
Voice.new(:age => 20).should_not == Voice.new(:age => 30)
|
132
|
+
Voice.new(doc, :age => 20).should_not == Voice.new(doc, :age => 30)
|
129
133
|
end
|
130
134
|
end
|
131
135
|
|
132
136
|
describe "when the variant is different" do
|
133
137
|
it "should not be equal" do
|
134
|
-
Voice.new(:variant => 1).should_not == Voice.new(:variant => 2)
|
138
|
+
Voice.new(doc, :variant => 1).should_not == Voice.new(doc, :variant => 2)
|
135
139
|
end
|
136
140
|
end
|
137
141
|
|
138
142
|
describe "when the name is different" do
|
139
143
|
it "should not be equal" do
|
140
|
-
Voice.new(:name => "Hello").should_not == Voice.new(:name => "Hello there")
|
144
|
+
Voice.new(doc, :name => "Hello").should_not == Voice.new(doc, :name => "Hello there")
|
141
145
|
end
|
142
146
|
end
|
143
147
|
end
|
@@ -148,47 +152,47 @@ module RubySpeech
|
|
148
152
|
end
|
149
153
|
|
150
154
|
it "should accept Audio" do
|
151
|
-
lambda { subject << Audio.new }.should_not raise_error
|
155
|
+
lambda { subject << Audio.new(doc) }.should_not raise_error
|
152
156
|
end
|
153
157
|
|
154
158
|
it "should accept Break" do
|
155
|
-
lambda { subject << Break.new }.should_not raise_error
|
159
|
+
lambda { subject << Break.new(doc) }.should_not raise_error
|
156
160
|
end
|
157
161
|
|
158
162
|
it "should accept Emphasis" do
|
159
|
-
lambda { subject << Emphasis.new }.should_not raise_error
|
163
|
+
lambda { subject << Emphasis.new(doc) }.should_not raise_error
|
160
164
|
end
|
161
165
|
|
162
166
|
it "should accept Mark" do
|
163
|
-
lambda { subject << Mark.new }.should_not raise_error
|
167
|
+
lambda { subject << Mark.new(doc) }.should_not raise_error
|
164
168
|
end
|
165
169
|
|
166
170
|
it "should accept P" do
|
167
|
-
lambda { subject << P.new }.should_not raise_error
|
171
|
+
lambda { subject << P.new(doc) }.should_not raise_error
|
168
172
|
end
|
169
173
|
|
170
174
|
it "should accept Phoneme" do
|
171
|
-
lambda { subject << Phoneme.new }.should_not raise_error
|
175
|
+
lambda { subject << Phoneme.new(doc) }.should_not raise_error
|
172
176
|
end
|
173
177
|
|
174
178
|
it "should accept Prosody" do
|
175
|
-
lambda { subject << Prosody.new }.should_not raise_error
|
179
|
+
lambda { subject << Prosody.new(doc) }.should_not raise_error
|
176
180
|
end
|
177
181
|
|
178
182
|
it "should accept SayAs" do
|
179
|
-
lambda { subject << SayAs.new(:interpret_as => :foo) }.should_not raise_error
|
183
|
+
lambda { subject << SayAs.new(doc, :interpret_as => :foo) }.should_not raise_error
|
180
184
|
end
|
181
185
|
|
182
186
|
it "should accept Sub" do
|
183
|
-
lambda { subject << Sub.new }.should_not raise_error
|
187
|
+
lambda { subject << Sub.new(doc) }.should_not raise_error
|
184
188
|
end
|
185
189
|
|
186
190
|
it "should accept S" do
|
187
|
-
lambda { subject << S.new }.should_not raise_error
|
191
|
+
lambda { subject << S.new(doc) }.should_not raise_error
|
188
192
|
end
|
189
193
|
|
190
194
|
it "should accept Voice" do
|
191
|
-
lambda { subject << Voice.new }.should_not raise_error
|
195
|
+
lambda { subject << Voice.new(doc) }.should_not raise_error
|
192
196
|
end
|
193
197
|
|
194
198
|
it "should raise InvalidChildError with non-acceptable objects" do
|
@@ -3,57 +3,60 @@ require 'spec_helper'
|
|
3
3
|
module RubySpeech
|
4
4
|
describe SSML do
|
5
5
|
describe "#draw" do
|
6
|
+
let(:doc) { Nokogiri::XML::Document.new }
|
7
|
+
|
6
8
|
it "should create an SSML document" do
|
7
|
-
expected_doc = SSML::Speak.new
|
9
|
+
expected_doc = SSML::Speak.new doc
|
8
10
|
SSML.draw.should == expected_doc
|
11
|
+
SSML.draw.document.xpath('ns:speak', ns: 'http://www.w3.org/2001/10/synthesis').size.should == 1
|
9
12
|
end
|
10
13
|
|
11
14
|
it "can draw with a language" do
|
12
|
-
expected_doc = SSML::Speak.new language: 'pt-BR'
|
15
|
+
expected_doc = SSML::Speak.new doc, language: 'pt-BR'
|
13
16
|
SSML.draw(language: 'pt-BR').should == expected_doc
|
14
17
|
end
|
15
18
|
|
16
19
|
describe "when the return value of the block is a string" do
|
17
20
|
it "should be inserted into the document" do
|
18
|
-
expected_doc = SSML::Speak.new(:content => "Hi, I'm Fred")
|
21
|
+
expected_doc = SSML::Speak.new(doc, :content => "Hi, I'm Fred")
|
19
22
|
SSML.draw { "Hi, I'm Fred" }.should == expected_doc
|
20
23
|
end
|
21
24
|
end
|
22
25
|
|
23
26
|
describe "when the return value of the block is not a string" do
|
24
27
|
it "should not be inserted into the document" do
|
25
|
-
expected_doc = SSML::Speak.new
|
28
|
+
expected_doc = SSML::Speak.new doc
|
26
29
|
SSML.draw { :foo }.should == expected_doc
|
27
30
|
end
|
28
31
|
end
|
29
32
|
|
30
33
|
describe "when inserting a string" do
|
31
34
|
it "should work" do
|
32
|
-
expected_doc = SSML::Speak.new(:content => "Hi, I'm Fred")
|
35
|
+
expected_doc = SSML::Speak.new(doc, :content => "Hi, I'm Fred")
|
33
36
|
SSML.draw { string "Hi, I'm Fred" }.should == expected_doc
|
34
37
|
end
|
35
38
|
end
|
36
39
|
|
37
40
|
it "should allow other SSML elements to be inserted in the document" do
|
38
|
-
|
39
|
-
expected_doc
|
40
|
-
|
41
|
-
doc.should == expected_doc
|
41
|
+
expected_doc = SSML::Speak.new doc
|
42
|
+
expected_doc << SSML::Voice.new(doc, :gender => :male, :name => 'fred')
|
43
|
+
SSML.draw { voice :gender => :male, :name => 'fred' }.should == expected_doc
|
42
44
|
end
|
43
45
|
|
44
46
|
it "should allow nested block return values" do
|
47
|
+
expected_doc = SSML::Speak.new doc
|
48
|
+
expected_doc << SSML::Voice.new(doc, :gender => :male, :name => 'fred', :content => "Hi, I'm Fred.")
|
49
|
+
|
45
50
|
doc = RubySpeech::SSML.draw do
|
46
51
|
voice :gender => :male, :name => 'fred' do
|
47
52
|
"Hi, I'm Fred."
|
48
53
|
end
|
49
54
|
end
|
50
|
-
expected_doc = SSML::Speak.new
|
51
|
-
expected_doc << SSML::Voice.new(:gender => :male, :name => 'fred', :content => "Hi, I'm Fred.")
|
52
55
|
doc.should == expected_doc
|
53
56
|
end
|
54
57
|
|
55
58
|
it "should allow nested SSML elements" do
|
56
|
-
|
59
|
+
drawn_doc = RubySpeech::SSML.draw do
|
57
60
|
voice :gender => :male, :name => 'fred' do
|
58
61
|
string "Hi, I'm Fred. The time is currently "
|
59
62
|
say_as :interpret_as => 'date', :format => 'dmy' do
|
@@ -61,11 +64,12 @@ module RubySpeech
|
|
61
64
|
end
|
62
65
|
end
|
63
66
|
end
|
64
|
-
|
65
|
-
voice
|
66
|
-
|
67
|
+
|
68
|
+
voice = SSML::Voice.new(doc, :gender => :male, :name => 'fred', :content => "Hi, I'm Fred. The time is currently ")
|
69
|
+
voice << SSML::SayAs.new(doc, :interpret_as => 'date', :format => 'dmy', :content => "01/02/1960")
|
70
|
+
expected_doc = SSML::Speak.new doc
|
67
71
|
expected_doc << voice
|
68
|
-
|
72
|
+
drawn_doc.should == expected_doc
|
69
73
|
end
|
70
74
|
|
71
75
|
it "should allow accessing methods defined outside the block" do
|
@@ -73,12 +77,8 @@ module RubySpeech
|
|
73
77
|
'bar'
|
74
78
|
end
|
75
79
|
|
76
|
-
|
77
|
-
|
78
|
-
end
|
79
|
-
|
80
|
-
expected_doc = SSML::Speak.new :content => foo
|
81
|
-
doc.should == expected_doc
|
80
|
+
expected_doc = SSML::Speak.new doc, :content => foo
|
81
|
+
SSML.draw { string foo }.should == expected_doc
|
82
82
|
end
|
83
83
|
|
84
84
|
describe "embedding" do
|
@@ -109,7 +109,7 @@ module RubySpeech
|
|
109
109
|
end
|
110
110
|
|
111
111
|
it "SSML elements" do
|
112
|
-
element = SSML::Emphasis.new(:content => "HELLO?")
|
112
|
+
element = SSML::Emphasis.new(doc, :content => "HELLO?")
|
113
113
|
|
114
114
|
doc = RubySpeech::SSML.draw do
|
115
115
|
voice :gender => :male, :name => 'fred' do
|
@@ -148,19 +148,19 @@ module RubySpeech
|
|
148
148
|
end
|
149
149
|
|
150
150
|
it "should properly escape string input" do
|
151
|
-
|
151
|
+
drawn_doc = RubySpeech::SSML.draw do
|
152
152
|
voice { string "I <3 nachos." }
|
153
153
|
voice { "I <3 nachos." }
|
154
154
|
end
|
155
|
-
expected_doc = SSML::Speak.new
|
155
|
+
expected_doc = SSML::Speak.new doc
|
156
156
|
2.times do
|
157
|
-
expected_doc << SSML::Voice.new(:native_content => "I <3 nachos.")
|
157
|
+
expected_doc << SSML::Voice.new(doc, :native_content => "I <3 nachos.")
|
158
158
|
end
|
159
|
-
|
159
|
+
drawn_doc.should == expected_doc
|
160
160
|
end
|
161
161
|
|
162
162
|
it "should allow all permutations of possible nested SSML elements" do
|
163
|
-
|
163
|
+
drawn_doc = RubySpeech::SSML.draw do
|
164
164
|
string "Hello world."
|
165
165
|
ssml_break
|
166
166
|
audio :src => "hello" do
|
@@ -211,56 +211,57 @@ module RubySpeech
|
|
211
211
|
end
|
212
212
|
end
|
213
213
|
end
|
214
|
-
expected_doc = SSML::Speak.new(:content => "Hello world.")
|
215
|
-
expected_doc << SSML::Break.new
|
216
|
-
audio = SSML::Audio.new(:src => "hello", :content => "HELLO?")
|
217
|
-
audio << SSML::Break.new
|
218
|
-
audio << SSML::Audio.new(:src => "hello")
|
219
|
-
audio << SSML::Emphasis.new
|
220
|
-
audio << SSML::Prosody.new
|
221
|
-
audio << SSML::SayAs.new(:interpret_as => 'date')
|
222
|
-
audio << SSML::Voice.new
|
214
|
+
expected_doc = SSML::Speak.new(doc, :content => "Hello world.")
|
215
|
+
expected_doc << SSML::Break.new(doc)
|
216
|
+
audio = SSML::Audio.new(doc, :src => "hello", :content => "HELLO?")
|
217
|
+
audio << SSML::Break.new(doc)
|
218
|
+
audio << SSML::Audio.new(doc, :src => "hello")
|
219
|
+
audio << SSML::Emphasis.new(doc)
|
220
|
+
audio << SSML::Prosody.new(doc)
|
221
|
+
audio << SSML::SayAs.new(doc, :interpret_as => 'date')
|
222
|
+
audio << SSML::Voice.new(doc)
|
223
223
|
expected_doc << audio
|
224
|
-
emphasis = SSML::Emphasis.new(:content => "HELLO?")
|
225
|
-
emphasis << SSML::Break.new
|
226
|
-
emphasis << SSML::Audio.new(:src => "hello")
|
227
|
-
emphasis << SSML::Emphasis.new
|
228
|
-
emphasis << SSML::Prosody.new
|
229
|
-
emphasis << SSML::SayAs.new(:interpret_as => 'date')
|
230
|
-
emphasis << SSML::Voice.new
|
224
|
+
emphasis = SSML::Emphasis.new(doc, :content => "HELLO?")
|
225
|
+
emphasis << SSML::Break.new(doc)
|
226
|
+
emphasis << SSML::Audio.new(doc, :src => "hello")
|
227
|
+
emphasis << SSML::Emphasis.new(doc)
|
228
|
+
emphasis << SSML::Prosody.new(doc)
|
229
|
+
emphasis << SSML::SayAs.new(doc, :interpret_as => 'date')
|
230
|
+
emphasis << SSML::Voice.new(doc)
|
231
231
|
expected_doc << emphasis
|
232
|
-
prosody = SSML::Prosody.new(:rate => :slow, :content => "H...E...L...L...O?")
|
233
|
-
prosody << SSML::Break.new
|
234
|
-
prosody << SSML::Audio.new(:src => "hello")
|
235
|
-
prosody << SSML::Emphasis.new
|
236
|
-
prosody << SSML::Prosody.new
|
237
|
-
prosody << SSML::SayAs.new(:interpret_as => 'date')
|
238
|
-
prosody << SSML::Voice.new
|
232
|
+
prosody = SSML::Prosody.new(doc, :rate => :slow, :content => "H...E...L...L...O?")
|
233
|
+
prosody << SSML::Break.new(doc)
|
234
|
+
prosody << SSML::Audio.new(doc, :src => "hello")
|
235
|
+
prosody << SSML::Emphasis.new(doc)
|
236
|
+
prosody << SSML::Prosody.new(doc)
|
237
|
+
prosody << SSML::SayAs.new(doc, :interpret_as => 'date')
|
238
|
+
prosody << SSML::Voice.new(doc)
|
239
239
|
expected_doc << prosody
|
240
|
-
expected_doc << SSML::SayAs.new(:interpret_as => 'date', :format => 'dmy', :content => "01/02/1960")
|
241
|
-
voice = SSML::Voice.new(:gender => :male, :name => 'fred', :content => "Hi, I'm Fred. The time is currently ")
|
242
|
-
voice << SSML::SayAs.new(:interpret_as => 'date', :format => 'dmy', :content => "01/02/1960")
|
243
|
-
voice << SSML::Break.new
|
244
|
-
voice << SSML::Audio.new(:src => "hello")
|
245
|
-
voice << SSML::Emphasis.new(:content => "I'm so old")
|
246
|
-
voice << SSML::Prosody.new(:rate => :fast, :content => "And yet so spritely!")
|
247
|
-
voice << SSML::Voice.new(:age => 12, :content => "And I'm young Fred")
|
240
|
+
expected_doc << SSML::SayAs.new(doc, :interpret_as => 'date', :format => 'dmy', :content => "01/02/1960")
|
241
|
+
voice = SSML::Voice.new(doc, :gender => :male, :name => 'fred', :content => "Hi, I'm Fred. The time is currently ")
|
242
|
+
voice << SSML::SayAs.new(doc, :interpret_as => 'date', :format => 'dmy', :content => "01/02/1960")
|
243
|
+
voice << SSML::Break.new(doc)
|
244
|
+
voice << SSML::Audio.new(doc, :src => "hello")
|
245
|
+
voice << SSML::Emphasis.new(doc, :content => "I'm so old")
|
246
|
+
voice << SSML::Prosody.new(doc, :rate => :fast, :content => "And yet so spritely!")
|
247
|
+
voice << SSML::Voice.new(doc, :age => 12, :content => "And I'm young Fred")
|
248
248
|
expected_doc << voice
|
249
|
-
|
249
|
+
drawn_doc.should == expected_doc
|
250
250
|
end
|
251
251
|
end
|
252
252
|
|
253
253
|
describe "importing nested tags" do
|
254
|
-
let(:
|
254
|
+
let(:doc) { Nokogiri::XML::Document.new }
|
255
|
+
let(:say_as) { SSML::SayAs.new doc, :interpret_as => 'date', :format => 'dmy', :content => "01/02/1960" }
|
255
256
|
let(:string) { "Hi, I'm Fred. The time is currently " }
|
256
257
|
let :voice do
|
257
|
-
SSML::Voice.new(:gender => :male, :name => 'fred', :content => string).tap do |voice|
|
258
|
+
SSML::Voice.new(doc, :gender => :male, :name => 'fred', :content => string).tap do |voice|
|
258
259
|
voice << say_as
|
259
260
|
end
|
260
261
|
end
|
261
262
|
|
262
263
|
let :document do
|
263
|
-
SSML::Speak.new.tap { |doc| doc << voice }.to_s
|
264
|
+
SSML::Speak.new(doc).tap { |doc| doc << voice }.to_s
|
264
265
|
end
|
265
266
|
|
266
267
|
let(:import) { SSML.import document }
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,57 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_speech
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.2.0
|
4
5
|
prerelease:
|
5
|
-
version: 2.1.2
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- Ben Langfeld
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: niceogiri
|
16
|
-
version_requirements: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - ~>
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '1.1'
|
21
|
-
- - '>='
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 1.1.2
|
24
|
-
none: false
|
25
|
-
requirement: !ruby/object:Gem::Requirement
|
26
|
-
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '1.1'
|
30
|
-
- - '>='
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 1.1.2
|
33
|
-
none: false
|
34
|
-
prerelease: false
|
35
|
-
type: :runtime
|
36
14
|
- !ruby/object:Gem::Dependency
|
37
15
|
name: nokogiri
|
38
16
|
version_requirements: !ruby/object:Gem::Requirement
|
39
17
|
requirements:
|
40
18
|
- - ~>
|
41
19
|
- !ruby/object:Gem::Version
|
42
|
-
version: '1.
|
43
|
-
- - '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 1.5.6
|
20
|
+
version: '1.6'
|
46
21
|
none: false
|
47
22
|
requirement: !ruby/object:Gem::Requirement
|
48
23
|
requirements:
|
49
24
|
- - ~>
|
50
25
|
- !ruby/object:Gem::Version
|
51
|
-
version: '1.
|
52
|
-
- - '>='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 1.5.6
|
26
|
+
version: '1.6'
|
55
27
|
none: false
|
56
28
|
prerelease: false
|
57
29
|
type: :runtime
|
@@ -62,12 +34,18 @@ dependencies:
|
|
62
34
|
- - '>='
|
63
35
|
- !ruby/object:Gem::Version
|
64
36
|
version: 3.0.7
|
37
|
+
- - <
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 5.0.0
|
65
40
|
none: false
|
66
41
|
requirement: !ruby/object:Gem::Requirement
|
67
42
|
requirements:
|
68
43
|
- - '>='
|
69
44
|
- !ruby/object:Gem::Version
|
70
45
|
version: 3.0.7
|
46
|
+
- - <
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 5.0.0
|
71
49
|
none: false
|
72
50
|
prerelease: false
|
73
51
|
type: :runtime
|
@@ -291,7 +269,6 @@ files:
|
|
291
269
|
- lib/ruby_speech/ssml/sub.rb
|
292
270
|
- lib/ruby_speech/ssml/voice.rb
|
293
271
|
- lib/ruby_speech/version.rb
|
294
|
-
- lib/ruby_speech/xml.rb
|
295
272
|
- lib/ruby_speech/xml/language.rb
|
296
273
|
- ruby_speech.gemspec
|
297
274
|
- spec/ruby_speech/grxml/grammar_spec.rb
|
@@ -339,8 +316,8 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
339
316
|
- !ruby/object:Gem::Version
|
340
317
|
segments:
|
341
318
|
- 0
|
342
|
-
hash: 2
|
343
319
|
version: '0'
|
320
|
+
hash: 2
|
344
321
|
none: false
|
345
322
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
346
323
|
requirements:
|
@@ -348,8 +325,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
348
325
|
- !ruby/object:Gem::Version
|
349
326
|
segments:
|
350
327
|
- 0
|
351
|
-
hash: 2
|
352
328
|
version: '0'
|
329
|
+
hash: 2
|
353
330
|
none: false
|
354
331
|
requirements: []
|
355
332
|
rubyforge_project: ruby_speech
|