adhearsion-asr 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/CHANGELOG.md +5 -0
- data/README.md +2 -2
- data/lib/adhearsion-asr/controller_methods.rb +2 -1
- data/lib/adhearsion-asr/prompt_builder.rb +11 -7
- data/lib/adhearsion-asr/result.rb +9 -0
- data/lib/adhearsion-asr/version.rb +1 -1
- data/spec/adhearsion-asr/controller_methods_spec.rb +20 -0
- metadata +24 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3c4b6f6a2412a2328172c2abbc9a4b7dab4d679
|
4
|
+
data.tar.gz: f01bf73b73e3ee9e73829babf1195579d226e9ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af9517ceeae874df35dda3d9cc21efae4b0fc2ae7316c5e9b33279f980b779fc79e32839b16eca035cf028e48a570f6f7c889bf36b747f43f50d100d12e3e5aa
|
7
|
+
data.tar.gz: 5cea700a6a39da4a2cb0d38185943a43aef1484b6291a7bfc2fe142b3fa1908788fc12860f3a3ea04f932013ae08952f3ef3b888e9999fec240fe828c30e1afd
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# [develop](https://github.com/adhearsion/adhearsion-asr)
|
2
2
|
|
3
|
+
# [v1.1.0](https://github.com/adhearsion/adhearsion-asr/compare/1.0.1...1.1.0) - [2014-01-02](https://rubygems.org/gems/adhearsion-asr/versions/1.1.0)
|
4
|
+
* Feature: Alias `Result#response` to `#utterance`, with a deprecation warning
|
5
|
+
* Feature: Add `#match?` predicate to `Result` object
|
6
|
+
* Feature: When no prompts are supplied, only execute an input component
|
7
|
+
|
3
8
|
# [v1.0.1](https://github.com/adhearsion/adhearsion-asr/compare/1.0.0...1.0.1) - [2013-09-30](https://rubygems.org/gems/adhearsion-asr/versions/1.0.1)
|
4
9
|
* Bugfix: A menu definition's block context is now available
|
5
10
|
|
data/README.md
CHANGED
@@ -77,7 +77,7 @@ class MyController < Adhearsion::CallController
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
-
result = ask grammar: grammar, input_options: { mode: :
|
80
|
+
result = ask grammar: grammar, input_options: { mode: :voice }
|
81
81
|
case result.status
|
82
82
|
when :match
|
83
83
|
speak "You said #{result.utterance}"
|
@@ -95,7 +95,7 @@ end
|
|
95
95
|
```ruby
|
96
96
|
class MyController < Adhearsion::CallController
|
97
97
|
def run
|
98
|
-
result = ask grammar_url: 'http://example.com/mygrammar.grxml', input_options: { mode: :
|
98
|
+
result = ask grammar_url: 'http://example.com/mygrammar.grxml', input_options: { mode: :voice }
|
99
99
|
case result.status
|
100
100
|
when :match
|
101
101
|
speak "You said #{result.utterance}"
|
@@ -42,9 +42,10 @@ module AdhearsionASR
|
|
42
42
|
|
43
43
|
options[:grammar] || options[:grammar_url] || options[:limit] || options[:terminator] || raise(ArgumentError, "You must specify at least one of limit, terminator or grammar")
|
44
44
|
|
45
|
-
output_document = output_formatter.ssml_for_collection(prompts)
|
46
45
|
grammars = AskGrammarBuilder.new(options).grammars
|
47
46
|
|
47
|
+
output_document = prompts.empty? ? nil : output_formatter.ssml_for_collection(prompts)
|
48
|
+
|
48
49
|
PromptBuilder.new(output_document, grammars, options).execute self
|
49
50
|
end
|
50
51
|
|
@@ -3,12 +3,6 @@ require 'adhearsion-asr/result'
|
|
3
3
|
module AdhearsionASR
|
4
4
|
class PromptBuilder
|
5
5
|
def initialize(output_document, grammars, options)
|
6
|
-
output_options = {
|
7
|
-
render_document: {value: output_document},
|
8
|
-
renderer: Adhearsion.config.platform.media.default_renderer,
|
9
|
-
voice: Adhearsion.config.platform.media.default_voice
|
10
|
-
}.merge(options[:output_options] || {})
|
11
|
-
|
12
6
|
input_options = {
|
13
7
|
mode: :dtmf,
|
14
8
|
initial_timeout: (options[:timeout] || Plugin.config.timeout) * 1000,
|
@@ -21,7 +15,17 @@ module AdhearsionASR
|
|
21
15
|
terminator: options[:terminator]
|
22
16
|
}.merge(options[:input_options] || {})
|
23
17
|
|
24
|
-
@prompt =
|
18
|
+
@prompt = if output_document
|
19
|
+
output_options = {
|
20
|
+
render_document: {value: output_document},
|
21
|
+
renderer: Adhearsion.config.platform.media.default_renderer,
|
22
|
+
voice: Adhearsion.config.platform.media.default_voice
|
23
|
+
}.merge(options[:output_options] || {})
|
24
|
+
|
25
|
+
Punchblock::Component::Prompt.new output_options, input_options, barge_in: options.has_key?(:interruptible) ? options[:interruptible] : true
|
26
|
+
else
|
27
|
+
Punchblock::Component::Input.new input_options
|
28
|
+
end
|
25
29
|
end
|
26
30
|
|
27
31
|
def execute(controller)
|
@@ -12,6 +12,15 @@ module AdhearsionASR
|
|
12
12
|
self[:utterance] = mode == :dtmf ? parse_dtmf(other) : other
|
13
13
|
end
|
14
14
|
|
15
|
+
def response
|
16
|
+
Adhearsion.deprecated "#utterance"
|
17
|
+
utterance
|
18
|
+
end
|
19
|
+
|
20
|
+
def match?
|
21
|
+
status == :match
|
22
|
+
end
|
23
|
+
|
15
24
|
private
|
16
25
|
|
17
26
|
def parse_dtmf(dtmf)
|
@@ -122,6 +122,14 @@ module AdhearsionASR
|
|
122
122
|
subject.ask prompts, limit: 5
|
123
123
|
end
|
124
124
|
|
125
|
+
context "with no prompts" do
|
126
|
+
it "executes an Input component with the correct grammar" do
|
127
|
+
Punchblock::Component::Input.any_instance.stub complete_event: double(reason: reason)
|
128
|
+
expect_component_execution Punchblock::Component::Input.new(expected_input_options)
|
129
|
+
subject.ask limit: 5
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
125
133
|
context "with a block passed" do
|
126
134
|
it "executes but logs a warning about the block validator" do
|
127
135
|
expect_component_execution expected_prompt
|
@@ -456,6 +464,7 @@ module AdhearsionASR
|
|
456
464
|
|
457
465
|
it "returns :match status and the utterance" do
|
458
466
|
result.status.should be :match
|
467
|
+
result.should be_match
|
459
468
|
result.mode.should be :dtmf
|
460
469
|
result.confidence.should == 1
|
461
470
|
result.utterance.should == '123'
|
@@ -528,6 +537,14 @@ module AdhearsionASR
|
|
528
537
|
result.utterance.should be == nil
|
529
538
|
end
|
530
539
|
end
|
540
|
+
|
541
|
+
context "when requested via #response" do
|
542
|
+
let(:utterance) { 'foo' }
|
543
|
+
|
544
|
+
it "returns the utterance" do
|
545
|
+
result.response.should be == 'foo'
|
546
|
+
end
|
547
|
+
end
|
531
548
|
end
|
532
549
|
|
533
550
|
context "with multiple digits separated by spaces" do
|
@@ -544,6 +561,7 @@ module AdhearsionASR
|
|
544
561
|
|
545
562
|
it "returns :nomatch status and a nil utterance" do
|
546
563
|
result.status.should eql(:nomatch)
|
564
|
+
result.should_not be_match
|
547
565
|
result.utterance.should be_nil
|
548
566
|
end
|
549
567
|
end
|
@@ -553,6 +571,7 @@ module AdhearsionASR
|
|
553
571
|
|
554
572
|
it "returns :noinput status and a nil utterance" do
|
555
573
|
result.status.should eql(:noinput)
|
574
|
+
result.should_not be_match
|
556
575
|
result.utterance.should be_nil
|
557
576
|
end
|
558
577
|
end
|
@@ -562,6 +581,7 @@ module AdhearsionASR
|
|
562
581
|
|
563
582
|
it "returns :hangup status and a nil utterance" do
|
564
583
|
result.status.should eql(:hangup)
|
584
|
+
result.should_not be_match
|
565
585
|
result.utterance.should be_nil
|
566
586
|
end
|
567
587
|
end
|
metadata
CHANGED
@@ -1,125 +1,125 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adhearsion-asr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Langfeld
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: adhearsion
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '2.4'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: punchblock
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '2.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: ruby_speech
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '2.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '2.5'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '2.5'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: guard-rspec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rb-fsevent
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - ~>
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0.9'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - ~>
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0.9'
|
125
125
|
description: Adds speech recognition support to Adhearsion as a plugin
|
@@ -129,9 +129,9 @@ executables: []
|
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
|
-
- .gitignore
|
133
|
-
- .rspec
|
134
|
-
- .travis.yml
|
132
|
+
- ".gitignore"
|
133
|
+
- ".rspec"
|
134
|
+
- ".travis.yml"
|
135
135
|
- CHANGELOG.md
|
136
136
|
- Gemfile
|
137
137
|
- Guardfile
|
@@ -159,17 +159,17 @@ require_paths:
|
|
159
159
|
- lib
|
160
160
|
required_ruby_version: !ruby/object:Gem::Requirement
|
161
161
|
requirements:
|
162
|
-
- -
|
162
|
+
- - ">="
|
163
163
|
- !ruby/object:Gem::Version
|
164
164
|
version: '0'
|
165
165
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
166
|
requirements:
|
167
|
-
- -
|
167
|
+
- - ">="
|
168
168
|
- !ruby/object:Gem::Version
|
169
169
|
version: '0'
|
170
170
|
requirements: []
|
171
171
|
rubyforge_project: adhearsion-asr
|
172
|
-
rubygems_version: 2.0
|
172
|
+
rubygems_version: 2.2.0
|
173
173
|
signing_key:
|
174
174
|
specification_version: 4
|
175
175
|
summary: Adds speech recognition support to Adhearsion as a plugin
|