Extracting the second thing on the list

In principle, how do I change this so that it results in the second, not the first complement being extracted:

extracted-comp-phrase := basic-extracted-arg-phrase &
                               head-compositional &
  [ SYNSEM canonical-synsem &
       [ LOCAL.CAT [ VAL [ SUBJ #subj,
                           SPR #spr,
                           COMPS #comps ],
                     MC #mc ] ],
    HEAD-DTR [ SYNSEM
               [ LOCAL.CAT [ VAL [ SUBJ #subj,
                                   SPR #spr,
                                   COMPS < gap & [ NON-LOCAL.SLASH #slash ] . #comps > ],
                             MC #mc ],
                 NON-LOCAL.SLASH #slash ] ],
    C-CONT [ RELS <! !>,
             HCONS <! !>,
             ICONS <! !> ] ].

Assume that it should apply to verbs like this:

ditran-nom-acc-dat-verb-lex := ditran-verb-lex & 
  [ ARG-ST < [ LOCAL.CAT.HEAD noun &
                              [ CASE nom ] ],
             [ LOCAL.CAT.HEAD noun &
                              [ CASE acc+part ] ],
             [ LOCAL.CAT.HEAD noun &
                              [ CASE dat ] ] > ].

…I am trying:

extracted-2nd-comp-phrase := basic-extracted-arg-phrase &
                               head-compositional &
  [ SYNSEM canonical-synsem &
       [ LOCAL.CAT [ VAL [ SUBJ #subj,
                           SPR #spr,
                           COMPS < #comps1, #comps2 > ],
                     MC #mc ] ],
    HEAD-DTR [ SYNSEM
               [ LOCAL.CAT [ VAL [ SUBJ #subj,
                                   SPR #spr,
                                   COMPS < #comps1 & [], gap & [ NON-LOCAL.SLASH #slash ] . #comps2 > ],
                             MC #mc ],
                 NON-LOCAL.SLASH #slash ] ],
    C-CONT [ RELS <! !>,
             HCONS <! !>,
             ICONS <! !> ] ].
.

But this does not quite work: the SLASH list of the resulting structure is empty and the second complement is null instead of being gap.

…and if I do this:

extracted-2nd-comp-phrase := basic-extracted-arg-phrase &
                               head-compositional &
  [ SYNSEM canonical-synsem &
       [ LOCAL.CAT [ VAL [ SUBJ #subj,
                           SPR #spr,
                           COMPS < #comp1, #comp2 > ],
                     MC #mc ] ],
    HEAD-DTR [ SYNSEM
               [ LOCAL.CAT [ VAL [ SUBJ #subj,
                                   SPR #spr,
                                   COMPS < #comp1 & [], #comp2 & gap & [ NON-LOCAL.SLASH #slash ] > ],
                             MC #mc ],
                 NON-LOCAL.SLASH #slash ] ],
    C-CONT [ RELS <! !>,
             HCONS <! !>,
             ICONS <! !> ] ].
  • I get the parser fail because of too many edges because the extraction rule then can apply to itself… But I don’t understand what the concatenation (?) in the original rule is doing, to start with…

Note that the original type has COMPS #comps – this is a list.

In your new type, you have COMPS < #comps1, #comps2 > – these are elements of the list.

Note also that the original type has, for HEAD-DTR...COMPS, something of the form < x . y > – the . is a special syntax, so that x is the first element on the list and y is the rest of the list, i.e. it’s shorthand for cons & [ FIRST x, REST y]. (I think this syntax comes from Lisp, but you’d have to check with a Lisp programmer.)

So by writing COMPS < #comps1, #comps2 >, you are putting the rest of the list (#comps2) as the second element of the new list (i.e. REST.FIRST). You need to change it to: COMPS < #comps1 . #comps2 >, so that rest of the old list (after the second element) is the rest of the new list (after the first element).

1 Like