Better error reporting in parsing syntactic structures

This commit is contained in:
Ozbolt Menegatti 2019-07-01 17:22:30 +02:00
parent 48795c6227
commit 577983427e

View File

@ -86,7 +86,10 @@ class SyntacticStructure:
for c in self.components:
if c.idx == idx:
return c
raise RuntimeError("Unknown component id: {}".format(idx))
cs = [c.idx for c in self.components]
msg = "Structure id={} has components: {}, but no component: {}".format(self.id, cs, (idx,))
raise RuntimeError(msg)
def match(self, word):
matches = self.components[0].match(word)