ruby_speech 2.3.1-java → 2.3.2-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2392c6cf73b13b54d94cd854f0b58cf4787356f1
4
- data.tar.gz: cf5c6d4c8d537416c6389974237b5b965a898d25
3
+ metadata.gz: ce3cb16ff3eaf366c78390c3473c6c490c08371a
4
+ data.tar.gz: 389193549cb748c0da31dadaf564e1b31786c5f2
5
5
  SHA512:
6
- metadata.gz: 7aeeeeb1b5bf64c26f936f29e2df02b4c9198340efa535dd403429aaabbc753a98c03bc27178c4f3e58dab13affd13456d5064b7562549b7e48dba3a185213a2
7
- data.tar.gz: ade7291fd515e30ea1ca77d76a6fc59878687a6c985e724a2b00add1b8cfeebf4cf897a6eadb057c05b464138f7d0504060faca40d327b2e4c382540a448eb17
6
+ metadata.gz: ff3712f5fcb287299ce97b7389c7f2be8e991116f320600014b415f4d90818c3f3e4c1d043303eac2a6e866705770b625f63aaf5c3e2364bb87eaf4cbe9be4bc
7
+ data.tar.gz: 051bcf95b593cb586bad668a47c60b61ba009f05807204f978d4ae295e038eda05260307932355ff5b5b28034a7d6501153c1e974e2bb1bc3e1bf008be602799
@@ -0,0 +1,2 @@
1
+ LineLength:
2
+ Enabled: false
@@ -4,8 +4,8 @@ rvm:
4
4
  - 1.9.3
5
5
  - 2.0.0
6
6
  - 2.1.0
7
- - jruby-19mode
8
- - rbx-19mode
7
+ - jruby
8
+ - rbx
9
9
  - ruby-head
10
10
  matrix:
11
11
  allow_failures:
@@ -1,5 +1,11 @@
1
1
  # [develop](https://github.com/benlangfeld/ruby_speech)
2
2
 
3
+ # [2.3.2](https://github.com/benlangfeld/ruby_speech/compare/v2.3.1...v2.3.2) - [2014-04-21](https://rubygems.org/gems/ruby_speech/versions/2.3.2)
4
+ * Bugfix: String nodes should take non-strings and cast to a string (`#to_s`)
5
+ * Bugfix: Cleanly handle NLSML with no input tag
6
+ * Bugfix: Drawing an NLSML doc should return something structured/parsed
7
+ * Bugfix: Cloning SSML documents no longer turns them into GRXML docs
8
+
3
9
  # [2.3.1](https://github.com/benlangfeld/ruby_speech/compare/v2.3.0...v2.3.1) - [2014-02-24](https://rubygems.org/gems/ruby_speech/versions/2.3.1)
4
10
  * Bugfix: Phone number grammar should only allow a single instance of '*'/'x'
5
11
  * Bugfix: Concatenating documents containing strings across the border inserts appropriate spacing (#21).
data/README.md CHANGED
@@ -259,7 +259,7 @@ require 'ruby_speech'
259
259
 
260
260
  nlsml = RubySpeech::NLSML.draw grammar: 'http://flight' do
261
261
  interpretation confidence: 0.6 do
262
- input "I want to go to Pittsburgh", mode: :speech
262
+ input "I want to go to Pittsburgh", mode: :voice
263
263
 
264
264
  instance do
265
265
  airline do
@@ -288,7 +288,7 @@ becomes:
288
288
  <?xml version="1.0"?>
289
289
  <result xmlns="http://www.ietf.org/xml/ns/mrcpv2" grammar="http://flight">
290
290
  <interpretation confidence="0.6">
291
- <input mode="speech">I want to go to Pittsburgh</input>
291
+ <input mode="voice">I want to go to Pittsburgh</input>
292
292
  <instance>
293
293
  <airline>
294
294
  <to_city>Pittsburgh</to_city>
@@ -315,7 +315,7 @@ document.match? # => true
315
315
  document.interpretations # => [
316
316
  {
317
317
  confidence: 0.6,
318
- input: { mode: :speech, content: 'I want to go to Pittsburgh' },
318
+ input: { mode: :voice, content: 'I want to go to Pittsburgh' },
319
319
  instance: { airline: { to_city: 'Pittsburgh' } }
320
320
  },
321
321
  {
@@ -326,7 +326,7 @@ document.interpretations # => [
326
326
  ]
327
327
  document.best_interpretation # => {
328
328
  confidence: 0.6,
329
- input: { mode: :speech, content: 'I want to go to Pittsburgh' },
329
+ input: { mode: :voice, content: 'I want to go to Pittsburgh' },
330
330
  instance: { airline: { to_city: 'Pittsburgh' } }
331
331
  }
