Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow shape-element usage (IMPACT) #22

Closed
evelienket opened this issue Jul 1, 2014 · 19 comments
Closed

Allow shape-element usage (IMPACT) #22

evelienket opened this issue Jul 1, 2014 · 19 comments
Assignees

Comments

@evelienket
Copy link
Member

Submitter: IMPACT
Submitted: 2013-02

Use Case

ALTO 2.0 uses four attributes (HEIGHT, WIDTH,HPOS, VPOS) to describe the location and size of a text line. These coordinates do not describe the text line as such, but a bounding box around the text line. This box is always a rectangle.
For analysis purposes the shape need be described more precisely and coordinate information must not just be limited to text lines. The shape should also be recorded for individual characters, words, text lines, blocks and the print space as such.

Implementation
The element should store either polygon, rectangle, ellipse or circle. There must not be a sibling element for the same parent. The element is optional. A element can be added to the following parent elements:

  • Glyph
  • String
  • TextLine
  • PageSpaceType
  • All block types

The <shape> element can only have a single child element. This child element describes the type of shape with the exact coordinates. All coordinates are expressed as float values. The following shape types are supported by the appropriate elements:

.... .... ....
Polygon <Polygon> POINTS attribute contains a list of coordinate-pairs. Each coordinate pair consists of a HPOS and VPOS value separated by a whitespace character. The pairs are separate by a whitespace as well. A POINTS attribute must at least contain three pairs.
Circle <Circle> HPOS and VPOS attributes specify the center of the circle. RADIUS specify the radius of the circle.
Ellipse <Ellipse> HPOS and VPOS attributes specify the centre of the ellipse. HLENGTH specifies the horizontal radius of the ellipse. VLENGTH specifies the vertical radius of the ellipse. ROTATION specifies the degrees counterclockwise.

For backward compatibility, rectangles will continue to be expressed using the existing HEIGHT, WIDTH, HPOS and VPOS attributes on all blocktypes that can carry the new Shape element. However, their use will be changed to optional, if a Shape element exists. Each Shape child (Polygon, etc.) will contain it's coordinates (required).

<TextBlock language="de-DE" ID="ID017" STYLEREF="ID011" HEIGHT="1564" WIDTH="1592" HPOS="193" VPOS="364">
  <TextLine ID="D035" STYLEREFS="ID002" BASELINE="1265" CS="false">
    <Shape>
      <Polygon POINTS="752.2 1239.1 752 1672 805 1672 805 1239"/>
    </Shape>
    <String ID="P13_ST00001" HPOS="539" VPOS="562" WIDTH="681" HEIGHT="39" CONTENT="Advertisement" WC="0.35" CC="8688056667845757"/>
  </TextLine>
</TextBlock>

Changes

current (ALTO 3.0)

<xsd:complexType name="StringType" mixed="false">
    <xsd:annotation>
        <xsd:documentation>A sequence of chars. Strings are separated by white spaces or hyphenation chars.</xsd:documentation>
    </xsd:annotation>
    <xsd:sequence minOccurs="0">
        <xsd:element name="ALTERNATIVE" maxOccurs="unbounded"/>
... 

proposed

<xsd:complexType name="StringType" mixed="false">
    <xsd:annotation>
        <xsd:documentation>A sequence of chars. Strings are separated by white spaces or hyphenation chars.</xsd:documentation>
    </xsd:annotation>
    <xsd:sequence minOccurs="0">
        <xsd:element name="Shape" type="ShapeType" minOccurs="0" maxOccurs="1"/>
        <xsd:element name="ALTERNATIVE" minOccurs="0"  maxOccurs="unbounded"/>
...

current

<xsd:element name="TextLine" maxOccurs="unbounded">
    <xsd:annotation>
        <xsd:documentation>A single line of text.</xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
    <xsd:sequence>
        <xsd:sequence maxOccurs="unbounded">
            <xsd:element name="String" type="StringType"/>
            <xsd:element name="SP" minOccurs="0"/>
...

proposed

<xsd:element name="TextLine" maxOccurs="unbounded">
    <xsd:annotation>
        <xsd:documentation>A single line of text.</xsd:documentation>
    </xsd:annotation>
...
    <xsd:attribute name="HEIGHT" type="xsd:float" use="optional"/>
    <xsd:attribute name="WIDTH" type="xsd:float" use="optional"/>  
    <xsd:attribute name="HPOS" type="xsd:float" use="optional"/>
    <xsd:attribute name="VPOS" type="xsd:float" use="optional"/>
...

    <xsd:complexType>
        <xsd:sequence>
        <xsd:sequence maxOccurs="unbounded">
        <xsd:element name="Shape" type="ShapeType" minOccurs="0" maxOccurs="1"/>
        <xsd:element name="String" type="StringType"/>
        <xsd:element name="SP" minOccurs="0"/>
