A computational grammar and lexicon for Maltese
A computational grammar and lexicon for Maltese
A computational grammar and lexicon for Maltese
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
potentially be h<strong>and</strong>led with dependent types on the abstract syntax level. However, since the<br />
RGL abstract syntax is language-independent this would be not be possible without losing<br />
some of this independence.<br />
Incomplete inflection tables<br />
It is often the case that certain slots in inflection tables simply do not exist in the language.<br />
A prime example in <strong>Maltese</strong> is the dual <strong>for</strong>m, which only a small number of nouns actually<br />
have. When it exists, this <strong>for</strong>m is used to replace both noun <strong>and</strong> determiner, e.g. xagħarejn<br />
(‘two months’). For nouns with no dual <strong>for</strong>m, one uses the numeral <strong>for</strong> ‘two’ together with<br />
the plural <strong>for</strong>m of the noun, e.g. żewġ fliexken (‘two bottles’). All objects of the same type must<br />
have the same linearisation type in GF. So if the linearisation type <strong>for</strong> a noun contains a slot <strong>for</strong><br />
the dual <strong>for</strong>m, what should this slot contain in the case of nouns with no dual?<br />
The empty string "" would seem to be the logical choice, however this can create parsing<br />
ambiguities if it is ever included in a linearisation. To prevent against this, syntax-level<br />
functions need to be able to check whether a noun indeed supports the dual <strong>for</strong>m or not. But<br />
because of the limitations on runtime strings (described above), it is impossible to check, at<br />
runtime, whether a string is the empty string or not. Attempting to use some garbage string<br />
instead of the empty string does not help the situation at all, <strong>and</strong> adds the risk of appearing<br />
in input completion. The solution to this is to store this in<strong>for</strong>mation in some non-string field,<br />
such as a boolean hasDual field, which can be consulted at runtime.<br />
The Maybe type As this turned out to be a fairly common occurrence in the <strong>Maltese</strong> resource<br />
<strong>grammar</strong>, a special Maybe type was defined as a generalisation of this programmatic idiom. This<br />
type is defined as a type which takes another type as a parameter, as follows:<br />
oper<br />
Maybe : (t : Type) -> Type = \t -> {<br />
inner : t ;<br />
exists : Bool<br />
} ;<br />
Thus the type Maybe Str becomes a record containing a string <strong>and</strong> boolean field indicating<br />
whether the <strong>for</strong>mer exists or not. This type <strong>and</strong> its supporting operations can be found in the<br />
Maybe.gf module in the RGL’s prelude folder. An un<strong>for</strong>tunate downside to using the Maybe type<br />
is that it causes a size explosion in the compiler when used in tables. This is explained below.<br />
2.5.5 Parameters in tables<br />
During the development of this resource <strong>grammar</strong>, it was discovered that using parameter<br />
fields within tables will cause an exponential explosion in the GF compiler. Consider the following<br />
example <strong>grammar</strong>:<br />
concrete ParamConc of Param = open Prelude in {<br />
45