Better error reporting in parsing syntactic structures
This commit is contained in:
parent
48795c6227
commit
577983427e
|
@ -86,7 +86,10 @@ class SyntacticStructure:
|
||||||
for c in self.components:
|
for c in self.components:
|
||||||
if c.idx == idx:
|
if c.idx == idx:
|
||||||
return c
|
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):
|
def match(self, word):
|
||||||
matches = self.components[0].match(word)
|
matches = self.components[0].match(word)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user