Permalink
Browse files

Set a default recogniser from config

  • Loading branch information...
1 parent 1a722c3 commit f243ce94b853178cbbd0115405818826f7d91f3b @benlangfeld benlangfeld committed Nov 17, 2012
@@ -47,7 +47,7 @@ def listen(opts = {})
end
{ value: grammar }
end
- input_options = {grammar: grammar_opts, min_confidence: AdhearsionASR::Plugin.config[:min_confidence]}.merge(opts)
+ input_options = {grammar: grammar_opts, min_confidence: AdhearsionASR::Plugin.config[:min_confidence], recognizer: AdhearsionASR::Plugin.config[:recognizer]}.merge(opts)
prompts = Array(opts.delete :prompt)
timeout = opts.has_key?(:timeout) ? opts.delete(:timeout) : AdhearsionASR::Plugin.config[:timeout]
[:prompt, :options, :grammar_url, :timeout].each { |o| input_options.delete o }
@@ -3,6 +3,7 @@ class Plugin < Adhearsion::Plugin
config :adhearsion_asr do
min_confidence 0.5, desc: 'The default minimum confidence level used for all recognizer invocations.', transform: Proc.new { |v| v.to_f }
timeout 5, desc: 'The default timeout (in seconds) used for all recognizer invocations.', transform: Proc.new { |v| v.to_i }
+ recognizer 'en-us', desc: 'The default recognizer used for all invocations. Set nil to use engine default.'
language 'en-us', desc: 'The default language set on generated grammars. Set nil to use engine default.'
end
end
@@ -56,7 +56,7 @@ def expect_component_execution(component, fail = false)
}
let(:input_component) {
- Punchblock::Component::Input.new grammar: { value: grxml }, min_confidence: 0.5
+ Punchblock::Component::Input.new grammar: { value: grxml }, min_confidence: 0.5, recognizer: 'en-us'
}
let(:nlsml) do
@@ -112,6 +112,13 @@ def expect_component_complete_event
subject.listen options: %w{yes no}, language: 'en-gb'
end
+ it "allows specifying a recognizer" do
+ expect_component_complete_event
+ input_component.recognizer = 'pt-BR'
+ expect_component_execution input_component
+ subject.listen options: %w{yes no}, recognizer: 'pt-BR'
+ end
+
it "allows specifying a min confidence" do
expect_component_complete_event
input_component.min_confidence = 0.1

0 comments on commit f243ce9

Please sign in to comment.