next up previous
Next: Signs Up: Formalism Previous: Top category.

Feature constraints.

Almost all work in computational grammar writing uses `feature-structures' of some sort. It is fairly standard to compile (descriptions of) such features-structures into first-order terms (see Pulman [37] for a recent overview). We use the HDRUG development platform [45], which contains a library for compiling feature constraints into Prolog terms, and various predicates to visualise such Prolog terms as feature structures in matrix notation.

The most important operators provided by the HDRUG library are the type assignment operator ('=>'), the path equality operator ('<=>'), and the path operator (':'). A typical grammar fragment employing those operators is:

\begin{displaymath}\small\begin{minipage}[t]{.9\textwidth}\begin{verbatim}rule...
...eement(Vp,Np) :- Vp:agr <=> Np:agr.\end{verbatim}\end{minipage}\end{displaymath} (3)

In this rule, the constraint Np:lex => - indicates that the value of the lex attribute of Np is of type -. The constraint Vp:agr <=> Np:agr indicates that the value of the agr attribute of Vp is identical to the value of the agr attribute of Np. Internally, such a rule could be represented as follows (the actual result of the compilation depends on what attributes are allowed for what types; declarations of this sort are part of the grammar):
\begin{displaymath}\small\begin{minipage}[t]{.9\textwidth}\begin{verbatim}rule(1,s,[np(Agr,-),v(Agr,-,finite,_,_)]).\end{verbatim}\end{minipage}\end{displaymath} (4)

We often will write such rules in matrix notation, as follows:


\begin{displaymath}\small\begin{minipage}[t]{.9\textwidth}\begin{avm}
\mbox{\tt ...
...orm&finite
\end{displaymath}$\rangle$).
\end{avm}\end{minipage}\end{displaymath} (5)

The feature library also supports boolean combinations of atomic values; these are compiled into Prolog terms using a technique described in Mellish [27] (who attributes it to Colmerauer) and Pulman [37]. Thus, we may specify agr values such as sg $\wedge$ (sec $\vee$ thi), denoting an agreement value which is singular and either second or third person.

We have also found it useful to provide the predicates unify_ifdef/3, ifdef/4, and unify_except/3. The predicate unify_ifdef(C1,C2,Att) can be used to require that if both C1 and C2 can have the attribute Att (i.e. C1, C2 are of a type for which Att is a possible feature), then the values C1:Att and C2:Att must be identical. The predicate ifdef(Att,Cat,Val,Otherwise) is used to require that Cat:Att is identical to Val if Att is an appropriate feature for Cat. Otherwise Val is identical to Otherwise. The predicate unify_except(C1,C2,Path) unifies C1 and C2, with the exception of the value of Path, which must be defined for both C1 and C2, but which may have incompatible values. These predicates simplify the definition of the grammar code below.


next up previous
Next: Signs Up: Formalism Previous: Top category.

2000-07-10