MakeNode

Function MakeNode constructs all the representational support for a node. In our constraint model we introduced a lot of functions that map a node to a constrained variable. Here, we will simply represent a node as record with a feature for each function introduced in the constraint model (and also some additional features for convenience).

The function is invoked as

{MakeNode Word I AllIndices Entries RootSet}

where Word is an atom representing the full form of the word, I is its position in the input, Positions is the set of all word positions in the input (1 to n), Entries is the list of lexicon entries for the word, and RootSet is a variable denoting the singleton set containing the root (position) of the sentence.

<Parser MakeNode>=
fun {MakeNode Word I Positions Entries RootSet}
   
<Parser MakeNode, attributes of selected lexicon entry> 
   
<Parser MakeNode, attributes of word> 
in 
   node(
      isroot     : IS_ROOT
      word       : Word
      index      : I
      entryindex : EntryIndex
      cat        : CAT
      agr        : AGR
      comps      : COMPS
      vpref      : E_VPREF
      marks      : E_MARKS
      aux        : E_AUX
      yieldS     : YIELDS
      yield      : YIELD
      dtrsets    : DTRSETS
      daughters  : DAUGHTERS
      mother     : MOTHER
      haszu      : HAS_ZU
      role       : _
      )
end

We initialize EntryIndex to range over the possible positions in the list of Entries, and then we use the selection constraint repeatedly to obtain the various attributes of the selected lexicon entry.

<Parser MakeNode, attributes of selected lexicon entry>=
EntryIndex EntryIndex::1#{Length Entries}
 
E_CATS     = {Select.fs {Map Entries GetCats   } EntryIndex}
E_AGRS     = {Select.fs {Map Entries GetAgrs   } EntryIndex}
E_COMPS_LO = {Select.fs {Map Entries GetCompsLo} EntryIndex}
E_COMPS_HI = {Select.fs {Map Entries GetCompsHi} EntryIndex}
E_VPREF    = {Select.fs {Map Entries GetVpref  } EntryIndex}
E_MARKS    = {Select.fs {Map Entries GetMarks  } EntryIndex}
E_AUX      = {Select.fs {Map Entries GetAux    } EntryIndex}

We define category, agreement, and complement roles just as explained in the constraint model:

<Parser MakeNode, attributes of word>= >>
CAT CAT::Category.range  {FS.include CAT E_CATS}
AGR AGR::Agreement.range {FS.include AGR E_AGRS}
COMPS {FS.subset COMPS Roles.full}
      {FS.subset COMPS E_COMPS_HI}
      {FS.subset E_COMPS_LO COMPS}

For the daughter sets, we create a subrecord. Daughter set for role R on node W will be accessible as W.dtrsets.R. Furthermore, if R is a complement role, the cardinality of W.dtrsets.R must be 0 or 1, and it is 1 iff R is in the set of complement roles stipulated by the valency:

<Parser MakeNode, attributes of word>= << >>
DTRSETS = {List.toRecord o
           {Map AllRoles
            fun {$ R} R#{FS.subset $ Positions} end}}
 
for R in ComplementRoles do 
   {FS.reified.include Roles.toint.R COMPS}={FS.card DTRSETS.R}
end

The set of immediate daughters can be computed as the union of the daughter sets. The yield can also be defined here, but the strict yield can only be initialized; it will be properly constrained in ParsePredicate after representations for all nodes have been constructed.

<Parser MakeNode, attributes of word>= << >>
DAUGHTERS = {FS.unionN DTRSETS}
YIELDS    = {FS.subset $ Positions}
YIELD     = {FS.partition [{FS.value.singl I} YIELDS]}

The mother set has cardinality at most 1, and the node is root precisely when the cardinality of the mother set is 0.

<Parser MakeNode, attributes of word>= << >>
MOTHER = {FS.subset $ Positions} {FS.cardRange 0 1 MOTHER}
IS_ROOT=({FS.card MOTHER}=:0)
{FS.reified.include I RootSet}=IS_ROOT

Attribute W.haszu is true iff the word has a zu particle attached or as a complement (this is an exclusive or). Furthermore, if this attribute is true, the word must be an infinitive verb.

<Parser MakeNode, attributes of word>= <<
HAS_ZU HAS_ZU::0#1
{FD.exor
 {FS.reified.include MARK_ZU E_MARKS}
 {FS.card DTRSETS.zu}
 HAS_ZU}
{FD.impl HAS_ZU CAT=:CAT_VINF 1}


Denys Duchier
Version 1.2.0 (20010221)