minor clean up xml_reading_order

pull/28/head
Konstantin Baierer 4 years ago
parent 38ab2aa573
commit 630002d96d

@ -1,4 +1,5 @@
# pylint: disable=too-many-locals,wrong-import-position,too-many-lines,too-many-statements,chained-comparison,fixme,broad-except,c-extension-no-member # pylint: disable=too-many-locals,wrong-import-position,too-many-lines,too-many-statements,chained-comparison,fixme,broad-except,c-extension-no-member
# pylint: disable=invalid-name
from lxml import etree as ET from lxml import etree as ET
import numpy as np import numpy as np
@ -47,15 +48,13 @@ def xml_reading_order(page, order_of_texts, id_of_texts, id_of_marginalia, found
region_order_sub = ET.SubElement(region_order, 'OrderedGroup') region_order_sub = ET.SubElement(region_order, 'OrderedGroup')
region_order_sub.set('id', "ro357564684568544579089") region_order_sub.set('id', "ro357564684568544579089")
indexer_region = 0 indexer_region = 0
for vj in order_of_texts: for idx_text in order_of_texts:
name = "coord_text_%s" % vj
name = ET.SubElement(region_order_sub, 'RegionRefIndexed') name = ET.SubElement(region_order_sub, 'RegionRefIndexed')
name.set('index', str(indexer_region)) name.set('index', str(indexer_region))
name.set('regionRef', id_of_texts[vj]) name.set('regionRef', id_of_texts[idx_text])
indexer_region += 1 indexer_region += 1
for vm in range(len(found_polygons_marginals)): for _ in found_polygons_marginals:
id_of_marginalia.append('r%s' % indexer_region) id_of_marginalia.append('r%s' % indexer_region)
name = "coord_text_%s" % indexer_region
name = ET.SubElement(region_order_sub, 'RegionRefIndexed') name = ET.SubElement(region_order_sub, 'RegionRefIndexed')
name.set('index', str(indexer_region)) name.set('index', str(indexer_region))
name.set('regionRef', 'r%s' % indexer_region) name.set('regionRef', 'r%s' % indexer_region)

Loading…
Cancel
Save