mirror of
https://github.com/Unstructured-IO/unstructured.git
synced 2025-07-25 18:05:19 +00:00

This PR resolves #1247 by using the matching elements and bbox for coordinate computation. This PR also updates the example doc `example-docs/layout-parser-paper-fast.pdf` so that it includes a true blank page and a page with text "this page is intentionally left blank". This change helps us testing: - differences between fast and hi_res - code handling empty pages in between pages with contents (which triggers the bug found in #1247 ) Lastly, this PR updates the names of the variables inside `_partition_pdf_or_image_with_ocr` so that matching inputs all starts with `_` like `_elements`, `_text`, and `_bboxes` to improve readability. This change also improves partition performance for multi-page pdfs as it reduces the amount of iterations inside `add_pytesseract_bbox_to_elements`. Testing locally on m2 mac + Rocky docker shows it reduces partition time for DA-619p.pdf file from around 1min to around 23s.
Example Docs
The sample docs directory contains the following files:
example-10k.html
- A 10-K SEC filing in HTML formatlayout-parser-paper.pdf
- A PDF copy of the layout parser paperfactbook.xml
/factbook.xsl
- Example XML/XLS files that you can use to test stylesheets
These documents can be used to test out the parsers in the library. In addition, here are instructions for pulling in some sample docs that are too big to store in the repo.
XBRL 10-K
You can get an example 10-K in inline XBRL format using the following curl
. Note, you need
to have the user agent set in the header or the SEC site will reject your request.
curl -O \
-A '${organization} ${email}'
https://www.sec.gov/Archives/edgar/data/311094/000117184321001344/0001171843-21-001344.txt
You can parse this document using the HTML parser.