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

Top-level reading order #23

Merged
merged 15 commits into from
Nov 29, 2024
Merged

Conversation

bertsky
Copy link
Member

@bertsky bertsky commented Aug 7, 2024

Experimental. Details follow...

@bertsky bertsky self-assigned this Aug 10, 2024
@bertsky bertsky linked an issue Aug 10, 2024 that may be closed by this pull request
@bertsky bertsky marked this pull request as ready for review August 10, 2024 08:49
@bertsky bertsky requested a review from rue-a August 10, 2024 08:49
- `TextractLayout`: init with additional list
  of top-level block dict stored in `child_regions`:
  - just ID→dict (for LAYOUT_ types during build)
  - or ID→block (for TextractTable, KEY, SELECTION etc.
     already instantiated)
- add `parent_layout` reference

- `TextractTable`: add `parent_layout` reference
- `TextractKey`: add `parent_layout` reference
- `TextractValue`: add `parent_layout` reference

- build `layouts` after all other blocks are built
- replace recursive `child_regions` / `parent_layout`
  after all `layouts` are built; remove recursive
  instances from top level to avoid duplication
  in ReadingOrder or PcGts instantiation

- ReadingOrder: extend recursive case (OrderedGroup)
  of `LAYOUT_FIGURE` with `LINE` children to `LAYOUT_*`
  with any `child_regions`

- instantiation of PcGts types for `layouts`
  and `tables`: refactor as (inline) function
  for recursion and
  - try to re-use code
  - add assertions around known types of recursion
    (to be revisited with better documentation from AWS
    or more data examples)
@bertsky bertsky merged commit d7d21c0 into slub:master Nov 29, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

reading order: WORD-based vs. top-level based
1 participant