[developers] DMRS to MRS conversion
Michael Wayne Goodman
goodmami at uw.edu
Mon Nov 16 21:21:06 CET 2015
Hi Vineet,
I'm CCing developers in case they have anything to add. We also like
to have such technical discussions happen on the list so others can
benefit.
On Sun, Nov 15, 2015 at 5:01 AM Vineet Chaitanya <vc at iiit.ac.in> wrote:
>
> Hello,
>
> We are planning to undertake DMRS to MRS conversion.
> I understand at one time you were interested in DMRS to MRS conversion.
> Would you kindly throw some light on this topic?
Sure. I'll assume you're somewhat familiar with the structures
involved in DMRS (nodes, links) and MRS (Elementary Predications
(EPs), handle constraints (HCONS), etc.).
Nodes in DMRS are similar to EPs in MRS in that for every node there
is an EP. Links in DMRS, however, represent information that exists in
multiple places in the MRS, such as arguments on EPs, LBL values of
EPs and of TOP (LTOP), and HCONS.
The algorithm I use is roughly the following:
0. Initialize a new MRS
0.a. assign "h0" for the TOP handle
0.b. make an EP for every node (and keep a mapping of NODEID to EP)
0.b.1. use the same PRED as the node
0.b.2. if the node has a "carg" attribute, make a CARG argument with
the same value
1. Assign labels to EPs
1.a. for every */EQ link in the DMRS from START to END
1.a.1. if EPs for START or END have a label assigned, assign it for both
1.a.2. otherwise create a new one and assign it for both
1.b. for every EP without a label, assign it a new one
2. Make ARG0s (intrinsic variables) for non-quantifier nodes
2.a. use the "cvarsort" property of SORTINFO as the variable sort
2.b. all other properties of SORTINFO are the variable properties
2.c. if the node is linked by a quantifier node, give the quantifier
node's EP the same ARG0
3. Assign EP arguments and connect TOP
3.a. if a link from 0 to END has POST H or NIL, make a QEQ from TOP to
the label of END
3.b. for other links that aren't undirected /EQ links:
3.c.1. if POST is H:
3.c.1.a. arg value is a new hole (handle) variable
3.c.1.b. QEQ the hole to the label of the end node
3.c.2. if POST is HEQ, arg value is label of end node
3.c.3. otherwise arg value is ARG0 of end node
That's about it. Note that some kinds of MRS cannot be represented
with the current DMRS formalism. For instance, if two non-quantifier
EPs share an ARG0 in MRS (an unconventional but extant configuration
in some grammars), this conversion from the quasi-equivalent DMRS will
give them unique ARG0s. Also, some grammars use ICONS (individual
constraints), but there is no representation of ICONS in DMRS, so they
cannot be converted.
Here is a link to my pyDelphin code where I define a DMRS to MRS conversion:
https://github.com/delph-in/pydelphin/blob/08e000f4bc55c46b607595aee7e1bcc2d5b658c1/delphin/mrs/xmrs.py#L623
It may be useful for you, but note that I didn't write it with
human-readability in mind. Also note that Step 0 above is actually one
of the last steps in my code.
> Regards
> Vineet Chaitanya
More information about the developers
mailing list