Skip to content

Instantly share code, notes, and snippets.

@getadeo
Forked from radralph/colors.rb
Last active May 16, 2018 01:52
Show Gist options
  • Save getadeo/4e29b8fd5e1ec7c36d23a067d4e65e67 to your computer and use it in GitHub Desktop.
Save getadeo/4e29b8fd5e1ec7c36d23a067d4e65e67 to your computer and use it in GitHub Desktop.
wait(1500)
say "Starting to test ASR..."
result = ask "Please choose a color from red, blue or green.", {
:choices => "red, blue, green",
:recognizer => "en-PH",
:timeout => 20,
:bargein => true,
:mode => "speech",
:minConfidence => 0.6,
:onChoice => lambda { |event|
say "On Choice"
},
:onBadChoice => lambda { |event|
say "On Bad Choice"
},
:onTimeout => lambda { |event|
say "we didn't receive your input"
}
}
if result.value.eql? "red"
say "you chose red"
elsif result.value.eql? "blue"
say "you chose blue"
elsif result.value.eql? "green"
say "you chose green"
else
say "ASR not working"
end
say "goodbye"
hangup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment