ACEGenerator expects a string MRS to generate from. When working with PyDelphin's MRS objects, it may be tempting to try and generate from the MRS object without first serializing to a string. The error message for this, however, is not intuitive:
>>> from delphin import ace
>>> parser = ace.ACEParser('../erg-2018.dat')
>>> generator = ace.ACEGenerator('../erg-2018.dat', cmdargs=['-r', 'root_frag'])
>>> response = parser.interact('the phone')
>>> gresponse = generator.interact(response.result(0).mrs())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/goodmami/delphin/pydelphin/delphin/ace.py", line 255, in interact
validated = self._validate_input(datum)
File "/home/goodmami/delphin/pydelphin/delphin/ace.py", line 387, in _validate_input
return _possible_mrs(datum)
File "/home/goodmami/delphin/pydelphin/delphin/ace.py", line 624, in _possible_mrs
for i, c in enumerate(s):
File "/home/goodmami/delphin/pydelphin/delphin/sembase.py", line 164, in __getitem__
return self._pidx[id]
KeyError: 0
The interact() method should perhaps through an error if the argument is not a string.
ACEGenerator
expects a string MRS to generate from. When working with PyDelphin's MRS objects, it may be tempting to try and generate from the MRS object without first serializing to a string. The error message for this, however, is not intuitive:The
interact()
method should perhaps through an error if the argument is not a string.See this discourse thread.