Compiling Grammar-based Speech Application ... - CiteSeerX
Compiling Grammar-based Speech Application ... - CiteSeerX
Compiling Grammar-based Speech Application ... - CiteSeerX
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
8 Introduction<br />
abstract Pizza = {<br />
cat Input; Order; Number; Size; Topping; [Topping] {1};<br />
fun order : Order → Input;<br />
pizza : Number → Size → [Topping] → Order;<br />
one, two : Number;<br />
small, large : Size;<br />
cheese, ham : Topping;<br />
cat Output;<br />
fun price : Order → Int → Output;<br />
}<br />
Figure 5. Pizza.gf: A GF abstract syntax module.<br />
The abstract syntax declares what can be said in the language. The concrete<br />
syntax describes how to say it. This is done by associating a concrete<br />
representation with each construct in the abstract syntax. In the simplest case,<br />
this concrete representation is a record containing a single string field. Records,<br />
tables and enumerations can be used to implement more complex representations,<br />
for example with gender agreement between nouns and adjectives. The<br />
process of generating a concrete syntax term from a term in the abstract syntax<br />
is called linearization.<br />
One of GF’s strong points is multilinguality. The division of grammar into<br />
abstract and concrete syntax means that it is easy to have multiple concrete syntaxes<br />
for one abstract syntax. This makes it possible to implement multilingual<br />
grammars. In order to avoid re-implementing the domain-independent linguistic<br />
details of a language for each new application grammar, the GF resource grammar<br />
library has been created. It implements the morphological and syntactic<br />
details of a number of languages, and presents a language-independent API to<br />
the application grammar writer. This significantly reduces the effort involved<br />
in translating grammars (Perera and Ranta 2007).<br />
3.1 An Example<br />
As an example of a GF grammar for an interactive speech application, Figure 5<br />
and Figure 6 show the abstract and English concrete syntax for a small pizza<br />
ordering dialogue system. The Input category contains user input, such as “two<br />
large pizzas with ham and cheese”, which corresponds to the abstract syntax<br />
term order (pizza two large [ham, cheese ]). The Output category describes<br />
system output, for example “two large pizzas with ham and cheese cost 7 euros”,<br />
for the abstract syntax term price (pizza two large [ham, cheese ]) 7.<br />
This concrete syntax module uses the new Resource <strong>Grammar</strong> API with<br />
overloading (Ranta 2006). Each function mkX constructs terms in the resource<br />
grammar category X. For example, the linearization category of the<br />
Order category is the resource grammar category NP. This means that an order