...

current

...

proposed

<xsd:complexType name="GlyphType" mixed="false">
    <xsd:annotation>
        <xsd:documentation>A sequence of chars. Strings are separated by white spaces or hyphenation chars. Rectangular attributes HEIGHT, WIDTH, HPOS , VPOS are only foruse describing rectangles; omit if describing other than rectangular shapes. 
        </xsd:documentation>
    </xsd:annotation>
...
    <xsd:attribute name="HEIGHT" type="xsd:float" use="optional"/>
    <xsd:attribute name="WIDTH" type="xsd:float" use="optional"/>  
    <xsd:attribute name="HPOS" type="xsd:float" use="optional"/>
    <xsd:attribute name="VPOS" type="xsd:float" use="optional"/>
...
    <xsd:sequence minOccurs="0">
    <xsd:element name="Shape" type="ShapeType"  minOccurs="0" maxOccurs="1"/>
    <xsd:element name="Variant" minOccurs="0" maxOccurs="unbounded"/>
...

current

<xsd:complexType name="PageSpaceType">
    <xsd:annotation>
        <xsd:documentation>A region on a page</xsd:documentation>
    </xsd:annotation>
    <xsd:sequence minOccurs="0" maxOccurs="unbounded"> 
        <xsd:group ref="BlockGroup"/>
    </xsd:sequence>
    <xsd:attribute name="ID" type="xsd:ID" use="optional"/>
...

proposed

<xsd:complexType name="PageSpaceType">
    <xsd:annotation>
        <xsd:documentation>A region on a page</xsd:documentation>
    </xsd:annotation>
    <xsd:sequence minOccurs="0" maxOccurs="unbounded">
        <xsd:element name="Shape" type="ShapeType" minOccurs="0"  maxOccurs="1"/>
        <xsd:group ref="BlockGroup" minOccurs="0"/>
    </xsd:sequence>
    <xsd:attribute name="ID" type="xsd:ID" use="optional"/>
...

current

<xsd:complexType name="EllipseType">
    <xsd:annotation>
        <xsd:documentation>An ellipse shape.</xsd:documentation>
    </xsd:annotation>
    <xsd:attribute name="HPOS" type="xsd:float"/>
    <xsd:attribute name="VPOS" type="xsd:float"/>
    <xsd:attribute name="HLENGTH" type="xsd:float"/>
    <xsd:attribute name="VLENGTH" type="xsd:float"/>
</xsd:complexType>
...

proposed

<xsd:complexType name="EllipseType">
    <xsd:annotation>
        <xsd:documentation>An ellipse shape.</xsd:documentation>
    </xsd:annotation>
    <xsd:attribute name="HPOS" type="xsd:float" use="required"/>
    <xsd:attribute name="VPOS" type="xsd:float" use="required"/>
    <xsd:attribute name="HLENGTH" type="xsd:float" use="required" />
    <xsd:attribute name="VLENGTH" type="xsd:float" use="required"/>
    <xsd:attribute name="ROTATION" type="xsd:float" use="optional">
        <xsd:annotation>
           <xsd:documentation>Tells the rotation of the block e.g. text or illustration.  The value is in degrees counterclockwise. </xsd:documentation>
        </xsd:annotation>
    </xsd:attribute>
</xsd:complexType>
...

current

<xsd:complexType name="CircleType">
        <xsd:annotation>
            <xsd:documentation>A circle shape.</xsd:documentation>
        </xsd:annotation>
        <xsd:attribute name="HPOS" type="xsd:float"/>
        <xsd:attribute name="VPOS" type="xsd:float"/>
        <xsd:attribute name="RADIUS" type="xsd:float"/>
    </xsd:complexType>
...

proposed

<xsd:complexType name="CircleType">
    <xsd:annotation>
        <xsd:documentation>A circle shape.</xsd:documentation>
    </xsd:annotation>
    <xsd:attribute name="HPOS" type="xsd:float" use="required"/>
    <xsd:attribute name="VPOS" type="xsd:float"  use="required"/> 
    <xsd:attribute name="RADIUS" type="xsd:float" use="required"/>
</xsd:complexType>
...
@evelienket evelienket self-assigned this Jul 1, 2014
@jukervin jukervin changed the title Allow shape-element usage Allow shape-element usage (IMPACT) Sep 10, 2014
@jukervin jukervin added this to the 3.1 milestone Sep 10, 2014
@jukervin
Copy link
Member

Changed xsd:ints to xsd:floats

@evelienket
Copy link
Member Author

Examples of situations where polygons are used:
The following newspaper pages have text blocks that are skewed. If there where only rectangles to describe the blocks they would overlap. This is solved when polygons are used for text blocks, text lines and strings. Should the rotation of the text also be described with the attribute of the text block?
http://resolver.kb.nl/resolve?urn=ddd:010415804:mpeg21:p006
http://resolver.kb.nl/resolve?urn=ddd:010417484:mpeg21:p006

