Skip to content

Commit

Permalink
more slight template tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
mittagessen committed Mar 1, 2024
1 parent e4b0251 commit 291a0e8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion kraken/templates/alto
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
{% if loop.previtem and loop.previtem.type == 'line' %}
</TextBlock>
{% endif %}
<TextBlock ID="{{ entity.id }}" HPOS="{{ entity.bbox[0] }}" VPOS="{{ entity.bbox[1] }}" WIDTH="{{ entity.bbox[2] - entity.bbox[0] }}" HEIGHT="{{ entity.bbox[3] - entity.bbox[1] }}" {% for type in page.region_types %}{% if type in entity.tags.values() %}TAGREFS="REGION_TYPE_{{ loop.index }}"{% endif %}{% endfor %}>
<TextBlock ID="{{ entity.id }}" HPOS="{{ entity.bbox[0] }}" VPOS="{{ entity.bbox[1] }}" WIDTH="{{ entity.bbox[2] - entity.bbox[0] }}" HEIGHT="{{ entity.bbox[3] - entity.bbox[1] }}" {% if entity.tags %}{% for type in page.region_types %}{% if type in entity.tags.values() %}TAGREFS="REGION_TYPE_{{ loop.index }}"{% endif %}{% endfor %}{% endif %}>
<Shape>
<Polygon POINTS="{{ entity.boundary|sum(start=[])|join(' ') }}"/>
</Shape>
Expand Down
4 changes: 2 additions & 2 deletions kraken/templates/hocr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% macro render_line(line) -%}
<span class="ocr_line" id="line_{{ line.index }}" title="bbox {{ line.bbox|join(' ') }}; x_bboxes {{ line.cuts|sum(start=[])|map('join', ' ')|join(' ') }}{% if line.boundary -%}; poly {{ line.boundary|sum(start=[])|join(' ') }}{% endif %}">
<span class="ocr_line" id="{{ line.id }}" title="bbox {{ line.bbox|join(' ') }}; x_bboxes {{ line.cuts|sum(start=[])|map('join', ' ')|join(' ') }}{% if line.boundary -%}; poly {{ line.boundary|sum(start=[])|join(' ') }}{% endif %}">
{% for segment in line.recognition %}
<span class="ocrx_word" id="segment_{{ segment.index }}" title="bbox {{ segment.bbox|join(' ') }}; x_confs {{ segment.confidences|join(' ') }}{% if segment.boundary -%}; poly {{ segment.boundary|sum(start=[])|join(' ') }}{% endif %}">{{ segment.text }}</span>
{% endfor -%}
Expand All @@ -20,7 +20,7 @@
<div class="ocr_page" title="bbox 0 0 {{ page.size|join(' ') }}; image {{ page.name }}" style="writing-mode: {{ page.writing_mode }};">
{% for entity in page.entities -%}
{% if entity.type == "region" -%}
<div class="ocrx_block" id="region_{{ entity.index }}" data-region-type="{{ entity.region_type }}" title="bbox {{ entity.bbox|join(' ') }}; poly {{ entity.boundary|sum(start=[])|join(' ') }}">
<div class="ocrx_block" id="{{ entity.id }}" data-region-type="{{ entity.region_type }}" title="bbox {{ entity.bbox|join(' ') }}; poly {{ entity.boundary|sum(start=[])|join(' ') }}">
{% for line in entity.lines -%}
{{ render_line(line) }}
{% endfor %}
Expand Down

0 comments on commit 291a0e8

Please sign in to comment.