-
Notifications
You must be signed in to change notification settings - Fork 867
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
Fix: embedded text not getting merged with inferred elements #2679
Merged
christinestraub
merged 14 commits into
main
from
fix/embedded-text-not-getting-merged-with-inferred-elements
Mar 23, 2024
Merged
Fix: embedded text not getting merged with inferred elements #2679
christinestraub
merged 14 commits into
main
from
fix/embedded-text-not-getting-merged-with-inferred-elements
Mar 23, 2024
Conversation
This file contains 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
…_of()` when removing pdfminer (embedded) elements merged with inferred elements
…ferred-elements # Conflicts: # CHANGELOG.md # unstructured/__version__.py
christinestraub
added a commit
to Unstructured-IO/unstructured-inference
that referenced
this pull request
Mar 22, 2024
This PR is the first part of fixing "embedded text not getting merged with inferred elements" and works together with the unstructured PR - Unstructured-IO/unstructured#2679. ### Summary - replace `Rectangle.is_in()` with `Rectangle.is_almost_subregion_of()` when filling in an inferred element with embedded text - add env_config `EMBEDDED_TEXT_AGGREGATION_SUBREGION_THRESHOLD` ### Note The ingest test won't pass until we merge the unstructured PR - Unstructured-IO/unstructured#2679.
…t test fixtures update (#2688) This pull request includes updated ingest test fixtures. Please review and merge if appropriate. Co-authored-by: christinestraub <[email protected]>
cragwolfe
approved these changes
Mar 23, 2024
kaaloo
pushed a commit
to inclusif/unstructured
that referenced
this pull request
Apr 8, 2024
…tured-IO#2679) This PR is the second part of fixing "embedded text not getting merged with inferred elements", the first part is done in Unstructured-IO/unstructured-inference#331. ### Summary - replace `Rectangle.is_in()` with `Rectangle.is_almost_subregion_of()` when removing pdfminer (embedded) elements that were merged with inferred elements - use env_config `EMBEDDED_TEXT_AGGREGATION_SUBREGION_THRESHOLD` introduced in the [first part](Unstructured-IO/unstructured-inference#331) when removing pdfminer (embedded) elements that were merged with inferred elements - bump `unstructured-inference` to 0.7.25 ### Testing PDF: [pwc-financial-statements-p114.pdf](https://github.com/Unstructured-IO/unstructured/files/14707146/pwc-financial-statements-p114.pdf) ``` $ pip uninstall unstructured-inference -y $ git clone -b fix/embedded-text-not-getting-merged-with-inferred-elements [email protected]:Unstructured-IO/unstructured-inference.git && cd unstructured-inference $ pip install -e . ``` ``` elements = partition_pdf( filename="pwc-financial-statements-p114.pdf", strategy="hi_res", infer_table_structure=True, extract_image_block_types=["Image"], ) table_elements = [el for el in elements if el.category == "Table"] print(table_elements[0].text) ``` --------- Co-authored-by: Antonio Jose Jimeno Yepes <[email protected]> Co-authored-by: ryannikolaidis <[email protected]> Co-authored-by: christinestraub <[email protected]>
kaaloo
pushed a commit
to inclusif/unstructured
that referenced
this pull request
Apr 8, 2024
…tured-IO#2679) This PR is the second part of fixing "embedded text not getting merged with inferred elements", the first part is done in Unstructured-IO/unstructured-inference#331. ### Summary - replace `Rectangle.is_in()` with `Rectangle.is_almost_subregion_of()` when removing pdfminer (embedded) elements that were merged with inferred elements - use env_config `EMBEDDED_TEXT_AGGREGATION_SUBREGION_THRESHOLD` introduced in the [first part](Unstructured-IO/unstructured-inference#331) when removing pdfminer (embedded) elements that were merged with inferred elements - bump `unstructured-inference` to 0.7.25 ### Testing PDF: [pwc-financial-statements-p114.pdf](https://github.com/Unstructured-IO/unstructured/files/14707146/pwc-financial-statements-p114.pdf) ``` $ pip uninstall unstructured-inference -y $ git clone -b fix/embedded-text-not-getting-merged-with-inferred-elements [email protected]:Unstructured-IO/unstructured-inference.git && cd unstructured-inference $ pip install -e . ``` ``` elements = partition_pdf( filename="pwc-financial-statements-p114.pdf", strategy="hi_res", infer_table_structure=True, extract_image_block_types=["Image"], ) table_elements = [el for el in elements if el.category == "Table"] print(table_elements[0].text) ``` --------- Co-authored-by: Antonio Jose Jimeno Yepes <[email protected]> Co-authored-by: ryannikolaidis <[email protected]> Co-authored-by: christinestraub <[email protected]>
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.
This PR is the second part of fixing "embedded text not getting merged with inferred elements", the first part is done in Unstructured-IO/unstructured-inference#331.
Summary
Rectangle.is_in()
withRectangle.is_almost_subregion_of()
when removing pdfminer (embedded) elements that were merged with inferred elementsEMBEDDED_TEXT_AGGREGATION_SUBREGION_THRESHOLD
introduced in the first part when removing pdfminer (embedded) elements that were merged with inferred elementsunstructured-inference
to 0.7.25Testing
PDF: pwc-financial-statements-p114.pdf