Transfer rules for semantically empty words


#1

Do we have instructions or an example of how to add transfer rules for semantically empty words? For example, I have adverb subordinators for which the pred value is added via a non-branching rule, not in the lexical entry itself. In this case we would want a transfer rule that adds the pred value.


#2

There is one case (that I can find) in the customization code that I am trying to use as an example. It’s in lexical_items.py and creates a generator_rule for question particles. I think I want a transfer rule, but I’m not really sure what the difference is. So something like this? But that’s not quite right.

        trigger.add(TDLencode(orth) +'_fr := filler_rule & \
               [ CONTEXT [ SYNSEM.LKEYS.KEYREL.PRED "' + pred + '" ], \
                 FLAGS.TRIGGER "' + TDLencode(orth) + '" ].')

#3

No, you want a trigger rule. These tell the generator when to supply the semantically empty lexical entries. They are irrelevant to transfer (the process that takes a source-language MRS and gives a target-language one). So, trigger.add is what you want to look for.


#4

It’s confusing because trigger rules are written in the MTR format, which stands for “MRS Transfer Rules”. They are used to insert semantically-empty lexical entries when triggered by a semantic context. That is, both transfer rules and trigger rules are MTRs, but transfer rules match and produce MRS structures while trigger rules match MRSs and insert lexical entries (via the FLAGS.TRIGGER feature).

There doesn’t seem to be a wiki that explains this well, but there’s some info here: http://moin.delph-in.net/LkbGeneration


#5

Thanks. Mike, this is exactly the sort of example I was looking for:
na-cop-lex_gr := arg0e_gr &
[ CONTEXT [ RELS <! [ PRED “~.*a”] !> ],
FLAGS.TRIGGER “na-cop-lex” ].

So in my case, I should do something like this:

trigger.add(TDLencode(type) +’_gr := arg0e_gr &
[ CONTEXT [ RELS <! PRED “’ + pred + '” ] !>,
FLAGS.TRIGGER “’ + TDLencode(type) + '” ].’)

Here the type is something like ‘conditional-adv-subordinator-lex’. And the pred value is if_a_rel. What is still unclear to me is what to put in place of arg0e_gr. That’s obviously for an event (because the example was the copula). What would we want for an adverb subordinator?

By the way, lexical_items.py just has a #TODO comment saying that a trigger rule should be added. Should I create a ticket for this?


#6

That looks correct!

arg0e_gr should be defined in another file (probably a .tdl file) so you can look there to see if it’s appropriate or if one of its neighbors is better.

And of course you can test this by customizing a grammar, parsing a sentence with one of these, and then trying to generate from its MRS.

Does that #TODO refer to any specific lexical item that needs a trigger rule?


#7

Sorry- yes that #TODO was under copulas.


#8

Ah, in that case a ticket might be good :slight_smile:


#9

I generate this trigger rule in trigger.mtr:
prehead-subord-adv-s-clause-init-adv-subord-lex-item_gr := arg0e_gr &
[ CONTEXT.RELS <! [ PRED “_subord-adv-s_rel” ] !>,
FLAGS.TRIGGER “prehead-subord-adv-s-clause-init-adv-subord-lex-item” ].
And when I load the grammar I get the error: prehead-subord-adv-s-clause-init-adv-subord-lex-item is incoherent.
Any ideas what’s wrong?


#10

Is that the identifier from lexicon.tdl, or a lexical type? It should be the former.


#11

It looks like the incomprehensible error was coming from the rule type. I found the generator_rule types in mtr.tdl and it should be arg0e_gtr. (I was missing the t). So now the grammar compiles, but this isn’t a trigger rule, it’s a generator rule. Again, I’m still not clear on the distinction, but using this (or any subtype of generator_rule defined in mtr.tdl) does not satisfy the need for a “trigger rule”. In other words the LKB still says that these words are semantically empty and need a trigger rule.

So do I need to define a trigger rule in mtr.tld? How would this differ from generator_rule?

Emily, do you mean that it should be the identifier in lexicon.tdl that inherits from the lexical type? I was using the lexical type. With the change you suggest, the issue I describe here still applies (it’s still not recognized as a trigger rule).


#12

The value of TRIGGER should match the lexical entry identifier (from lexicon.tdl), not the lexical type. Once you have that, I think the warning will go away.


#14

Oh the value of trigger rather than the name of the rule. My bad! Yes, that works. Thanks, Emily!