delph-in / pydelphin

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

SimpleDMRS codec fails if `index` is not present. #334

Closed goodmami closed 2 years ago

goodmami commented 3 years ago

The index is not a required feature of SimpleDMRS (or any other codec, I think), but currently the codec fails if it is missing:

>>> from delphin.codecs import simpledmrs
>>> simpledmrs.decode('dmrs { [top=10000] 10000 [ _rain_v_1 e tense=past]; }')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/goodmami/delphin/pydelphin/delphin/codecs/simpledmrs.py", line 105, in decode
    return _decode_dmrs(lexer)
  File "/home/goodmami/delphin/pydelphin/delphin/codecs/simpledmrs.py", line 197, in _decode_dmrs
    index=int(index),
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

This call should succeed.