ruby_speech 2.2.1 → 2.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 +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +3 -0
- data/README.md +6 -0
- data/lib/ruby_speech/generic_element.rb +1 -1
- data/lib/ruby_speech/ssml/break.rb +1 -2
- data/lib/ruby_speech/ssml/element.rb +7 -0
- data/lib/ruby_speech/ssml/prosody.rb +11 -8
- data/lib/ruby_speech/version.rb +1 -1
- data/ruby_speech.gemspec +1 -0
- data/spec/spec_helper.rb +3 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f773e0cb875c8a40f62c2fbf8763293fc1666ff7
|
4
|
+
data.tar.gz: 7c54e1b650e3e9542740608f108a7455c7625e9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31b7e25e0214bf2738601217c0a417c308c8057a5a109f39eaa80632dbfc9fc7423122ac9dc7e7c2de665b4a6be4fe563338749f0d4093fb648246dad27656b2
|
7
|
+
data.tar.gz: 5140d70c2c151201ffe5fe75e14653292944111470f86caa483d4fee774fc0f92d21ddea656f62f722e95482deba0da8e6fb16e5652b3bcb4cc76041bf956392
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# [develop](https://github.com/benlangfeld/ruby_speech)
|
2
2
|
|
3
|
+
# [2.2.2](https://github.com/benlangfeld/ruby_speech/compare/v2.2.1...v2.2.2) - [2013-09-03](https://rubygems.org/gems/ruby_speech/versions/2.2.2)
|
4
|
+
* Bugfix: Fix an exception message to include object type
|
5
|
+
|
3
6
|
# [2.2.1](https://github.com/benlangfeld/ruby_speech/compare/v2.2.0...v2.2.1) - [2013-07-02](https://rubygems.org/gems/ruby_speech/versions/2.2.1)
|
4
7
|
* Bugfix: Ensure that concatenating documents doesn't mutate the originals on JRuby
|
5
8
|
|
data/README.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
[](https://rubygems.org/gems/ruby_speech)
|
2
|
+
[](http://travis-ci.org/benlangfeld/ruby_speech)
|
3
|
+
[](https://gemnasium.com/benlangfeld/ruby_speech)
|
4
|
+
[](https://codeclimate.com/github/benlangfeld/ruby_speech)
|
5
|
+
[](https://coveralls.io/r/benlangfeld/ruby_speech)
|
6
|
+
|
1
7
|
# RubySpeech
|
2
8
|
RubySpeech is a library for constructing and parsing Text to Speech (TTS) and Automatic Speech Recognition (ASR) documents such as [SSML](http://www.w3.org/TR/speech-synthesis), [GRXML](http://www.w3.org/TR/speech-grammar/) and [NLSML](http://www.w3.org/TR/nl-spec/). Such documents can be constructed to be processed by TTS and ASR engines, parsed as the result from such, or used in the implementation of such engines.
|
3
9
|
|
@@ -163,7 +163,7 @@ module RubySpeech
|
|
163
163
|
when self.class.module::Element
|
164
164
|
self << other
|
165
165
|
else
|
166
|
-
raise ArgumentError, "Can only embed a String or a #{self.class.module} element, not a #{other}"
|
166
|
+
raise ArgumentError, "Can only embed a String or a #{self.class.module} element, not a #{other.class}"
|
167
167
|
end
|
168
168
|
end
|
169
169
|
|
@@ -45,8 +45,7 @@ module RubySpeech
|
|
45
45
|
# @raises ArgumentError if t is nota positive numeric value
|
46
46
|
#
|
47
47
|
def time=(t)
|
48
|
-
|
49
|
-
self[:time] = "#{t}s"
|
48
|
+
set_time_attribute :time, t
|
50
49
|
end
|
51
50
|
|
52
51
|
def <<(*args)
|
@@ -20,6 +20,13 @@ module RubySpeech
|
|
20
20
|
def to_doc
|
21
21
|
document
|
22
22
|
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def set_time_attribute(key, value)
|
27
|
+
raise ArgumentError, "You must specify a valid #{key} (positive float value in seconds)" unless value.is_a?(Numeric) && value >= 0
|
28
|
+
self[key] = "#{value}s"
|
29
|
+
end
|
23
30
|
end # Element
|
24
31
|
end # SSML
|
25
32
|
end # RubySpeech
|
@@ -56,9 +56,7 @@ module RubySpeech
|
|
56
56
|
# @raises ArgumentError if p is not a string that contains 'Hz' or one of VALID_PITCHES
|
57
57
|
#
|
58
58
|
def pitch=(p)
|
59
|
-
|
60
|
-
raise ArgumentError, "You must specify a valid pitch (\"[positive-number]Hz\", #{VALID_PITCHES.map(&:inspect).join ', '})" unless hz || VALID_PITCHES.include?(p)
|
61
|
-
self[:pitch] = p
|
59
|
+
set_frequency_attribute :pitch, p
|
62
60
|
end
|
63
61
|
|
64
62
|
##
|
@@ -100,9 +98,7 @@ module RubySpeech
|
|
100
98
|
# @raises ArgumentError if p is not a string that contains 'Hz' or one of VALID_PITCHES
|
101
99
|
#
|
102
100
|
def range=(p)
|
103
|
-
|
104
|
-
raise ArgumentError, "You must specify a valid range (\"[positive-number]Hz\", #{VALID_PITCHES.map(&:inspect).join ', '})" unless hz || VALID_PITCHES.include?(p)
|
105
|
-
self[:range] = p
|
101
|
+
set_frequency_attribute :range, p
|
106
102
|
end
|
107
103
|
|
108
104
|
##
|
@@ -145,8 +141,7 @@ module RubySpeech
|
|
145
141
|
# @raises ArgumentError if t is not a positive numeric value
|
146
142
|
#
|
147
143
|
def duration=(t)
|
148
|
-
|
149
|
-
self[:duration] = "#{t}s"
|
144
|
+
set_time_attribute :duration, t
|
150
145
|
end
|
151
146
|
|
152
147
|
##
|
@@ -182,6 +177,14 @@ module RubySpeech
|
|
182
177
|
def eql?(o)
|
183
178
|
super o, :pitch, :contour, :range, :rate, :duration, :volume
|
184
179
|
end
|
180
|
+
|
181
|
+
private
|
182
|
+
|
183
|
+
def set_frequency_attribute(key, value)
|
184
|
+
hz = value.is_a?(String) && value.include?('Hz') && value.to_f > 0
|
185
|
+
raise ArgumentError, "You must specify a valid #{key} (\"[positive-number]Hz\", #{VALID_PITCHES.map(&:inspect).join ', '})" unless hz || VALID_PITCHES.include?(value)
|
186
|
+
self[key] = value
|
187
|
+
end
|
185
188
|
end # Prosody
|
186
189
|
end # SSML
|
187
190
|
end # RubySpeech
|
data/lib/ruby_speech/version.rb
CHANGED
data/ruby_speech.gemspec
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_speech
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Langfeld
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -184,6 +184,20 @@ dependencies:
|
|
184
184
|
- - '>='
|
185
185
|
- !ruby/object:Gem::Version
|
186
186
|
version: '0'
|
187
|
+
- !ruby/object:Gem::Dependency
|
188
|
+
name: coveralls
|
189
|
+
requirement: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - '>='
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '0'
|
194
|
+
type: :development
|
195
|
+
prerelease: false
|
196
|
+
version_requirements: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - '>='
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '0'
|
187
201
|
description: Prepare SSML and GRXML documents with ease
|
188
202
|
email:
|
189
203
|
- ben@langfeld.me
|