PromptTemplate and ApplyTemplate

PromptTemplate

The purpose of a PromptTemplate is to create a pattern that generalises over several similar Prompts. The PromptTemplate has essentially the same form as a Prompt, except that the first line consists of the word PromptTemplate, followed by one or more parameters, each of which should occur in the body of the PromptTemplate, and the last line consists of the word EndPromptTemplate.

A typical example is the following:

PromptTemplate what_animal PHRASE PICTURE HELPFILE HELPTEXT
Lesson         animals
Group          1
Multimedia     PICTURE
Text/english   What is it?
Response       ?( it's | that's | it is | that is ) PHRASE
AudioHelp      help/HELP HELPTEXT
EndPromptTemplate

Here, the name of the template is what_animal, and there are four parameters PHRASE, PICTURE, HELPFILE and HELPTEXT.

ApplyTemplate

An ApplyTemplate line invokes a template. It specifies the name of the template and a value for each parameter, enclosed in quotes. For example, the template immediately above could be invoked as follows:

ApplyTemplate what_animal "a cat" "cat.png" "cat.wav" "that's a cat"

This takes the template what_animal and substitutes a cat for PHRASE, cat.png for `PICTURE, cat.wav for HELPFILE and that's a cat for HELPTEXT. The result is the Prompt:

Prompt
Lesson         animals
Group          1
Multimedia     cat.png
Text/english   What is it?
Response       ?( it's | that's | it is | that is ) a cat
AudioHelp      help/ HELPTEXT
EndPrompt      cat.wav that's a cat