Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maximum recursion depth exceeded in MRS -> DMRS/EDS conversion #205

Closed
arademaker opened this issue Mar 8, 2019 · 3 comments
Closed

Maximum recursion depth exceeded in MRS -> DMRS/EDS conversion #205

arademaker opened this issue Mar 8, 2019 · 3 comments
Milestone

Comments

@arademaker
Copy link
Member

>>> response = ace.parse('/Users/ar/hpsg/ace/erg.dat', 'The Ellesmerian sequence overlies the pre-Mississippian rocks on a regional angular unconformity and consists of northerly-derived quartz-rich clastic and carbonate strata deposited on a south-facing continental margin.', cmdargs=['-n', '1'])
NOTE: parsed 1 / 1 sentences, avg 68679k, time 0.48226s
>>> response.result(0).mrs()
<Mrs object (the compound proper named sequence lie over- the named rock on a regional angular unconformity/NN and consist subord northerly subord derive udef compound udef quartz-/NN rich compound udef udef clastic/NN udef and carbonate stratum subord deposit on a compound udef south face continental margin) at 4393290216>
>>> x = response.result(0).mrs()
>>> print(simpledmrs.dumps([x], pretty_print=True))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/simpledmrs.py", line 56, in dumps
    return serialize(ms, properties=properties, indent=kwargs.get('indent'))
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/simpledmrs.py", line 90, in serialize
    return delim.join(_encode_dmrs(m, properties, indent=indent) for m in ms)
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/simpledmrs.py", line 90, in <genexpr>
    return delim.join(_encode_dmrs(m, properties, indent=indent) for m in ms)
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/simpledmrs.py", line 123, in _encode_dmrs
    for l in links(m):
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/components.py", line 313, in links
    lblheads = {v: lsh(v) for v, vd in _vars.items() if 'LBL' in vd['refs']}
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/components.py", line 313, in <dictcomp>
    lblheads = {v: lsh(v) for v, vd in _vars.items() if 'LBL' in vd['refs']}
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/xmrs.py", line 524, in labelset_heads
    scope_sets[nid] = _ivs_in_scope(nid, _eps, _vars, _hcons)
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/xmrs.py", line 1219, in _ivs_in_scope
    ivs.update(_ivs_in_scope(conj_nid, _eps, _vars, _hcons))
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/xmrs.py", line 1219, in _ivs_in_scope
    ivs.update(_ivs_in_scope(conj_nid, _eps, _vars, _hcons))
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/xmrs.py", line 1219, in _ivs_in_scope
    ivs.update(_ivs_in_scope(conj_nid, _eps, _vars, _hcons))
  [Previous line repeated 985 more times]
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/xmrs.py", line 1215, in _ivs_in_scope
    elif var_sort(val) == HANDLESORT:
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/components.py", line 58, in var_sort
    return sort_vid_split(v)[0]
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/components.py", line 41, in sort_vid_split
    match = var_re.match(vs)
RecursionError: maximum recursion depth exceeded while calling a Python object
>>> from delphin.mrs import eds
>>> print(eds.dumps([x], pretty_print=True))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/eds.py", line 478, in dumps
    **kwargs
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/eds.py", line 561, in serialize
    for m in ms
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/eds.py", line 561, in <genexpr>
    for m in ms
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/eds.py", line 568, in _serialize_eds
    e = Eds.from_xmrs(e, predicate_modifiers=predicate_modifiers)
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/eds.py", line 86, in from_xmrs
    deps = _find_basic_dependencies(xmrs, eps)
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/eds.py", line 271, in _find_basic_dependencies
    tgtnid = find_argument_target(m, nid, rargname)
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/query.py", line 246, in find_argument_target
    return next(iter(xmrs.labelset_heads(tgt)), None)
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/xmrs.py", line 524, in labelset_heads
    scope_sets[nid] = _ivs_in_scope(nid, _eps, _vars, _hcons)
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/xmrs.py", line 1219, in _ivs_in_scope
    ivs.update(_ivs_in_scope(conj_nid, _eps, _vars, _hcons))
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/xmrs.py", line 1219, in _ivs_in_scope
    ivs.update(_ivs_in_scope(conj_nid, _eps, _vars, _hcons))
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/xmrs.py", line 1219, in _ivs_in_scope
    ivs.update(_ivs_in_scope(conj_nid, _eps, _vars, _hcons))
  [Previous line repeated 984 more times]
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/xmrs.py", line 1215, in _ivs_in_scope
    elif var_sort(val) == HANDLESORT:
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/components.py", line 58, in var_sort
    return sort_vid_split(v)[0]
  File "/usr/local/lib/python3.7/site-packages/delphin/mrs/components.py", line 41, in sort_vid_split
    match = var_re.match(vs)
