26.12.2013 Views

A computational grammar and lexicon for Maltese

A computational grammar and lexicon for Maltese

A computational grammar and lexicon for Maltese

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Foods> linearize Pred (These Cheese) (Very Expensive)<br />

these cheeses are very expensive<br />

dawn il- ġobniet huma għaljin ħafna<br />

Finally we can per<strong>for</strong>m a translation from <strong>Maltese</strong> to English by piping the output of a parse<br />

into a linearise comm<strong>and</strong>:<br />

Foods> parse -lang=Mlt "din il- ġobna hija tajba ħafna" | linearize -lang=Eng<br />

this cheese is very delicious<br />

1.3.3 Resource Grammar Library<br />

The example <strong>grammar</strong> in the previous section is small, but as <strong>grammar</strong>s grow in size having<br />

a module system becomes vital. Both abstract <strong>and</strong> concrete syntaxes can be split into separate<br />

modules, which promotes not only manageability but more importantly code re-use. Because<br />

the morphological <strong>and</strong> syntactic details of natural languages can be quite complex, it doesn’t<br />

make sense <strong>for</strong> every new <strong>grammar</strong> written in GF to have to re-implement these features. Instead,<br />

the low-level details of a language can be put into a resource <strong>grammar</strong> whose abstract<br />

syntax models phenomena on the syntactic level. A separate application <strong>grammar</strong> can then<br />

be written which focuses on the high-level modelling tasks, using functions defined in the resource<br />

<strong>grammar</strong> as needed. This additional level of abstraction in <strong>grammar</strong> design means that<br />

code <strong>for</strong> semantic modelling does not need to be mixed with code that h<strong>and</strong>les syntax <strong>and</strong><br />

morphology.<br />

Apart from the compiler <strong>and</strong> runtime system, the GF distribution also includes a st<strong>and</strong>ard<br />

library known as the Resource Grammar Library (RGL) (Ranta, 2009). The RGL provides<br />

general linguistic descriptions <strong>for</strong> natural languages which can be reused by using a common<br />

language independent API. This library covers the morphology <strong>and</strong> basic syntax of some 28<br />

languages from around the world (where <strong>Maltese</strong> is the 28 th language to be added). This<br />

means programmers who wish to use GF to write some application <strong>grammar</strong> do not need to<br />

worry about the tedious low-level details like word order <strong>and</strong> agreement in each language;<br />

they simply use the st<strong>and</strong>ard functions provided by the API <strong>and</strong> the linearisation into each<br />

language is h<strong>and</strong>led automatically by GF.<br />

Using the RGL in an application <strong>grammar</strong><br />

Continuing with the Foods example, we now show an example of the English concrete syntax<br />

which uses the Resource Grammar Library. We name this module FoodsEngRGL. Note how this<br />

module opens SyntaxEng <strong>and</strong> ParadigmsEng, which together make up the API to the library.<br />

In comparison to the previous version of FoodsEng above, FoodsEngRGL does not encode any<br />

linguistic in<strong>for</strong>mation itself. No parameters are defined <strong>and</strong> no agreement h<strong>and</strong>ling takes place;<br />

Instead, the categories are given linearisation types directly from the RGL; <strong>for</strong> example, Kind is<br />

given the type of a common noun CN. The function linearisations also look simpler — instead<br />

14

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!