Creating Your First Speechweb Application
If you wish to create a Speechweb Application, then the following instructions
will help you get started!
- Grab our XML file and save it as index.xml in a directory
that is accessible to the web. If you are a student on the CS University servers, then save the files
to your public_html directory located in your home folder. (Make sure your public_html has permission
- Get a hold of our CGI file and save it as cgi.cgi in the same
directory as above.
- You'll also need a Grammar File. Save this as grammar.jsgf
in the same directory.
- Finally, you will need to download the build-speech-app
shell script in the same directory as you saved the above files. This script does some basic
transformations to the files you downloaded such as set the application greeting, and other
customizations. We assure you this script is not malicious, but for your own sanity, the source
is clearly visible.
- Run the build-speech-app script. To do this, you'll need to make the script executable.
(run 'chmod +x build-speech-app')
- Edit the grammar file to contain the phrases your application will respond to.
Click here to see some example grammar files.
- Next create an executable in any language you want (we suggest Haskell.)
Name that executable the same name that you gave as the answer to Enter application short name
when you ran build-speech-app. The executable must be able to take in a string from standard
input and generate a response to standard output.
- Make sure your files are publicly accessible. (Permission settings 755 for executables, 644 for documents)
- Test your application by pointing your browser to the file index.xml in your application
Creating a Project on Your Own Server
Creating a project on your own server is also easy, but it involves editing the XML and CGI file. The XML and
CGI file are designed to work with the ``make-speech-app'' tool
Tips for Writing the Server Side Program
Your program shouldn't do anything too too fancy. All you have to do is read in text (the user's phrase) and
create text output (the program's response). A simple example in the Haskell programming language follows:
main :: IO ()
main = getLine >>= putStrLn . interpret
interpret :: String -> String
interpret "hello" = "hi there"
interpret "goodbye" = "see you later"
interpret _ = "sorry, I do not understand"
As long as your server side program responds to the phrases in your grammar, then you are all set! Compile your
program, edit the CGI file and XML file to correctly point to your executable (the 'build-speech-app'
will handle this for you, just make sure that you name your executable the same as the 'application full name' field that you
entered in the build-speech-app script)