Skip to content

Instantly share code, notes, and snippets.

@radralph
Last active May 16, 2018 01:52
Show Gist options
  • Save radralph/18c5636e4ec603dd94a2d9ff30986e43 to your computer and use it in GitHub Desktop.
Save radralph/18c5636e4ec603dd94a2d9ff30986e43 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