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