332
332
  ```
@@ -172,11 +172,11 @@ module RubySpeech
172
172
  end
173
173
 
174
174
  def string(other)
175
- self << Nokogiri::XML::Text.new(other, document)
175
+ self << Nokogiri::XML::Text.new(other.to_s, document)
176
176
  end
177
177
 
178
178
  def clone
179
- GRXML.import to_xml
179
+ self.class.import to_xml
180
180
  end
181
181
 
182
182
  def traverse(&block)
@@ -5,11 +5,12 @@ module RubySpeech
5
5
 
6
6
  def initialize(options = {}, &block)
7
7
  options = {'xmlns' => NLSML_NAMESPACE}.merge(options)
8
- @document = Nokogiri::XML::Builder.new do |builder|
8
+ xml_doc = Nokogiri::XML::Builder.new do |builder|
9
9
  builder.result options do |r|
10
10
  apply_block r, &block
11
11
  end
12
12
  end.doc
13
+ @document = RubySpeech::NLSML::Document.new xml_doc
13
14
  end
14
15
 
15
16
  def interpretation(*args, &block)
@@ -38,6 +38,10 @@ module RubySpeech
38
38
  noinput_elements.any?
39
39
  end
40
40
 
41
+ def to_xml
42
+ document.to_xml
43
+ end
44
+
41
45
  private
42
46
 
43
47
  def nomatch?
@@ -58,6 +62,7 @@ module RubySpeech
58
62
 
59
63
  def input_hash_for_interpretation(interpretation)
60
64
  input_element = interpretation.at_xpath 'ns:input', 'ns' => NLSML_NAMESPACE
65
+ return unless input_element
61
66
  { content: input_element.content }.tap do |h|
62
67
  h[:mode] = input_element['mode'].to_sym if input_element['mode']
63
68
  end
@@ -1,3 +1,3 @@
1
1
  module RubySpeech
2
- VERSION = "2.3.1"
2
+ VERSION = "2.3.2"
3
3
  end
@@ -242,7 +242,7 @@ module RubySpeech
242
242
  string "HELLO?"
243
243
  item :weight => 2.5
244
244
  one_of do
245
- item { "1" }
245
+ item { string 1 }
246
246
  item { "2" }
247
247
  end
248
248
  ruleref :uri => '#test'
@@ -55,6 +55,22 @@ describe RubySpeech::NLSML do
55
55
  document.to_xml.should == expected_document
56
56
  end
57
57
 
58
+ it "should return a structured/parsed document" do
59
+ document = RubySpeech::NLSML.draw(grammar: 'http://flight') do
60
+ interpretation confidence: 0.6 do
61
+ input "I want to go to Pittsburgh", mode: :speech
62
+
63
+ instance do
64
+ airline do
65
+ to_city 'Pittsburgh'
66
+ end
67
+ end
68
+ end
69
+ end
70
+
71
+ document.should be_match
72
+ end
73
+
58
74
  context "with a string instance" do
59
75
  let :example_document do
60
76
  '''
@@ -198,6 +214,38 @@ describe RubySpeech::NLSML do
198
214
  its(:best_interpretation) { should == expected_best_interpretation }
199
215
  end
200
216
 
217
+ context "with an interpretation that has no input" do
218
+ let :example_document do
219
+ '''
220
+ <result xmlns="http://www.ietf.org/xml/ns/mrcpv2" grammar="http://flight">
221
+ <interpretation confidence="0.6">
222
+ <instance>
223
+ <airline>
224
+ <to_city>Pittsburgh</to_city>
225
+ </airline>
226
+ </instance>
227
+ </interpretation>
228
+ </result>
229
+ '''
230
+ end
231
+
232
+ let(:expected_best_interpretation) do
233
+ {
234
+ confidence: 0.6,
235
+ input: nil,
236
+ instance: { airline: { to_city: 'Pittsburgh' } },
237
+ instances: [{ airline: { to_city: 'Pittsburgh' } }]
238
+ }
239
+ end
240
+
241
+ let(:expected_interpretations) do
242
+ [expected_best_interpretation]
243
+ end
244
+
245
+ its(:interpretations) { should == expected_interpretations }
246
+ its(:best_interpretation) { should == expected_best_interpretation }
247
+ end
248
+
201
249
  context "with a string instance" do
202
250
  let :example_document do
203
251
  '''
@@ -81,6 +81,30 @@ module RubySpeech
81
81
  SSML.draw { string foo }.should == expected_doc
82
82
  end
83
83
 
84
+ describe 'cloning' do
85
+ context 'SSML documents' do
86
+ let :original do
87
+ RubySpeech::SSML.draw do
88
+ string "Hi, I'm Fred."
89
+ end
90
+ end
91
+
92
+ subject { original.clone }
93
+
94
+ it 'should match the contents of the original document' do
95
+ subject.to_s.should == original.to_s
96
+ end
97
+
98
+ it 'should match the class of the original document' do
99
+ subject.class.should == original.class
100
+ end
101
+
102
+ it 'should be equal to the original document' do
103
+ subject.should == original
104
+ end
105
+ end
106
+ end
107
+
84
108
  describe "embedding" do
85
109
  it "SSML documents" do
86
110
  doc1 = RubySpeech::SSML.draw do
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.3.1
4
+ version: 2.3.2
5
5
  platform: java
6
6
  authors:
7
7
  - Ben Langfeld
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-25 00:00:00.000000000 Z
11
+ date: 2014-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -206,6 +206,7 @@ extensions: []
206
206
  extra_rdoc_files: []
207
207
  files:
208
208
  - .gitignore
209
+ - .hound.yml
209
210
  - .rspec
210
211
  - .travis.yml
211
212
  - CHANGELOG.md