Merge pull request #58 from kba/unorderedgroupindexed
continuous-integration/drone/push Build is passing Details

ReadingOrder may also contain UnorderedGroupIndexed
pull/66/head
Mike Gerber 4 years ago committed by GitHub
commit 0b9af3a21e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -97,14 +97,14 @@ def extract_texts_from_reading_order_group(group, tree, nsmap, textequiv_level):
ro_children = filter(lambda child: "index" in child.attrib.keys(), ro_children) ro_children = filter(lambda child: "index" in child.attrib.keys(), ro_children)
ro_children = sorted(ro_children, key=lambda child: int(child.attrib["index"])) ro_children = sorted(ro_children, key=lambda child: int(child.attrib["index"]))
elif ET.QName(group.tag).localname == "UnorderedGroup": elif ET.QName(group.tag).localname in ["UnorderedGroup","UnorderedGroupIndexed"]:
ro_children = list(group) ro_children = list(group)
else: else:
raise NotImplementedError raise NotImplementedError
for ro_child in ro_children: for ro_child in ro_children:
if ET.QName(ro_child.tag).localname in ["OrderedGroup", "OrderedGroupIndexed", "UnorderedGroup"]: if ET.QName(ro_child.tag).localname in ["OrderedGroup", "OrderedGroupIndexed", "UnorderedGroup", "UnorderedGroupIndexed"]:
regions.extend( regions.extend(
extract_texts_from_reading_order_group( extract_texts_from_reading_order_group(
ro_child, tree, nsmap, textequiv_level ro_child, tree, nsmap, textequiv_level

Loading…
Cancel
Save