STANFORD LSA 352 Homework 1: Summer 2007
Homework 1: Testing Systems (and a bit of ARPAbet practice)
Due: Monday July 9 at 3:45pm, i.e. the start of class.

Please read this entire page before beginning.

(1.1) Call the "TellMe" speech recognizer. The number is 1-800-555-TELL. Try at least two different kinds of questions (stock quotes, travel, etc). Try to "barge in" (i.e. talk while TellMe is talking to you). Write down any errors or misrecognitions that occur.

(1.2) Call the United Airlines automatic flight information, at 1.800.824.6200. Ask about a flight. Again, write down any errors or misrecognitions that occur.

(1.3) Go to one of the TTS demo sites, ATT or IBM. Test out the site by choosing at least seven different sentences (paste them from another web site, or make up things). Try to be creative, including questions, exclamations, or whatever. Try at least two different voices. (You may have to choose "Download wav file" and play it twice, if the speech sound gets cut off as it plays the first time while it downloads.). Write down at least 5 errors that you hear; note whether these errors are in the phones, in the intonation/prosody, or something else.

(1.4) Quick ARPAbet reminder. Here is an ARPAbet listing. Transcribe the following words into the ARPAbet.

You may use an on-line ARPAbet dictionary to help you get up to speed on the ARPAbet. Here is the CMU dictionary.

(1.5) More ARPAbet reminder. Transcribe the following wavefile at the phone level. Turn in the ASCII ARPAbet sequence (just type it into your homework answers).

If it's helpful, you can use Praat (download it here), It runs on most popular platforms.

I assume most of you know Praat, but if not, a quick Praat intro, written by Edward Flemming, is here, and a longer Praat tutorial is here.


Build a bigram grammar of Shakespeare and generate 10 random sentences from the corpus. The corpus is the complete works of Shakespeare, about a million words, at

HINTS: First, you should compute bigram word probabilities from the corpus. You will have to do some cleanup (for example remove comments and things, and put spaces around all the punctuation). You can either write a large single program to do all this, or you can do it quite quickly using various convenient UNIX utilities! For example, one useful thing you will need is to put every word on a separate line, which you can do with this command:

tr ' ' '\012'
And before that, you can use perl or java regular expressions to add a space around each punctuation mark, so they appear on their own line.

Once you have a cleaned-up file with one word on each line, you can make a second copy of the file, delete the first line in emacs, and paste the two files together using the unix command paste:

paste wordlistmissingfirstword wordlist > bigramlist
The resulting file will have one line for each bigram in the corpus. Now you can write a program to count how many times each bigram occurs, how many times each unigram occurs, and divide correctly to get the bigram probability.

Hint 2: to generate random sentences, chose a random probability between 0 and 1, and use that to pick a word with the appropriate probability. For example, you could store each word in your unigram list with its own probability but also with a running total of the probabilities of all earlier words in the list. Then you could just walk down the list until the word probabilities sum to your random number. Once you have a first word of your sentence, you switch to choosing bigrams with a similar method. Alternatively, you can create a special "first and last word", called SENTENCEBOUNDARY or something, and then you can do everything with bigrams instead of fooling around with unigrams. That will also make it easier to know when your sentence has ended.

How to turn in the homework: