def converse(prompt, responses = {})
      i, commands = 0, responses.map { |_key, value| value.inspect }.join(',')
      statement = responses.inject '' do |inner_statement, (key, value)|
        inner_statement <<
        (
          (i += 1) == 1 ?
          %(if response is "#{value}" then\n) :
          %(else if response is "#{value}" then\n)
        ) <<
        %(do shell script "echo '#{key}'"\n)
      end
      applescript(
        %(
        tell application "SpeechRecognitionServer"
          set response to listen for {#{commands}} with prompt "#{prompt}"
          #{statement}
          end if
        end tell
        )
      ).strip.to_sym
    end
#
Converse with speech recognition.

Currently a "poorman's" DSL to utilize applescript and
the MacOS speech recognition server.

=== Examples

case converse 'What is the best food?', :cookies => 'Cookies', :unknown => 'Nothing'
when :cookies
speak 'o.m.g. you are awesome!'
else
case converse 'That is lame, shall I convince you cookies are the best?', :yes => 'Ok', :no => 'No', :maybe => 'Maybe another time'
when :yes
speak 'Well you see, cookies are just fantastic.'
else
speak 'Ok then, bye.'
end
end

=== Notes

* MacOS only