Skip to content

marcus433/sinatra_speech

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Using pocketsphinx, Gst, ruby 1.8.7 (gst not working with ruby 1.9). For required gems using bundler.

gem install bundler
bundle install

To start the server go to the project root and type in terminal:

ruby recognizer_api.rb
curl -X POST  http://localhost:4567/recognizer
curl -X PUT --data-binary @/home/user/test/data/speech.raw http://localhost:4567/recognizer/ <session_id>
curl -X PUT http://localhost:4567/recognizer/ <session_id> /end
curl  http://localhost:4567/recognizer/ <session_id>
  • Response is by default xml. If you want json response set your request Accept headers to “application/json”

curl -X POST  http://localhost:4567/recognizer  -H "Accept:application/json"
  • For all requests, the successful response containing session data looks like this:

  • in xml:

<?xml version="1.0" encoding="UTF-8"?>
<recognizer_session>
  <closed_at></closed_at>
  <final_result_created_at></final_result_created_at>
  <created_at>2011-04-26 16:13:25</created_at>
  <result></result>
  <id>54374c7294</id>
  <system_message></system_message>
</recognizer_session>

* in json:

{"closed_at":null,"final_result_created_at":null,"system_message":null,"result":null,"id":"a1d80929c4","created_at":"2011-04-28 12:41:39"}
  • If an error occurs, the response looks like this:

  • in xml:

<?xml version="1.0" encoding="UTF-8"?>
<error>
  <message>X-Recognizer-Request-Type must be present and set to 'data' or 'data_end'</message>
</error>

* in json:

{"error":{"message":"Session with id b8e7524749 not found"}}

About

Simple webservice for speech recognition. Built on sinatra.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors