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

Error when reading multiple SimpleMRSs #70

Closed
goodmami opened this issue May 9, 2016 · 0 comments
Closed

Error when reading multiple SimpleMRSs #70

goodmami opened this issue May 9, 2016 · 0 comments
Labels
Milestone

Comments

@goodmami
Copy link
Member

goodmami commented May 9, 2016

This affects pyDelphin v0.4.1.

Parsing a single MRS works:

>>> from delphin.mrs import simplemrs
>>> gen = simplemrs.loads('[ TOP: h0 RELS: < [ "_rain_v_1_rel" LBL: h1 ARG0: e2 ] > HCONS: < h0 qeq h1 > ]')
>>> next(gen)
<Xmrs object (rain) at 140066960825312>

But requesting the next object gives an XmrsDeserializationError, because the final ] was not consumed:

>>> next(gen)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/goodmami/repos/pydelphin/delphin/mrs/simplemrs.py", line 185, in deserialize
    yield _read_mrs(tokens, version, errors)
  File "/home/goodmami/repos/pydelphin/delphin/mrs/simplemrs.py", line 202, in _read_mrs
    _read_literals(tokens, '[')
  File "/home/goodmami/repos/pydelphin/delphin/mrs/simplemrs.py", line 195, in _read_literals
    'Expected \'{}\': {}'.format(tok, ' '.join([tok] + list(tokens)))
delphin._exceptions.XmrsDeserializationError: Expected '[': [

A StopIteration exception is expected for the second next(gen) call.

Also, the exception message is confusing, because it says the expected character is the one received, which isn't true.

@goodmami goodmami added the bug label May 9, 2016
@goodmami goodmami modified the milestone: v0.5.0 Jun 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant