Error producing latex dmrs from mrs

I’m trying to produce a tikz-dmrs from an mrs that comes from my result file. I’m running into the following error, but I can’t tell what in the MRS is malformed. Does anyone know what the problem could be (another MRS works just fine).

(run_agg) [kphowell@patas run_aggregation]$ delphin convert --to dmrs-tikz in.mrs
Traceback (most recent call last):
  File "/home2/kphowell/Envs/run_agg/bin/delphin", line 11, in <module>
    sys.exit(main())
  File "/home2/kphowell/Envs/run_agg/lib/python3.6/site-packages/delphin/main.py", line 40, in main
    args.func(args)
  File "/home2/kphowell/Envs/run_agg/lib/python3.6/site-packages/delphin/cli/convert.py", line 62, in call_convert
    semi=args.semi))
  File "/home2/kphowell/Envs/run_agg/lib/python3.6/site-packages/delphin/commands.py", line 146, in convert
    for x in xs:
  File "/home2/kphowell/Envs/run_agg/lib/python3.6/site-packages/delphin/commands.py", line 262, in _iter_convert
    yield converter(x)
  File "/home2/kphowell/Envs/run_agg/lib/python3.6/site-packages/delphin/commands.py", line 198, in converter
    return from_mrs(m, representative_priority=None)
  File "/home2/kphowell/Envs/run_agg/lib/python3.6/site-packages/delphin/dmrs/_operations.py", line 41, in from_mrs
    nodes = _mrs_to_nodes(m, id_to_nid)
  File "/home2/kphowell/Envs/run_agg/lib/python3.6/site-packages/delphin/dmrs/_operations.py", line 72, in _mrs_to_nodes
    properties = m.properties(iv)
  File "/home2/kphowell/Envs/run_agg/lib/python3.6/site-packages/delphin/mrs/_mrs.py", line 275, in properties
    var = self[id].iv
  File "/home2/kphowell/Envs/run_agg/lib/python3.6/site-packages/delphin/sembase.py", line 164, in __getitem__
    return self._pidx[id]
KeyError: None

Here is the mrs in in.mrs

[ TOP: h0
  INDEX: e2 [ e SF: prop-or-ques E.ASPECT: aspect E.MOOD: mood E.TENSE: tense ]
  RELS: < [ “_name_n_rel”<-1:-1> LBL: h4 ARG0: x5 [ x COG-ST: cog-st PNG.GEND: gender PNG.NUM: number PNG.PER: 3rd SPECI: bool ] ]
          [ “exist_q_rel”<-1:-1> LBL: h6 ARG0: x5 RSTR: h7 BODY: h8 ]
          [ “_drown_v_rel”<-1:-1> LBL: h9 ARG0: e10 [ e SF: iforce E.ASPECT: aspect E.MOOD: mood E.TENSE: tense ] ARG1: x5 ARG2: x11 [ x COG-ST: cog-st PNG.GEND: gender PNG.NUM: number PNG.PER: 3rd SPECI: bool ] ]
          [ “_paper_n_rel”<-1:-1> LBL: h12 ARG0: x11 ]
          [ “exist_q_rel”<-1:-1> LBL: h13 ARG0: x11 RSTR: h14 BODY: h15 ]
          [ “_return_v_rel”<-1:-1> LBL: h16 ARG0: e17 [ e SF: iforce E.ASPECT: aspect E.MOOD: mood E.TENSE: tense ] ARG1: x5 ARG2: x18 [ x COG-ST: cog-st PNG.GEND: gender PNG.NUM: number PNG.PER: person SPECI: bool ] ]
          [ “_and_coord_rel”<-1:-1> LBL: h1 C-ARG: e2 L-HNDL: h9 L-INDEX: e10 R-HNDL: h19 R-INDEX: e17 ] >
  HCONS: < h0 qeq h1 h7 qeq h4 h14 qeq h12 >
  ICONS: < e20 [ e SF: iforce E.ASPECT: aspect E.MOOD: mood E.TENSE: tense ] non-focus x18 > ]

(MWG edited formatting only)

At a first glance, I see the ICONS list has e20 non-focus x18, but neither e20 nor x18 appear as ARG0s in the RELS list, although x18 is the (unquantified) ARG2 of _return_v.

There may be other issues, but these already make it a broken MRS. The error message from PyDelphin certainly isn’t very helpful, though.

I looked a little further and the error you’re seeing is from something else (but the first thing is still a problem, just a separate one).

Look at _and_coord: it does not have any ARG0, but instead a C-ARG (whatever that is), which seems to act like its ARG0. Notice that its argument, e2, is also the INDEX of the MRS.

Conversion to DMRS relies on the “intrinsic variable property” (see this message on a different thread, and also PyDelphin’s delphin.mrs.has_intrinsic_variable_property() function). Since MRS’s variable properties become node properties in conversion to DMRS, when an EP becomes a node, the EP’s intrinsic variable (ARG0) is where they come from. PyDelphin could handle this case better, so I’ve created a bug report (https://github.com/delph-in/pydelphin/issues/289). But to be clear, the MRS here does not follow the intrinsic variable property and is arguably broken, so conversion to DMRS is not guaranteed.

1 Like

Thanks, Mike. It’s good to know that it’s a broken MRS… the next thing to figure out is why. I parsed the sentence with ACE directly (rather than getting it from my fftb result) and the MRS still has the C-ARG, instead of an ARG0, so I’m not sure what’s going on there.

This is because the semantic analysis of coordination in the Matrix hasn’t been updated since about 2005!

Ah- okay. Thanks Emily.

Yes, it’s not a problem with how it was parsed but how the Matrix customized the grammar.

You may have noticed the PyDelphin issue is already fixed in the development branch and it will be part of the next release. Now PyDelphin warns that morphosemantic properties and node types will be lost if an EP does not have an ARG0, but it continues to produce the DMRS.

Thanks, Mike! I just tried it using the dev branch. It’s nice to be able to get some kind of output even though the mrs is broken.