The text line "Politiek behandelt buitenlanders teveel als taboe" that is also the title of the article must be described as a polygon on text line level.
http://resolver.kb.nl/resolve?urn=ddd:010646453:mpeg21:p005

This page has photographs that are printed on top of each other. Use a polygon on block level to describe the shape of the photo.
http://resolver.kb.nl/resolve?urn=ddd:010370152:mpeg21:p004

First line of the poem has a character 'e' that stretches across two lines. Suggest to make a polygon of the textline and the string.
http://resolver.kb.nl/resolve?urn=dpo:1837:mpeg21:0006

When bounding boxes are used in ghotic text, the bounding box of the lower text line many times includes bits and pieces of the text of the text line above. To avoid this use polygons to describe the shape of the textlines.
http://resolver.kb.nl/resolve?urn=ddd:010634061

The text blokcs on this page that are shaped around the picture can be described as polygons.
http://resolver.kb.nl/resolve?urn=dts:2958045:mpeg21:0001

@cowboyMontana
Copy link
Member

Jean Philippe has an excellent description of the issues around languages at https://github.com/altoxml/schema/blob/master/v3/discussion%20of%20ALTO%20language%20support.pdf.

@evelienket
Copy link
Member Author

Accidentally closed the issue.

This is the document, about elements for textdirection in different standards, we discussed at the last meeting: https://github.com/altoxml/schema/blob/master/v3/Comparison%20of%20text%20direction%20elements.pdf

@evelienket evelienket reopened this May 6, 2015
@evelienket
Copy link
Member Author

This is a summary of the language support discussion so far. (Also part of the minutes of 2015-04-08)
https://github.com/altoxml/schema/blob/master/v3/ALTO-language%20support%20discussion%20so%20far-20150601.pdf

@evelienket
Copy link
Member Author

The changes necessary to implement issue 22 are added to the 3.1 draft version https://github.com/altoxml/schema/blob/master/v3/alto-3-1.draft.xsd

@Jo-CCS
Copy link
Member

Jo-CCS commented Jun 24, 2015

On the version 3-1 the differences / changes to original version are not visible.
The changes to be done from copy of 3-0 to be able to see the changes.

@evelienket
Copy link
Member Author

evelienket commented Oct 8, 2015

As we agreed on in the last meeting, I have added code examples on the documentation page as much as I had time for.
See: http://altoxml.github.io/documentation/use-cases/shape/ALTO_shape_usecases.html

@cowboyMontana
Copy link
Member

ACCEPT

1 similar comment
@jpmoreux
Copy link
Member

ACCEPT

@Jo-CCS
Copy link
Member

Jo-CCS commented Oct 13, 2015

ACCEPT

Hi Evelien,
great samples to the documentation.
I just have a comment about the rotation sample "Skewed text - 2".
"It could also be recorded in each individual TextBlocks." - Logically I would expect that subelements get inherited the rotation from parent. In case the subelement repeats the rotation I would expect it is rotated further more based on already existing rotation of parent (although is unlikely case).
But I think we need to fix this and clarify for generic usage.
As you stated in previous the rotation is inherited, would perhaps be good just to remove the above copied part and discuss this topic independant to the shape topic, as it is not related to this only.
Also affects the Block types, f.e.

For "Headline on more than one row" and "Wrapped text" would be good to have the sample code as well. If you provide the images I could process with docWorks and then adapt the shape into it.

@jukervin
Copy link
Member

ACCEPT

1 similar comment
@ntra00
Copy link
Member

ntra00 commented Nov 5, 2015

ACCEPT

@evelienket
Copy link
Member Author

in the meeting of oktober 14 there were no comment on the shape issue. The only concern came from Joachim. He wondered about the inheritance of the rotation characteristic. Is it done conform inheritance of other attributes in the ALTO.
It was agreed that I would compare rotation to other attributes.
Note that this is only a documentation thing.

So far the two attributes that are most like rotation are LANG and STYLE.

  • All three are characteristics of text.
  • LANG and STYLE can be applied on different level in the ALTO, string and block type elements.
  • If LANG and STYLE have a different value at a deeper level, the value overrides the value at the higher level.

@evelienket
Copy link
Member Author

ACCEPT

@bkgeig
Copy link
Member

bkgeig commented Nov 11, 2015

Accept

1 similar comment
@libmanuk
Copy link

libmanuk commented Dec 2, 2015

Accept

@evelienket
Copy link
Member Author

Request for public comment was made on the Impact Centre of Competence website on december 3 2015: http://www.digitisation.eu/blog/input-for-alto-3-1-version-request/

@evelienket
Copy link
Member Author

This issue is implemented in version 3.1 of the schema, which is now officially released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants