mirror of
https://github.com/qurator-spk/eynollah.git
synced 2026-04-30 19:22:03 +02:00
writer: also annotate col-classifier result…
both notations: - in `/PcGts/Page/@custom` (CSS-style) - in `/PcGts/Metadata/Comment` (qurator-style)
This commit is contained in:
parent
e3720d6623
commit
9723dfeb73
2 changed files with 9 additions and 0 deletions
|
|
@ -2253,6 +2253,7 @@ class Eynollah:
|
|||
conf_contours_textregions =[0]
|
||||
|
||||
pcgts = writer.build_pagexml_no_full_layout(
|
||||
num_col=num_col_classifier,
|
||||
found_polygons_text_region=cont_page,
|
||||
page_coord=page_coord,
|
||||
order_of_texts=order_text_new,
|
||||
|
|
@ -2323,6 +2324,7 @@ class Eynollah:
|
|||
self.logger.info("No columns detected - generating empty PAGE-XML")
|
||||
|
||||
pcgts = writer.build_pagexml_no_full_layout(
|
||||
num_col=0,
|
||||
found_polygons_text_region=[],
|
||||
page_coord=page_coord,
|
||||
page_slope=slope_deskew,
|
||||
|
|
@ -2612,6 +2614,7 @@ class Eynollah:
|
|||
|
||||
if self.full_layout:
|
||||
pcgts = writer.build_pagexml_full_layout(
|
||||
num_col=num_col_classifier,
|
||||
found_polygons_text_region=polygons_of_textregions,
|
||||
found_polygons_text_region_h=polygons_of_textregions_h,
|
||||
page_coord=page_coord,
|
||||
|
|
@ -2642,6 +2645,7 @@ class Eynollah:
|
|||
)
|
||||
else:
|
||||
pcgts = writer.build_pagexml_no_full_layout(
|
||||
num_col=num_col_classifier,
|
||||
found_polygons_text_region=polygons_of_textregions,
|
||||
page_coord=page_coord,
|
||||
page_slope=slope_deskew,
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ class EynollahXmlWriter:
|
|||
def build_pagexml_no_full_layout(
|
||||
self,
|
||||
*,
|
||||
num_col,
|
||||
found_polygons_text_region,
|
||||
page_coord,
|
||||
page_slope,
|
||||
|
|
@ -98,6 +99,7 @@ class EynollahXmlWriter:
|
|||
conf_tables=None,
|
||||
):
|
||||
return self.build_pagexml_full_layout(
|
||||
num_col=num_col,
|
||||
found_polygons_text_region=found_polygons_text_region,
|
||||
found_polygons_text_region_h=[],
|
||||
page_coord=page_coord,
|
||||
|
|
@ -131,6 +133,7 @@ class EynollahXmlWriter:
|
|||
def build_pagexml_full_layout(
|
||||
self,
|
||||
*,
|
||||
num_col,
|
||||
found_polygons_text_region,
|
||||
found_polygons_text_region_h,
|
||||
page_coord,
|
||||
|
|
@ -171,6 +174,8 @@ class EynollahXmlWriter:
|
|||
pcgts = self.pcgts if self.pcgts else create_page_xml(
|
||||
self.image_filename, self.image_height, self.image_width)
|
||||
page = pcgts.get_Page()
|
||||
pcgts.Metadata.Comments = "num_col %d" % num_col
|
||||
page.set_custom('layout {num_col:%d;} ' % num_col)
|
||||
page.set_orientation(-page_slope)
|
||||
if len(cont_page):
|
||||
page.set_Border(BorderType(Coords=CoordsType(points=self.calculate_points(cont_page[0]))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue