File size: 2,068 Bytes
4d1c378
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e8fb686
4d1c378
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<alto xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://www.loc.gov/standards/alto/ns-v4#"
    xsi:schemaLocation="http://www.loc.gov/standards/alto/ns-v4# http://www.loc.gov/standards/alto/v4/alto-4-3.xsd">
    <Description>
        <MeasurementUnit>pixel</MeasurementUnit>
        <sourceImageInformation>
            <fileName>{{ path }}</fileName>
        </sourceImageInformation>
        <OCRProcessing>
            <ocrProcessingStep>
                <processingSoftware>
                    <softwareName>Kraken</softwareName>
                </processingSoftware>
            </ocrProcessingStep>
        </OCRProcessing>
    </Description>
    <Tags>
        {% for tag in tags.values() %}
            <OtherTag ID="{{tag.idx}}" LABEL="{{tag.label}}" DESCRIPTION="{{tag.element_type}} type {{tag.label}}"/>{% endfor %}
    </Tags>
    <Layout>
        <Page WIDTH="{{ image.width }}" HEIGHT="{{ image.height }}" PHYSICAL_IMG_NR="1">
            <PrintSpace HPOS="0" VPOS="0" WIDTH="{{ image.width }}" HEIGHT="{{ image.height }}">
                {% for bid, block in blocks.items() %}
                <TextBlock ID="{{ bid or 'anonymous' }}" {%if block.category%}TAGREFS="{{tags[block.category].idx}}" {% endif%} {% if block.bbox %} HPOS="{{ block.hpos }}" VPOS="{{ block.vpos }}" WIDTH="{{ block.width }}" HEIGHT="{{ block.height }}" {% endif %}>
                    {%-if block.bbox %}<Shape><Polygon POINTS="{{ block.polygons|join(" ") }}" /></Shape>{% endif -%}
                    {% for line in block.lines %}<TextLine ID="{{ line.idx }}" {%if block.category%}TAGREFS="{{tags[line.category].idx}}" {% endif%}  HPOS="{{ line.hpos }}" VPOS="{{ line.vpos }}" WIDTH="{{ line.width }}" HEIGHT="{{ line.height }}" BASELINE="{{line.baseline|join(" ")}}">
                        <Shape><Polygon POINTS="{{ line.simple_polygon|join(" ") }}" /></Shape>
                    </TextLine>
                    {% endfor %}
                </TextBlock>
                {% endfor %}
            </PrintSpace>
        </Page>
    </Layout>
</alto>