[Reference Manual]
[ALE Code--ZCQ Matrix]
As an alternative to the sub/2 and intro/2 declarations that ALE grammars use to specify their signatures, TRALE can instead read a special signature file, which follows the format discussed in this section.
By default, this alternative is used when TRALE is loaded. You can switch back to sub/2 and intro/2 declarations in the grammar by setting the subintro flag to grammar:
| ?- ale_flag(subintro,_,grammar).To reactivate the use of signature files, reset the subintro flag to file:
| ?- ale_flag(subintro,_,file).The ale_flag/3 command is discussed in more detail in Chapter G.
TRALE signature files are specified using a separate text file with subtyping indicated by indentation as in the following example signature:
type_hierarchy bot a f:bool g:bool b f:plus g:minus c f:minus g:plus bool plus minus .
The example shows a type hierarchy with a most general element bot, which immediately subsumes types a and bool. Type a introduces two features F and G whose values must be of type bool. Type a also subsumes two other types b and c. The F feature value of the former is always plus and its G feature value is always minus. The feature values of type c are the inverse of type b. Finally, bool has two subtypes plus and minus.
As shown in the example, appropriate features are written after the types that introduce them. The type of the value of a feature is separated from the feature by a colon as in f:bool, which says the feature F takes a value of type bool. Note that subtypes are written at a consistent level of increased indentation. This means that if a type is introduced at column , then all its subtypes must be introduced directly below it at column . The only requirements on the choice of are that it be greater than zero, and that one value is consistently used throughout a signature file. is recommended. Inconsistent indentation causes an error.
A grammar can only use one signature file, and there can only be one type hierarchy in a signature file. If more than one type hierarchy is declared in the same signature file, only the first one is used by TRALE . By default, the signature file is assumed to be named signature, and is assumed to live in the directory from which Prolog was started. The signature/1 directive in a grammar file tells TRALE to look for the signature file in the path given as its argument instead. The syntax of this pathname is operating-system specific.
Types are syntactically Prolog atoms, which means that they have to start with a lower-case letter and only consist of letters and numbers (e.g. bot, bool, dtr1). New types are introduced in separate lines. Each informative line must contain at least a type name. A type may never occur more than once as the subtype of the same supertype. It can, however, occur as a subtype of two or more different supertypes -- this is called multiple inheritance. In this case, one prefixes the subtype with an ampersand (&) to indicate that the multiple inheritance is intended.
There may be zero or more features introduced for each type. As mentioned before, these have the form feature:value-restriction. All feature-value pairs are separated by white space and they should appear in the same line. Recall that, feature is the name of a feature and value is the value restriction for that feature. As with the types, a feature name must always start with a lower case letter. If a feature is specified for a type, all its subtypes inherit this feature automatically. As in ALE , in cases of multiple inheritance, the value restriction on any feature that has been inherited from the supertypes is the union of those value restrictions. A single period (.) in an otherwise blank line signals the end of a signature declaration.
TRALE signature specifications also allow for a_/1 atoms as potential value restrictions, as described in Section 4.8.
As another example, let us see how the type hierarchy in Figure 4.1 translates into a TRALE signature. As the figure shows, the type agr, which is immediately subsumed by , introduces three features person, number and gender. These features are of types per, num and gen respectively. The TRALE translation of this hierarchy is shown below. Note that 1st, 2nd and 3rd are respectively shown as first, second, and third because a Prolog atom has to begin with a lower-case letter.
type_hierarchy bot per first second third num singular plural gen feminine masculine agr person:per number:num gender:gen .
In this hierarchy, there are no t objects with
identically typed or structure-shared F and G
values as in the following feature structures:
Unlike ALE , TRALE does not recognise the existence
of feature structures with such combinations of feature
values. However, if TRALE detects that only one subtype's product of
values is consistent with a feature structure's product of values, it
will promote the product to that consistent subtype's product.
Thus, in our example, a feature structure:
will be promoted automatically to the following. Note
that the type itself will not be promoted to t.
To consider a simple example from HPSG, English verbs are
typically assumed to have the following two features in order to
distinguish auxiliary verbs from main verbs and also to show
whether a subject-auxiliary inversion has taken place.
The values for the AUX and INV
features are taken to be of type bool. However, note that
there cannot be any verbal type with the following combination of
feature values:
That is, there are no verbs in English that can occur before the subject and not be auxiliaries. Thus, using TRALE's interpretation of sub-typing, we can prevent this undesirable combination with the following type hierarchy:
type_hierarchy bot bool plus minus verb aux:bool inv:bool aux_verb aux:plus inv:bool main_verb aux:minus inv:minus .