<div dir="ltr"><div><div><div>Hi everyone,<br><br></div>I found this bug while using pyDelphin to process MRS output from JACY. Can someone shed some light on this for me?</div><div><br></div><div>The original sentence was "猫を見ていた。"<br></div><div><br></div><span style="font-family:monospace,monospace">Source code<br>---------------------------------------<br>import io<br>from delphin.mrs import simplemrs<br>from delphin.mrs import dmrx<br><br>m = '''[ TOP: h0<br> INDEX: e2 [ e TENSE: past MOOD: indicative PROG: - PERF: - ASPECT: default_aspect PASS: - SF: prop ]<br> RELS: < [ udef_q_rel<0:1> LBL: h4 ARG0: x5 [ x PERS: 3 ] RSTR: h6 BODY: h7 ]<br> [ "_neko_n_rel"<0:1> LBL: h8 ARG0: x5 ]<br> [ "_miru_v_1_rel"<4:5> LBL: h9 ARG0: e10 [ e TENSE: tense MOOD: indicative PROG: - PERF: - ASPECT: default_aspect PASS: - SF: prop ] ARG1: i11 ARG2: x5 ]<br> [ "_te_adjunct_rel"<-1:-1> LBL: h1 ARG0: e12 [ e TENSE: tense MOOD: indicative PROG: - PERF: - ASPECT: default_aspect PASS: - SF: prop ] L-HNDL: h13 R-HNDL: h14 ]<br> [ "_iru_v_be_rel"<8:9> LBL: h15 ARG0: e2 ARG1: i3 ] ><br> HCONS: < h0 qeq h1 h6 qeq h8 h13 qeq h9 h14 qeq h15 > ]'''<br><br># MRS string to pyDelphin<br>obj = simplemrs.loads_one(m)<br>print(obj)<br><br># pyDelphin to XML<br>x = dmrx.etree_tostring(dmrx._encode_dmrs(obj)).decode('utf-8')<br>print(x)<br><br># XML back to pyDelphin<br>dmrses = list(dmrx.deserialize(io.StringIO(x)))<br>print(dmrses)<br><br><br>Error messages<br>---------------------------------------<br>Traceback (most recent call last):<br> File "<stdin>", line 1, in <module><br> File "/home/tuananh/tmp/jacy.py", line 23, in <module><br> dmrses = list(dmrx.deserialize(io.StringIO(x)))<br> File "/home/tuananh/ep3/lib/python3.6/site-packages/delphin/mrs/dmrx.py", line 74, in deserialize<br> yield _deserialize_dmrs(elem)<br> File "/home/tuananh/ep3/lib/python3.6/site-packages/delphin/mrs/dmrx.py", line 85, in _deserialize_dmrs<br> return Dmrs(nodes=list(map(_decode_node, elem.iter('node'))),<br> File "/home/tuananh/ep3/lib/python3.6/site-packages/delphin/mrs/dmrx.py", line 101, in _decode_node<br> return Node(pred=_decode_pred(elem.find('*[1]')),<br> File "/home/tuananh/ep3/lib/python3.6/site-packages/delphin/mrs/dmrx.py", line 122, in _decode_pred<br> elem.get('sense'))<br> File "/home/tuananh/ep3/lib/python3.6/site-packages/delphin/mrs/components.py", line 453, in realpred<br> predstr = '_'.join([''] + string_tokens + ['rel'])<br>TypeError: sequence item 2: expected str instance, NoneType found</span><br><span style="font-family:monospace,monospace"></span></div> <br><span style="font-family:monospace,monospace"></span><div><div><div><div><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><span style="font-size:small">Yours,</span><br style="font-size:small"><span style="font-size:small">-- </span><br style="font-size:small"><div style="font-size:small"><div dir="ltr">Tuan Anh<br></div></div></div></div></div></div>
</div></div></div></div></div></div>