Tutorial 12

The digit recognizer.

Instructions
Drag and arrange states onto the canvas so that you have the following setup.


The digit object is similar to the generic object. It has a special grammar and recognizer which are tailored to recognize digits. It also has only one output port, so any branching on the recognition results must be done with a conditional object.

Enter the following prompts in each state:

get_number What is your telephone number?
error_mesg Please include your area code.
readback_number Ok, I'll call $get_number(recog) if I need you.

The digit recognizer will recognize a string of digits. We want the user to include their zip code, so we won't accept any results that are shorter than nine numbers. In order to do this, a conditional statement is necessary.


In the right port of "check_area_code", place a "1".
In the left port, place the following text:   "[llength $state4(recog)] > 9".

This bit of Tcl code ensures that the recognized text has the proper length.

If you find that the recognizer cuts off the end of your utterance, you'll need to adjust the "Trailing Edge Silence" setting in the "Preferences" dialogue. See the "Preferences" documentation for more details.