[developers] Valid MRS? Bug in ERG?

Alexandre Rademaker arademaker at gmail.com
Fri Sep 25 01:07:21 CEST 2020


Hi Michael and Stephan,

A good place to learn about the Lisp format is 
http://www.gigamonkeys.com/book/a-few-format-recipes.html

Basically, the control-string:

"{~@[~(~a~):~]~
   ~:[~3*~; (~@[cyclic~*~]~@[ ~*~]~@[fragmented~*~])~]~@[~%~]”

The ~( means lower case. So ~{~a~) will output the value of the expression `(eds-top object)` in lower-case. But the ~@[ means conditional format, if `(eds-top object)` value is nil, it will not break nor consume the other arguments in its place. The remain of the control-string is quite complicate to read but one can follow the complete documentation in CLHS. For instance, the `~3*` means http://www.lispworks.com/documentation/lw50/CLHS/Body/22_cga.htm! ;-)

It looks like the serialisation/encode of EDS in pydelphin is also robust to empty top:

https://github.com/delph-in/pydelphin/blob/develop/delphin/codecs/eds.py#L257

But the decode/parse is not, see tests below. Actually, encode should not emit a colon in the first line and, of course, there is this discussion about the line-oriented format that would require a broad review of the encode/decode of EDS.

I have submitted a PR to Michael solving the translation from MRS to EDS, but I didn’t touch in the decode/encode functions. 

I found the Lisp code in the lkb/src/mrs/dependencies.lisp file, so it is part of the LKB source code. I am curious, what `psoa` stands for?


>>> edsnative.encode(edsnative.decode(a))
'{e2: e2:unknown<0:83>{e SF prop-or-ques}[ARG x4] _1:_a_q<0:1>[BV x4] x4:_river_n_of<2:7>{x PERS 3, NUM sg, IND +, PT pt}[] e10:_in_p_loc<8:10>{e SF prop, TENSE untensed, MOOD indicative, PROG -, PERF -}[ARG1 x4, ARG2 x11] _2:proper_q<11:30>[BV x11] e16:_northeastern_a_1<11:23>{e SF prop, TENSE untensed, MOOD indicative, PROG bool, PERF -}[ARG1 x11] x11:named<24:30>("Brazil"){x PERS 3, NUM sg, IND +}[] e18:_flow_v_1<36:41>{e SF prop, TENSE pres, MOOD indicative, PROG -, PERF -}[ARG1 x4] e19:_general_a_1<42:51>{e SF prop, TENSE untensed, MOOD indicative, PROG -, PERF -}[ARG1 e18] e20:loc_nonsp<52:61>{e SF prop, TENSE untensed, MOOD indicative, PROG -, PERF -}[ARG1 e18, ARG2 x21] x21:place_n<52:61>{x PERS 3, NUM sg}[] _3:def_implicit_q<52:61>[BV x21] e26:_northward_a_1<52:61>{e SF prop, TENSE untensed, MOOD indicative, PROG -, PERF -}[ARG1 x21] e27:_to_p_state<62:64>{e SF prop, TENSE untensed, MOOD indicative, PROG -, PERF -}[ARG1 e18, ARG2 x28] _4:_the_q<65:68>[BV x28] e33:compound<69:83>{e SF prop, TENSE untensed, MOOD indicative, PROG -, PERF -}[ARG1 x28, ARG2 x34] _5:proper_q<69:77>[BV x34] x34:named<69:77>("Atlantic"){x PERS 3, NUM sg, IND +, PT pt}[] x28:named<78:83>("Ocean"){x PERS 3, NUM sg, IND +, PT pt}[]}’
>>> x = edsnative.decode(a)
>>> x.top
'e2'
>>> x.top = None
>>> edsnative.encode(x)
'{: e2:unknown<0:83>{e SF prop-or-ques}[ARG x4] _1:_a_q<0:1>[BV x4] x4:_river_n_of<2:7>{x PERS 3, NUM sg, IND +, PT pt}[] e10:_in_p_loc<8:10>{e SF prop, TENSE untensed, MOOD indicative, PROG -, PERF -}[ARG1 x4, ARG2 x11] _2:proper_q<11:30>[BV x11] e16:_northeastern_a_1<11:23>{e SF prop, TENSE untensed, MOOD indicative, PROG bool, PERF -}[ARG1 x11] x11:named<24:30>("Brazil"){x PERS 3, NUM sg, IND +}[] e18:_flow_v_1<36:41>{e SF prop, TENSE pres, MOOD indicative, PROG -, PERF -}[ARG1 x4] e19:_general_a_1<42:51>{e SF prop, TENSE untensed, MOOD indicative, PROG -, PERF -}[ARG1 e18] e20:loc_nonsp<52:61>{e SF prop, TENSE untensed, MOOD indicative, PROG -, PERF -}[ARG1 e18, ARG2 x21] x21:place_n<52:61>{x PERS 3, NUM sg}[] _3:def_implicit_q<52:61>[BV x21] e26:_northward_a_1<52:61>{e SF prop, TENSE untensed, MOOD indicative, PROG -, PERF -}[ARG1 x21] e27:_to_p_state<62:64>{e SF prop, TENSE untensed, MOOD indicative, PROG -, PERF -}[ARG1 e18, ARG2 x28] _4:_the_q<65:68>[BV x28] e33:compound<69:83>{e SF prop, TENSE untensed, MOOD indicative, PROG -, PERF -}[ARG1 x28, ARG2 x34] _5:proper_q<69:77>[BV x34] x34:named<69:77>("Atlantic"){x PERS 3, NUM sg, IND +, PT pt}[] x28:named<78:83>("Ocean"){x PERS 3, NUM sg, IND +, PT pt}[]}’
>>> edsnative.decode(x)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/ar/venv/lib/python3.8/site-packages/delphin/codecs/eds.py", line 110, in decode
    lexer = _EDSLexer.lex(s.splitlines())
AttributeError: 'EDS' object has no attribute 'splitlines'


Best,
Alexandre




More information about the developers mailing list