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

add parent refs and hash defs to PAGE model #240

Closed
bertsky opened this issue May 8, 2019 · 2 comments
Closed

add parent refs and hash defs to PAGE model #240

bertsky opened this issue May 8, 2019 · 2 comments
Assignees

Comments

@bertsky
Copy link
Collaborator

bertsky commented May 8, 2019

The Python runtime model for PAGE-XML schema generated with generateDS is not very friendly:

  1. It does not provide the elements' classes with methods to access their parents (e.g. from TextEquivType to the containing GlyphType or WordType, or from GlyphType to the containing WordType asf.)
  2. It does not make the elements' classes hashable and string-representable, so they cannot be used in dicts.

This makes code dealing with PAGE unnecessarily complex and less readable. I propose using generateDS' user-methods option to provide those.

@bertsky
Copy link
Collaborator Author

bertsky commented May 16, 2019

Also, it is very awkward that there is no general get_Regions() (irrespective of the type of region) in PageType, and no iterator for PageType / ReadingOrderType / OrderedGroupType going through all regions in order.

Ideally, the new get_Regions would have two keyword arguments:

  • classes (with a list of class names) to restrict the types of regions,
  • in_order (as boolean) to enumerate either by XML hierarchy or by ReadingOrder (if any).

@bertsky
Copy link
Collaborator Author

bertsky commented Jun 4, 2020

The original issue was solved by #443 and #237.

The extended feature was solved by #479 (as get_AllRegions instead of get_Regions, with regions instead of classes and reading_order instead of in_order).

@bertsky bertsky closed this as completed Jun 4, 2020
bertsky pushed a commit to bertsky/core that referenced this issue Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants