delph-in / pydelphin

Python libraries for DELPH-IN
https://pydelphin.readthedocs.io/
MIT License
79 stars 27 forks source link

EDS fails to convert MRS without properly linked TOP #316

Closed goodmami closed 3 years ago

goodmami commented 4 years ago

Originally from https://github.com/delph-in/delphin.edm/issues/1

Given an MRS with TOP qeq to the handle of nothing, with no qeq at all, or with no TOP at all, EDS will fail to convert the MRS with a KeyError. DMRS is able to convert them with a warning about the unusable TOP value (although this warning is absent when TOP is missing entirely; maybe not a bug?).

A relevant difference between DMRS and EDS here is that EDS requires the graph's top to be specified, while DMRS does not (at least not in the DTD), so maybe we do want an error when EDS fails to select a top, but perhaps a more informative error would be better. However, IIRC, the LKB's code will back off to using the INDEX as the TOP in an attempt to give a plausible EDS for every MRS. I don't know what happens if there is no INDEX, either.

Here are some short examples (approximating the MRS for "It rained.") that reproduce the problem:

[ TOP: h0 INDEX: e3 [ e TENSE: past ]
  RELS: < [ _rain_v_1 LBL: h2 ARG0: e3 ] >
  HCONS: < h0 qeq h1 > ]
[ TOP: h0 INDEX: e3 [ e TENSE: past ]
  RELS: < [ _rain_v_1 LBL: h2 ARG0: e3 ] >
  HCONS: < > ]
[ INDEX: e3 [ e TENSE: past ]
  RELS: < [ _rain_v_1 LBL: h2 ARG0: e3 ] >
  HCONS: < > ]
goodmami commented 4 years ago

From this mailing list thread, the LKB does apparently back off first to INDEX, then if that fails it creates a fake, unlinked top variable. However, Stephan then reconsidered that behavior and suggested the following:

may i suggest you add the fall-back, looking for the INDEX, and otherwise allow EDSs whose top is empty.

That is, if neither TOP nor INDEX can be determined, the codec should allow for no top variable to be present.