-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Refactor: support merging extracted layout with inferred layout
#2158
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
Merged
christinestraub
merged 45 commits into
main
from
refactor/pdf_text_extraction_for_hi_res
Dec 1, 2023
Merged
Refactor: support merging extracted layout with inferred layout
#2158
christinestraub
merged 45 commits into
main
from
refactor/pdf_text_extraction_for_hi_res
Dec 1, 2023
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…lename` is not None
…m `inferred_page.image_metadata`
# Conflicts: # CHANGELOG.md
…m_layout()` as final elements when merging inferred with extracted
# Conflicts: # CHANGELOG.md # unstructured/__version__.py
benjats07
approved these changes
Dec 1, 2023
Contributor
benjats07
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
# Conflicts: # CHANGELOG.md # requirements/base.txt # requirements/ingest/embed-aws-bedrock.txt # requirements/ingest/embed-huggingface.txt # requirements/ingest/embed-openai.txt
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR is the second part of
pdfminerrefactor to move it fromunstructured-inferencerepo tounstructuredrepo, the first part is done in Unstructured-IO/unstructured-inference#294. This PR adds logic to merge the extracted layout with the inferred layout.The updated workflow for the
hi_resstrategy:inferencerepo to getinferred_layout(DocumentLayout)inferred_layoutreturned from theinferencerepo and the document (as data/filename) to thepdfminer_processingmodule, which first opens the document (create temp file/dir as needed), and splits the document by pagesTrue, return the passed inferred_layout(DocumentLayout)False:extracted_layout(TextRegions) with the passedinferred_layout(DocumentLayout)inferred_layout(DocumentLayout) with updated elements (all merged LayoutElements) as merged_layout (DocumentLayout)OCRmodule, which first opens the document (create temp file/dir as needed), and splits the document by pages (convert PDF pages to image pages for PDF file)This PR also bumps
unstructured-inference==0.7.17since the branch relay on pdfminer refactor from unstructured-inference.Note
This PR also fixes issue #2164 by using functionality similar to the one implemented in the
faststrategy workflow when extracting elements bypdfminer.TODO
unstructured-inferencerepo tounstructuredrepoxycutsorting to the elements extracted bypdfminer