+ def get_sem_coords(self, sem):
+ area = sem.find("div[@type='rect']")
+ if area is None:
+ area = sem.find("div[@type='whole']")
+ return [[0, 0], [-1, -1]]
+
+ def has_all_props(node, props):
+ return reduce(and_, map(lambda prop: prop in node.attrib, props))
+
+ if has_all_props(area, ['x1', 'x2', 'y1', 'y2']) == False:
+ return None
+
+ def n(prop): return int(area.get(prop))
+ return [[n('x1'), n('y1')], [n('x2'), n('y2')]]
+
+