Handling empty
This commit is contained in:
parent
a9b6681576
commit
4dc87ce953
11
wani.py
11
wani.py
|
@ -170,7 +170,7 @@ class ComponentRepresentation:
|
|||
else:
|
||||
return {s['selection']: s['value']}
|
||||
else:
|
||||
raise NotImplementedError("Representation: {}".format(s))
|
||||
return None
|
||||
|
||||
|
||||
class ComponentStatus(Enum):
|
||||
|
@ -348,6 +348,9 @@ class Component:
|
|||
for feature in representation:
|
||||
f = ComponentRepresentation.new(dict(feature.attrib))
|
||||
|
||||
if type(f) is None:
|
||||
print("Unknown representation in component {}, skipping...".format(self.idx), file=sys.stderr)
|
||||
continue
|
||||
if type(f) is StructureSelection:
|
||||
assert(cr is None)
|
||||
cr = f
|
||||
|
@ -543,7 +546,7 @@ class SyntacticStructure:
|
|||
elif el.tag == "representation_and":
|
||||
els = list(el)
|
||||
else:
|
||||
raise NotImplementedError("repr what?: {}".format(el.tag))
|
||||
raise NotImplementedError("Unknown representation tag: {}".format(el.tag))
|
||||
|
||||
for el in els:
|
||||
if el.get('basic') == 'form':
|
||||
|
@ -552,7 +555,9 @@ class SyntacticStructure:
|
|||
elif el.get('basic') == "agreement":
|
||||
self.add_agreement(n, el)
|
||||
else:
|
||||
raise NotImplementedError("representation?: {}".format(el.tag))
|
||||
print("Strange representation (basic={}) in structure {}. Skipping"
|
||||
.format(el.get('basic'), self.id), file=sys.stderr)
|
||||
continue
|
||||
|
||||
def add_agreement(self, n, el):
|
||||
assert(el.get('head')[:4] == 'cid_')
|
||||
|
|
Loading…
Reference in New Issue
Block a user