RecursionError: maximum recursion depth exceeded while calling a Python object
@goodmami
Copy link
Member

goodmami commented Mar 9, 2019

Isn't this the same as #200?

@goodmami
Copy link
Member

I think this is a duplicate but I will repurpose #200 to be about making conversion robust and this one is about the specific issue. Here is the MRS causing the error:

[ LTOP: h0 INDEX: e2 [ e SF: prop TENSE: pres MOOD: indicative PROG: - PERF: - ] RELS: < [ _the_q<0:3> LBL: h4 ARG0: x3 [ x PERS: 3 NUM: sg IND: + ] RSTR: h5 BODY: h6 ]  [ compound<4:24> LBL: h7 ARG0: e8 [ e SF: prop TENSE: untensed MOOD: indicative PROG: - PERF: - ] ARG1: x3 ARG2: x9 [ x PERS: 3 NUM: sg IND: + PT: notpro ] ]  [ proper_q<4:15> LBL: h10 ARG0: x9 RSTR: h11 BODY: h12 ]  [ named<4:15> LBL: h13 CARG: "Ellesmerian" ARG0: x9 ]  [ _sequence_n_of<16:24> LBL: h7 ARG0: x3 ARG1: i15 ]  [ _lie_v_1<25:33> LBL: h16 ARG0: e17 [ e SF: prop TENSE: pres MOOD: indicative PROG: - PERF: - ] ARG1: x3 ARG2: h18 ]  [ _over-_a_1<25:33> LBL: h16 ARG0: e19 [ e SF: prop TENSE: pres MOOD: indicative PROG: - PERF: - ] ARG1: e17 ]  [ _the_q<34:37> LBL: h20 ARG0: x21 [ x PERS: 3 NUM: sg IND: + ] RSTR: h22 BODY: h23 ]  [ named<38:55> LBL: h24 CARG: "pre-Mississippian" ARG0: x21 ]  [ _rock_v_1<56:61> LBL: h16 ARG0: e26 [ e SF: prop TENSE: pres MOOD: indicative PROG: - PERF: - ] ARG1: x21 ARG2: x27 [ x PERS: 3 NUM: pl IND: + ] ]  [ _on_p_state<62:64> LBL: h16 ARG0: e28 [ e SF: prop TENSE: untensed MOOD: indicative PROG: - PERF: - ] ARG1: e26 ARG2: x29 [ x PERS: 3 NUM: sg IND: + ] ]  [ _a_q<65:66> LBL: h30 ARG0: x29 RSTR: h31 BODY: h32 ]  [ _regional_a_1<67:75> LBL: h33 ARG0: e34 [ e SF: prop TENSE: untensed MOOD: indicative PROG: bool PERF: - ] ARG1: x29 ]  [ _angular_a_1<76:83> LBL: h33 ARG0: e35 [ e SF: prop TENSE: untensed MOOD: indicative PROG: bool PERF: - ] ARG1: x29 ]  [ _unconformity/NN_u_unknown<84:96> LBL: h33 ARG0: x29 ]  [ _and_c<97:100> LBL: h16 ARG0: e2 ARG1: e19 ARG2: e36 [ e SF: prop TENSE: pres MOOD: indicative PROG: - PERF: - ] ]  [ _consist_v_of<101:109> LBL: h16 ARG0: e36 ARG1: x3 ARG2: x27 ]  [ subord<113:130> LBL: h37 ARG0: e38 [ e SF: prop TENSE: untensed MOOD: indicative PROG: - PERF: - ] ARG1: h39 ARG2: h40 ]  [ _northerly_a_1<113:130> LBL: h41 ARG0: e42 [ e SF: prop TENSE: untensed MOOD: indicative ] ARG1: i43 ]  [ subord<113:130> LBL: h44 ARG0: e45 [ e SF: prop TENSE: untensed MOOD: indicative PROG: - PERF: - ] ARG1: h46 ARG2: h47 ]  [ _derive_v_from<113:130> LBL: h48 ARG0: e49 [ e SF: prop TENSE: untensed MOOD: indicative ] ARG1: i50 ARG2: i51 ]  [ udef_q<131:171> LBL: h52 ARG0: x27 RSTR: h53 BODY: h54 ]  [ compound<131:142> LBL: h55 ARG0: e56 [ e SF: prop TENSE: untensed MOOD: indicative PROG: - PERF: - ] ARG1: e57 [ e SF: prop TENSE: untensed MOOD: indicative PROG: bool PERF: - ] ARG2: x58 ]  [ udef_q<131:142> LBL: h59 ARG0: x58 RSTR: h60 BODY: h61 ]  [ _quartz-/NN_u_unknown<131:142> LBL: h62 ARG0: x58 ]  [ _rich_a_in<131:142> LBL: h55 ARG0: e57 ARG1: x27 ARG2: i63 ]  [ compound<143:171> LBL: h55 ARG0: e64 [ e SF: prop TENSE: untensed MOOD: indicative PROG: - PERF: - ] ARG1: x27 ARG2: x65 [ x PERS: 3 NUM: pl PT: notpro ] ]  [ udef_q<143:164> LBL: h66 ARG0: x65 RSTR: h67 BODY: h68 ]  [ udef_q<143:150> LBL: h69 ARG0: x70 [ x PERS: 3 NUM: sg ] RSTR: h71 BODY: h72 ]  [ _clastic/NN_u_unknown<143:150> LBL: h73 ARG0: x70 ]  [ udef_q<151:164> LBL: h74 ARG0: x75 [ x PERS: 3 NUM: sg ] RSTR: h76 BODY: h77 ]  [ _and_c<151:154> LBL: h78 ARG0: x65 ARG1: x70 ARG2: x75 ]  [ _carbonate_n_1<155:164> LBL: h79 ARG0: x75 ]  [ _stratum_n_1<165:171> LBL: h55 ARG0: x27 ]  [ subord<172:219> LBL: h1 ARG0: e80 [ e SF: prop TENSE: untensed MOOD: indicative PROG: - PERF: - ] ARG1: h81 ARG2: h82 ]  [ _deposit_v_1<172:181> LBL: h83 ARG0: e84 [ e SF: prop TENSE: untensed MOOD: indicative ] ARG1: i85 ARG2: i86 ARG3: h87 ]  [ _on_p_loc<182:184> LBL: h88 ARG0: e89 [ e SF: prop TENSE: untensed MOOD: indicative PROG: - PERF: - ] ARG1: i86 ARG2: x90 [ x PERS: 3 NUM: sg IND: + ] ]  [ _a_q<185:186> LBL: h91 ARG0: x90 RSTR: h92 BODY: h93 ]  [ compound<187:199> LBL: h94 ARG0: e95 [ e SF: prop TENSE: untensed MOOD: indicative PROG: - PERF: - ] ARG1: e96 [ e SF: prop TENSE: untensed MOOD: indicative PROG: + PERF: - ] ARG2: x97 [ x IND: + ] ]  [ udef_q<187:199> LBL: h98 ARG0: x97 RSTR: h99 BODY: h100 ]  [ _south_n_of<187:199> LBL: h101 ARG0: x97 ARG1: i102 ]  [ _face_v_1<187:199> LBL: h94 ARG0: e96 ARG1: x90 ARG2: i103 ]  [ _continental_a_1<200:211> LBL: h94 ARG0: e104 [ e SF: prop TENSE: untensed MOOD: indicative PROG: bool PERF: - ] ARG1: x90 ]  [ _margin_n_1<212:219> LBL: h94 ARG0: x90 ] > HCONS: < h0 qeq h1 h5 qeq h7 h11 qeq h13 h18 qeq h16 h22 qeq h24 h31 qeq h33 h39 qeq h16 h40 qeq h44 h46 qeq h41 h47 qeq h48 h53 qeq h55 h60 qeq h62 h67 qeq h78 h71 qeq h73 h76 qeq h79 h81 qeq h37 h82 qeq h83 h87 qeq h88 h92 qeq h94 h99 qeq h101 > ICONS: < e49 topic i51 e84 topic i86 > ]

It may be that a subgraph of that MRS is the core of the issue but I have not yet dug deep enough to find out. Or maybe the issue comes up with sufficiently large MRSs.

@goodmami goodmami changed the title conversation to EDS/DMRS error : maximum recursion depth exceeded while calling a Python object Maximum recursion depth exceeded in MRS -> DMRS/EDS conversion Mar 21, 2019
@goodmami goodmami added this to the v1.0.0 milestone Apr 7, 2019
@goodmami
Copy link
Member

This no longer gives me an error in PyDelphin v1.0.0, so I'm closing the issue.

Semantic conversion in v1.0.0 is very different than it was before so it's likely I've sidestepped the issue. The scope representative algorithm in particular is no longer recursive, so we probably won't get the same error. But of course I'm not guaranteeing that semantic conversions will not return other errors (in which case please file a new issue :) ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants