Created
October 2, 2023 11:36
-
-
Save pchalasani/802c91e897b6433551106ec51942a626 to your computer and use it in GitHub Desktop.
unstructured error trace
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
/Users/pchalasani/Git/langroid-examples/.venv/lib/python3.11/site-packages/langroid/parsing/docu │ | |
│ ment_parser.py:301 in iterate_pages │ | |
│ │ | |
│ 298 │ def iterate_pages(self) -> Generator[Tuple[int, Any], None, None]: # type: ignore │ | |
│ 299 │ │ from unstructured.partition.pdf import partition_pdf │ | |
│ 300 │ │ │ | |
│ ❱ 301 │ │ elements = partition_pdf(file=self.doc_bytes, include_page_breaks=True) │ | |
│ 302 │ │ for i, el in enumerate(elements): │ | |
│ 303 │ │ │ yield i, el │ | |
│ 304 │ | |
│ │ | |
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │ | |
│ │ partition_pdf = <function partition_pdf at 0x2bdd9fe20> │ │ | |
│ │ self = <langroid.parsing.document_parser.UnstructuredPDFParser object at │ │ | |
│ │ 0x2904c4a90> │ │ | |
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ | |
│ │ | |
│ /Users/pchalasani/Git/langroid-examples/.venv/lib/python3.11/site-packages/unstructured/document │ | |
│ s/elements.py:276 in wrapper │ | |
│ │ | |
│ 273 │ │ │ | |
│ 274 │ │ @functools.wraps(func) │ | |
│ 275 │ │ def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> List[Element]: │ | |
│ ❱ 276 │ │ │ elements = func(*args, **kwargs) │ | |
│ 277 │ │ │ sig = inspect.signature(func) │ | |
│ 278 │ │ │ params: Dict[str, Any] = dict(**dict(zip(sig.parameters, args)), **kwargs) │ | |
│ 279 │ │ │ for param in sig.parameters.values(): │ | |
│ │ | |
│ ╭────────────────────────────────────── locals ───────────────────────────────────────╮ │ | |
│ │ args = () │ │ | |
│ │ func = <function partition_pdf at 0x2bde5d580> │ │ | |
│ │ kwargs = {'file': <_io.BytesIO object at 0x292e9be70>, 'include_page_breaks': True} │ │ | |
│ ╰─────────────────────────────────────────────────────────────────────────────────────╯ │ | |
│ │ | |
│ /Users/pchalasani/Git/langroid-examples/.venv/lib/python3.11/site-packages/unstructured/file_uti │ | |
│ ls/filetype.py:551 in wrapper │ | |
│ │ | |
│ 548 │ def decorator(func: Callable[_P, List[Element]]) -> Callable[_P, List[Element]]: │ | |
│ 549 │ │ @functools.wraps(func) │ | |
│ 550 │ │ def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> List[Element]: │ | |
│ ❱ 551 │ │ │ elements = func(*args, **kwargs) │ | |
│ 552 │ │ │ sig = inspect.signature(func) │ | |
│ 553 │ │ │ params: Dict[str, Any] = dict(**dict(zip(sig.parameters, args)), **kwargs) │ | |
│ 554 │ │ │ for param in sig.parameters.values(): │ | |
│ │ | |
│ ╭─────────────────────────────────────── locals ────────────────────────────────────────╮ │ | |
│ │ args = () │ │ | |
│ │ filetype = <FileType.PDF: 20> │ │ | |
│ │ func = <function partition_pdf at 0x2bde5d760> │ │ | |
│ │ kwargs = {'file': <_io.BytesIO object at 0x292e9be70>, 'include_page_breaks': True} │ │ | |
│ ╰───────────────────────────────────────────────────────────────────────────────────────╯ │ | |
│ │ | |
│ /Users/pchalasani/Git/langroid-examples/.venv/lib/python3.11/site-packages/unstructured/chunking │ | |
│ /title.py:211 in wrapper │ | |
│ │ | |
│ 208 │ │ │ | |
│ 209 │ │ @functools.wraps(func) │ | |
│ 210 │ │ def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> List[Element]: │ | |
│ ❱ 211 │ │ │ elements = func(*args, **kwargs) │ | |
│ 212 │ │ │ sig = inspect.signature(func) │ | |
│ 213 │ │ │ params: Dict[str, Any] = dict(**dict(zip(sig.parameters, args)), **kwargs) │ | |
│ 214 │ │ │ for param in sig.parameters.values(): │ | |
│ │ | |
│ ╭────────────────────────────────────── locals ───────────────────────────────────────╮ │ | |
│ │ args = () │ │ | |
│ │ func = <function partition_pdf at 0x2bde5d6c0> │ │ | |
│ │ kwargs = {'file': <_io.BytesIO object at 0x292e9be70>, 'include_page_breaks': True} │ │ | |
│ ╰─────────────────────────────────────────────────────────────────────────────────────╯ │ | |
│ │ | |
│ /Users/pchalasani/Git/langroid-examples/.venv/lib/python3.11/site-packages/unstructured/partitio │ | |
│ n/pdf.py:148 in partition_pdf │ | |
│ │ | |
│ 145 │ │ │ │ "Please use languages instead.", │ | |
│ 146 │ │ │ ) │ | |
│ 147 │ │ | |
│ ❱ 148 │ return partition_pdf_or_image( │ | |
│ 149 │ │ filename=filename, │ | |
│ 150 │ │ file=file, │ | |
│ 151 │ │ include_page_breaks=include_page_breaks, │ | |
│ │ | |
│ ╭─────────────────────────── locals ───────────────────────────╮ │ | |
│ │ chunking_strategy = None │ │ | |
│ │ file = <_io.BytesIO object at 0x292e9be70> │ │ | |
│ │ filename = '' │ │ | |
│ │ include_metadata = True │ │ | |
│ │ include_page_breaks = True │ │ | |
│ │ infer_table_structure = False │ │ | |
│ │ kwargs = {} │ │ | |
│ │ languages = ['eng'] │ │ | |
│ │ links = [] │ │ | |
│ │ max_partition = 1500 │ │ | |
│ │ metadata_filename = None │ │ | |
│ │ metadata_last_modified = None │ │ | |
│ │ min_partition = 0 │ │ | |
│ │ ocr_languages = None │ │ | |
│ │ strategy = 'auto' │ │ | |
│ ╰──────────────────────────────────────────────────────────────╯ │ | |
│ │ | |
│ /Users/pchalasani/Git/langroid-examples/.venv/lib/python3.11/site-packages/unstructured/partitio │ | |
│ n/pdf.py:245 in partition_pdf_or_image │ | |
│ │ | |
│ 242 │ │ ) │ | |
│ 243 │ │ != "ocr_only" │ | |
│ 244 │ ): │ | |
│ ❱ 245 │ │ extracted_elements = extractable_elements( │ | |
│ 246 │ │ │ filename=filename, │ | |
│ 247 │ │ │ file=spooled_to_bytes_io_if_needed(file), │ | |
│ 248 │ │ │ include_page_breaks=include_page_breaks, │ | |
│ │ | |
│ ╭─────────────────────────── locals ───────────────────────────╮ │ | |
│ │ file = <_io.BytesIO object at 0x292e9be70> │ │ | |
│ │ filename = '' │ │ | |
│ │ include_page_breaks = True │ │ | |
│ │ infer_table_structure = False │ │ | |
│ │ is_image = False │ │ | |
│ │ kwargs = {} │ │ | |
│ │ languages = ['eng'] │ │ | |
│ │ last_modification_date = None │ │ | |
│ │ max_partition = 1500 │ │ | |
│ │ metadata_last_modified = None │ │ | |
│ │ min_partition = 0 │ │ | |
│ │ ocr_languages = None │ │ | |
│ │ strategy = 'auto' │ │ | |
│ ╰──────────────────────────────────────────────────────────────╯ │ | |
│ │ | |
│ /Users/pchalasani/Git/langroid-examples/.venv/lib/python3.11/site-packages/unstructured/partitio │ | |
│ n/pdf.py:171 in extractable_elements │ | |
│ │ | |
│ 168 ): │ | |
│ 169 │ if isinstance(file, bytes): │ | |
│ 170 │ │ file = io.BytesIO(file) │ | |
│ ❱ 171 │ return _partition_pdf_with_pdfminer( │ | |
│ 172 │ │ filename=filename, │ | |
│ 173 │ │ file=file, │ | |
│ 174 │ │ include_page_breaks=include_page_breaks, │ | |
│ │ | |
│ ╭─────────────────────────── locals ───────────────────────────╮ │ | |
│ │ file = <_io.BytesIO object at 0x292e9be70> │ │ | |
│ │ filename = '' │ │ | |
│ │ include_page_breaks = True │ │ | |
│ │ kwargs = {} │ │ | |
│ │ metadata_last_modified = None │ │ | |
│ ╰──────────────────────────────────────────────────────────────╯ │ | |
│ │ | |
│ /Users/pchalasani/Git/langroid-examples/.venv/lib/python3.11/site-packages/unstructured/utils.py │ | |
│ :159 in wrapper │ | |
│ │ | |
│ 156 │ │ │ │ │ │ else f"Please install them using `pip install {' '.join(missing_ │ | |
│ 157 │ │ │ │ │ ), │ | |
│ 158 │ │ │ │ ) │ | |
│ ❱ 159 │ │ │ return func(*args, **kwargs) │ | |
│ 160 │ │ │ | |
│ 161 │ │ return wrapper │ | |
│ 162 │ | |
│ │ | |
│ ╭─────────────────────────────── locals ────────────────────────────────╮ │ | |
│ │ args = () │ │ | |
│ │ dep = 'pdfminer' │ │ | |
│ │ dependencies = ['pdfminer'] │ │ | |
│ │ extras = 'local-inference' │ │ | |
│ │ func = <function _partition_pdf_with_pdfminer at 0x2bde5db20> │ │ | |
│ │ kwargs = { │ │ | |
│ │ │ 'filename': '', │ │ | |
│ │ │ 'file': <_io.BytesIO object at 0x292e9be70>, │ │ | |
│ │ │ 'include_page_breaks': True, │ │ | |
│ │ │ 'metadata_last_modified': None │ │ | |
│ │ } │ │ | |
│ │ missing_deps = [] │ │ | |
│ ╰───────────────────────────────────────────────────────────────────────╯ │ | |
│ │ | |
│ /Users/pchalasani/Git/langroid-examples/.venv/lib/python3.11/site-packages/unstructured/partitio │ | |
│ n/pdf.py:433 in _partition_pdf_with_pdfminer │ | |
│ │ | |
│ 430 │ │ | |
│ 431 │ elif file: │ | |
│ 432 │ │ fp = cast(BinaryIO, file) │ | |
│ ❱ 433 │ │ elements = _process_pdfminer_pages( │ | |
│ 434 │ │ │ fp=fp, │ | |
│ 435 │ │ │ filename=filename, │ | |
│ 436 │ │ │ include_page_breaks=include_page_breaks, │ | |
│ │ | |
│ ╭─────────────────────────── locals ───────────────────────────╮ │ | |
│ │ file = <_io.BytesIO object at 0x292e9be70> │ │ | |
│ │ filename = '' │ │ | |
│ │ fp = <_io.BytesIO object at 0x292e9be70> │ │ | |
│ │ include_page_breaks = True │ │ | |
│ │ kwargs = {} │ │ | |
│ │ metadata_last_modified = None │ │ | |
│ ╰──────────────────────────────────────────────────────────────╯ │ | |
│ │ | |
│ /Users/pchalasani/Git/langroid-examples/.venv/lib/python3.11/site-packages/unstructured/partitio │ | |
│ n/pdf.py:507 in _process_pdfminer_pages │ | |
│ │ | |
│ 504 │ │ │ │ │ bbox, │ | |
│ 505 │ │ │ │ │ i + 1, │ | |
│ 506 │ │ │ │ ) │ | |
│ ❱ 507 │ │ │ │ _, words = get_word_bounding_box_from_element(obj, height) │ | |
│ 508 │ │ │ │ for annot in annotations_within_element: │ | |
│ 509 │ │ │ │ │ urls_metadata.append(map_bbox_and_index(words, annot)) │ | |
│ 510 │ | |
│ │ | |
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │ | |
│ │ _ = [ │ │ | |
│ │ │ <LTChar 72.000,707.368,76.875,718.348 │ │ | |
│ │ matrix=[1.00,0.00,0.00,1.00, (72.00,709.74)] │ │ | |
│ │ font='TimesNewRomanPSMT' adv=4.87512 text='a'>, │ │ | |
│ │ │ <LTChar 76.875,707.368,82.365,718.348 │ │ | |
│ │ matrix=[1.00,0.00,0.00,1.00, (76.88,709.74)] │ │ | |
│ │ font='TimesNewRomanPSMT' adv=5.49 text='n'>, │ │ | |
│ │ │ <LTChar 82.365,707.368,87.855,718.348 │ │ | |
│ │ matrix=[1.00,0.00,0.00,1.00, (82.37,709.74)] │ │ | |
│ │ font='TimesNewRomanPSMT' adv=5.49 text='d'>, │ │ | |
│ │ │ <LTChar 87.900,707.368,90.645,718.348 │ │ | |
│ │ matrix=[1.00,0.00,0.00,1.00, (87.90,709.74)] │ │ | |
│ │ font='TimesNewRomanPSMT' adv=2.745 text=' '>, │ │ | |
│ │ │ <LTChar 90.660,707.368,96.150,718.348 │ │ | |
│ │ matrix=[1.00,0.00,0.00,1.00, (90.66,709.74)] │ │ | |
│ │ font='TimesNewRomanPSMT' adv=5.49 text='d'>, │ │ | |
│ │ │ <LTChar 96.150,707.368,101.025,718.348 │ │ | |
│ │ matrix=[1.00,0.00,0.00,1.00, (96.15,709.74)] │ │ | |
│ │ font='TimesNewRomanPSMT' adv=4.87512 text='a'>, │ │ | |
│ │ │ <LTChar 101.025,707.368,104.078,718.348 │ │ | |
│ │ matrix=[1.00,0.00,0.00,1.00, (101.03,709.74)] │ │ | |
│ │ font='TimesNewRomanPSMT' adv=3.0524400000000003 text='i'>, │ │ | |
│ │ │ <LTChar 104.078,707.368,107.130,718.348 │ │ | |
│ │ matrix=[1.00,0.00,0.00,1.00, (104.08,709.74)] │ │ | |
│ │ font='TimesNewRomanPSMT' adv=3.0524400000000003 text='l'>, │ │ | |
│ │ │ <LTChar 107.130,707.368,112.620,718.348 │ │ | |
│ │ matrix=[1.00,0.00,0.00,1.00, (107.13,709.74)] │ │ | |
│ │ font='TimesNewRomanPSMT' adv=5.49 text='y'>, │ │ | |
│ │ │ <LTChar 112.700,707.368,115.445,718.348 │ │ | |
│ │ matrix=[1.00,0.00,0.00,1.00, (112.70,709.74)] │ │ | |
│ │ font='TimesNewRomanPSMT' adv=2.745 text=' '>, │ │ | |
│ │ │ ... +387 │ │ | |
│ │ ] │ │ | |
│ │ _text = 'and daily business operations of which are controlled by, one │ │ | |
│ │ or more women who '+316 │ │ | |
│ │ _text_snippets = [ │ │ | |
│ │ │ 'and daily business operations of which are controlled by, │ │ | |
│ │ one or more women who '+321 │ │ | |
│ │ ] │ │ | |
│ │ annot = { │ │ | |
│ │ │ 'coordinates': CoordinatesMetadata( │ │ | |
│ │ │ │ points=( │ │ | |
│ │ │ │ │ (436.57, 97.29999999999995), │ │ | |
│ │ │ │ │ (436.57, 109.95000000000005), │ │ | |
│ │ │ │ │ (514.12, 109.95000000000005), │ │ | |
│ │ │ │ │ (514.12, 97.29999999999995) │ │ | |
│ │ │ │ ), │ │ | |
│ │ │ │ system=<unstructured.documents.coordinates.PixelSpace │ │ | |
│ │ object at 0x2d25c4c50> │ │ | |
│ │ │ ), │ │ | |
│ │ │ 'bbox': ( │ │ | |
│ │ │ │ 436.57, │ │ | |
│ │ │ │ 97.29999999999995, │ │ | |
│ │ │ │ 514.12, │ │ | |
│ │ │ │ 109.95000000000005 │ │ | |
│ │ │ ), │ │ | |
│ │ │ 'type': "/'URI'", │ │ | |
│ │ │ 'uri': │ │ | |
│ │ 'https://www.ecfr.gov/current/title-13/section-127.300', │ │ | |
│ │ │ 'page_number': 56, │ │ | |
│ │ │ 'text': '13 CFR 127 . 300 .', │ │ | |
│ │ │ 'start_index': 283 │ │ | |
│ │ } │ │ | |
│ │ annotation_list = [ │ │ | |
│ │ │ { │ │ | |
│ │ │ │ 'coordinates': CoordinatesMetadata( │ │ | |
│ │ │ │ │ points=( │ │ | |
│ │ │ │ │ │ (401.46, 84.64999999999998), │ │ | |
│ │ │ │ │ │ (401.46, 97.29999999999995), │ │ | |
│ │ │ │ │ │ (479.61, 97.29999999999995), │ │ | |
│ │ │ │ │ │ (479.61, 84.64999999999998) │ │ | |
│ │ │ │ │ ), │ │ | |
│ │ │ │ │ │ │ | |
│ │ system=<unstructured.documents.coordinates.PixelSpace object at │ │ | |
│ │ 0x2d25c4c50> │ │ | |
│ │ │ │ ), │ │ | |
│ │ │ │ 'bbox': ( │ │ | |
│ │ │ │ │ 401.46, │ │ | |
│ │ │ │ │ 84.64999999999998, │ │ | |
│ │ │ │ │ 479.61, │ │ | |
│ │ │ │ │ 97.29999999999995 │ │ | |
│ │ │ │ ), │ │ | |
│ │ │ │ 'type': "/'URI'", │ │ | |
│ │ │ │ 'uri': │ │ | |
│ │ 'https://www.ecfr.gov/current/title-13/part-127', │ │ | |
│ │ │ │ 'page_number': 56, │ │ | |
│ │ │ │ 'text': '13 CFR part 127 ,', │ │ | |
│ │ │ │ 'start_index': 173 │ │ | |
│ │ │ }, │ │ | |
│ │ │ { │ │ | |
│ │ │ │ 'coordinates': CoordinatesMetadata( │ │ | |
│ │ │ │ │ points=( │ │ | |
│ │ │ │ │ │ (436.57, 97.29999999999995), │ │ | |
│ │ │ │ │ │ (436.57, 109.95000000000005), │ │ | |
│ │ │ │ │ │ (514.12, 109.95000000000005), │ │ | |
│ │ │ │ │ │ (514.12, 97.29999999999995) │ │ | |
│ │ │ │ │ ), │ │ | |
│ │ │ │ │ │ │ | |
│ │ system=<unstructured.documents.coordinates.PixelSpace object at │ │ | |
│ │ 0x2d25c4c50> │ │ | |
│ │ │ │ ), │ │ | |
│ │ │ │ 'bbox': ( │ │ | |
│ │ │ │ │ 436.57, │ │ | |
│ │ │ │ │ 97.29999999999995, │ │ | |
│ │ │ │ │ 514.12, │ │ | |
│ │ │ │ │ 109.95000000000005 │ │ | |
│ │ │ │ ), │ │ | |
│ │ │ │ 'type': "/'URI'", │ │ | |
│ │ │ │ 'uri': │ │ | |
│ │ 'https://www.ecfr.gov/current/title-13/section-127.300', │ │ | |
│ │ │ │ 'page_number': 56, │ │ | |
│ │ │ │ 'text': '13 CFR 127 . 300 .', │ │ | |
│ │ │ │ 'start_index': 283 │ │ | |
│ │ │ }, │ │ | |
│ │ │ { │ │ | |
│ │ │ │ 'coordinates': CoordinatesMetadata( │ │ | |
│ │ │ │ │ points=( │ │ | |
│ │ │ │ │ │ (383.03, 293.79), │ │ | |
│ │ │ │ │ │ (383.03, 306.44), │ │ | |
│ │ │ │ │ │ (460.26, 306.44), │ │ | |
│ │ │ │ │ │ (460.26, 293.79) │ │ | |
│ │ │ │ │ ), │ │ | |
│ │ │ │ │ │ │ | |
│ │ system=<unstructured.documents.coordinates.PixelSpace object at │ │ | |
│ │ 0x2d25c4c50> │ │ | |
│ │ │ │ ), │ │ | |
│ │ │ │ 'bbox': (383.03, 293.79, 460.26, 306.44), │ │ | |
│ │ │ │ 'type': "/'URI'", │ │ | |
│ │ │ │ 'uri': │ │ | |
│ │ 'http://uscode.house.gov/browse.xhtml;jsessionid=114A3287C7B33… │ │ | |
│ │ │ │ 'page_number': 56 │ │ | |
│ │ │ }, │ │ | |
│ │ │ { │ │ | |
│ │ │ │ 'coordinates': CoordinatesMetadata( │ │ | |
│ │ │ │ │ points=( │ │ | |
│ │ │ │ │ │ (242.93, 306.44), │ │ | |
│ │ │ │ │ │ (242.93, 333.08), │ │ | |
│ │ │ │ │ │ (325.65, 333.08), │ │ | |
│ │ │ │ │ │ (325.65, 306.44) │ │ | |
│ │ │ │ │ ), │ │ | |
│ │ │ │ │ │ │ | |
│ │ system=<unstructured.documents.coordinates.PixelSpace object at │ │ | |
│ │ 0x2d25c4c50> │ │ | |
│ │ │ │ ), │ │ | |
│ │ │ │ 'bbox': (242.93, 306.44, 325.65, 333.08), │ │ | |
│ │ │ │ 'type': "/'URI'", │ │ | |
│ │ │ │ 'uri': │ │ | |
│ │ 'http://uscode.house.gov/browse.xhtml;jsessionid=114A3287C7B33… │ │ | |
│ │ │ │ 'page_number': 56 │ │ | |
│ │ │ }, │ │ | |
│ │ │ { │ │ | |
│ │ │ │ 'coordinates': CoordinatesMetadata( │ │ | |
│ │ │ │ │ points=( │ │ | |
│ │ │ │ │ │ (456.18, 372.38), │ │ | |
│ │ │ │ │ │ (456.18, 385.03), │ │ | |
│ │ │ │ │ │ (542.25, 385.03), │ │ | |
│ │ │ │ │ │ (542.25, 372.38) │ │ | |
│ │ │ │ │ ), │ │ | |
│ │ │ │ │ │ │ | |
│ │ system=<unstructured.documents.coordinates.PixelSpace object at │ │ | |
│ │ 0x2d25c4c50> │ │ | |
│ │ │ │ ), │ │ | |
│ │ │ │ 'bbox': (456.18, 372.38, 542.25, 385.03), │ │ | |
│ │ │ │ 'type': "/'URI'", │ │ | |
│ │ │ │ 'uri': │ │ | |
│ │ 'https://www.ecfr.gov/current/title-13/part-121', │ │ | |
│ │ │ │ 'page_number': 56 │ │ | |
│ │ │ }, │ │ | |
│ │ │ { │ │ | |
│ │ │ │ 'coordinates': CoordinatesMetadata( │ │ | |
│ │ │ │ │ points=( │ │ | |
│ │ │ │ │ │ (69.75, 385.03), │ │ | |
│ │ │ │ │ │ (69.75, 411.68), │ │ | |
│ │ │ │ │ │ (90.75, 411.68), │ │ | |
│ │ │ │ │ │ (90.75, 385.03) │ │ | |
│ │ │ │ │ ), │ │ | |
│ │ │ │ │ │ │ | |
│ │ system=<unstructured.documents.coordinates.PixelSpace object at │ │ | |
│ │ 0x2d25c4c50> │ │ | |
│ │ │ │ ), │ │ | |
│ │ │ │ 'bbox': (69.75, 385.03, 90.75, 411.68), │ │ | |
│ │ │ │ 'type': "/'URI'", │ │ | |
│ │ │ │ 'uri': │ │ | |
│ │ 'https://www.ecfr.gov/current/title-13/part-121', │ │ | |
│ │ │ │ 'page_number': 56 │ │ | |
│ │ │ } │ │ | |
│ │ ] │ │ | |
│ │ annotations_within_element = [] │ │ | |
│ │ bbox = (84.0, 138.29167999999993, 353.185, 149.27167999999995) │ │ | |
│ │ coordinate_system = <unstructured.documents.coordinates.PixelSpace object at │ │ | |
│ │ 0x2d25c4c50> │ │ | |
│ │ coordinates_metadata = CoordinatesMetadata( │ │ | |
│ │ │ points=( │ │ | |
│ │ │ │ (72.0, 73.65167999999994), │ │ | |
│ │ │ │ (72.0, 122.55167999999992), │ │ | |
│ │ │ │ (526.885, 122.55167999999992), │ │ | |
│ │ │ │ (526.885, 73.65167999999994) │ │ | |
│ │ │ ), │ │ | |
│ │ │ system=<unstructured.documents.coordinates.PixelSpace │ │ | |
│ │ object at 0x2d25c4c50> │ │ | |
│ │ ) │ │ | |
│ │ device = <PDFDevice> │ │ | |
│ │ element = <unstructured.documents.elements.NarrativeText object at │ │ | |
│ │ 0x2d21631d0> │ │ | |
│ │ elements = [ │ │ | |
│ │ │ <unstructured.documents.elements.NarrativeText object at │ │ | |
│ │ 0x2d20f3f50>, │ │ | |
│ │ │ <unstructured.documents.elements.Text object at │ │ | |
│ │ 0x2d20f9f50>, │ │ | |
│ │ │ <unstructured.documents.elements.ListItem object at │ │ | |
│ │ 0x2bfeb95d0>, │ │ | |
│ │ │ <unstructured.documents.elements.ListItem object at │ │ | |
│ │ 0x2bfeb95d0>, │ │ | |
│ │ │ <unstructured.documents.elements.Title object at │ │ | |
│ │ 0x2d20fb110>, │ │ | |
│ │ │ <unstructured.documents.elements.Title object at │ │ | |
│ │ 0x2d20fb190>, │ │ | |
│ │ │ <unstructured.documents.elements.NarrativeText object at │ │ | |
│ │ 0x2d2102b50>, │ │ | |
│ │ │ <unstructured.documents.elements.NarrativeText object at │ │ | |
│ │ 0x2d210a990>, │ │ | |
│ │ │ <unstructured.documents.elements.NarrativeText object at │ │ | |
│ │ 0x2d2103f50>, │ │ | |
│ │ │ <unstructured.documents.elements.NarrativeText object at │ │ | |
│ │ 0x2d2114050>, │ │ | |
│ │ │ ... +981 │ │ | |
│ │ ] │ │ | |
│ │ filename = '' │ │ | |
│ │ fp = <_io.BytesIO object at 0x292e9be70> │ │ | |
│ │ height = 792 │ │ | |
│ │ i = 55 │ │ | |
│ │ include_page_breaks = True │ │ | |
│ │ interpreter = <pdfminer.pdfinterp.PDFPageInterpreter object at 0x2bfaf2d10> │ │ | |
│ │ kwargs = {} │ │ | |
│ │ laparams = <LAParams: char_margin=2.0, line_margin=0.5, word_margin=0.1 │ │ | |
│ │ all_texts=False> │ │ | |
│ │ links = [ │ │ | |
│ │ │ { │ │ | |
│ │ │ │ 'text': '13 CFR part 127 ,', │ │ | |
│ │ │ │ 'url': │ │ | |
│ │ 'https://www.ecfr.gov/current/title-13/part-127', │ │ | |
│ │ │ │ 'start_index': 172 │ │ | |
│ │ │ }, │ │ | |
│ │ │ { │ │ | |
│ │ │ │ 'text': '13 CFR 127 . 300 .', │ │ | |
│ │ │ │ 'url': │ │ | |
│ │ 'https://www.ecfr.gov/current/title-13/section-127.300', │ │ | |
│ │ │ │ 'start_index': 281 │ │ | |
│ │ │ } │ │ | |
│ │ ] │ │ | |
│ │ list_item = 0 │ │ | |
│ │ list_item_coords = CoordinatesMetadata( │ │ | |
│ │ │ points=( │ │ | |
│ │ │ │ (72.0, 378.7658), │ │ | |
│ │ │ │ (72.0, 389.81168), │ │ | |
│ │ │ │ (505.7467200000001, 389.81168), │ │ | |
│ │ │ │ (505.7467200000001, 378.7658) │ │ | |
│ │ │ ), │ │ | |
│ │ │ system=<unstructured.documents.coordinates.PixelSpace │ │ | |
│ │ object at 0x2d246dad0> │ │ | |
│ │ ) │ │ | |
│ │ list_item_text = '8. Does the applicant or awardee have an owner, officer, or │ │ | |
│ │ covered individual t'+104 │ │ | |
│ │ list_page_element = <unstructured.documents.elements.ListItem object at │ │ | |
│ │ 0x2bfd057d0> │ │ | |
│ │ metadata_last_modified = None │ │ | |
│ │ moved_indices = array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., │ │ | |
│ │ 0., 0., 0., │ │ | |
│ │ │ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., │ │ | |
│ │ 0., 0., 0., │ │ | |
│ │ │ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., │ │ | |
│ │ 0., 0., 0., │ │ | |
│ │ │ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., │ │ | |
│ │ 0., 0., 0., │ │ | |
│ │ │ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., │ │ | |
│ │ 0., 0., 0., │ │ | |
│ │ │ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., │ │ | |
│ │ 0., 1., 1., │ │ | |
│ │ │ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., │ │ | |
│ │ 1., 1., 1., │ │ | |
│ │ │ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., │ │ | |
│ │ 1., 1., 1., │ │ | |
│ │ │ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., │ │ | |
│ │ 1., 1., 1., │ │ | |
│ │ │ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., │ │ | |
│ │ 1., 1., 1., │ │ | |
│ │ │ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., │ │ | |
│ │ 1., 1., 1., │ │ | |
│ │ │ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 2., 2., 2., 2., │ │ | |
│ │ 2., 2., 2., │ │ | |
│ │ │ 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., │ │ | |
│ │ 2., 2., 2., │ │ | |
│ │ │ 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., │ │ | |
│ │ 2., 2., 2., │ │ | |
│ │ │ 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., │ │ | |
│ │ 2., 2., 2., │ │ | |
│ │ │ 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., │ │ | |
│ │ 2., 2., 2., │ │ | |
│ │ │ 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., │ │ | |
│ │ 2., 2., 2., │ │ | |
│ │ │ 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., 3., 3., 3., │ │ | |
│ │ 3., 3., 3., │ │ | |
│ │ │ 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., │ │ | |
│ │ 3., 3., 3., │ │ | |
│ │ │ 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., │ │ | |
│ │ 3., 3., 3., │ │ | |
│ │ │ 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., │ │ | |
│ │ 3., 3., 3., │ │ | |
│ │ │ 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., │ │ | |
│ │ 3., 3., 3., │ │ | |
│ │ │ 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., 3., │ │ | |
│ │ 3., 3., 3., │ │ | |
│ │ │ 3., 3., 3., 3., 3., 3., 3., 3., 3., 3.]) │ │ | |
│ │ obj = <LTTextBoxHorizontal(1) 84.000,642.728,353.185,653.708 ' │ │ | |
│ │ Service-disabled veteran-owned small business concern- \n'> │ │ | |
│ │ page = <PDFPage: Resources={'ExtGState': {'GS7': <PDFObjRef:1911>, │ │ | |
│ │ 'GS8': <PDFObjRef:1912>}, 'Font': {'F1': <PDFObjRef:1915>, │ │ | |
│ │ 'F3': <PDFObjRef:1924>, 'F9': <PDFObjRef:1203>}, 'ProcSet': │ │ | |
│ │ [/'PDF', /'Text', /'ImageB', /'ImageC', /'ImageI']}, │ │ | |
│ │ MediaBox=[0, 0, 612, 792]> │ │ | |
│ │ page_element = <unstructured.documents.elements.Text object at 0x2d2289c90> │ │ | |
│ │ page_elements = [ │ │ | |
│ │ │ <unstructured.documents.elements.NarrativeText object at │ │ | |
│ │ 0x2d21631d0> │ │ | |
│ │ ] │ │ | |
│ │ page_layout = <LTPage(56) 0.000,0.000,612.000,792.000 rotate=0> │ │ | |
│ │ points = ( │ │ | |
│ │ │ (72.0, 73.65167999999994), │ │ | |
│ │ │ (72.0, 122.55167999999992), │ │ | |
│ │ │ (526.885, 122.55167999999992), │ │ | |
│ │ │ (526.885, 73.65167999999994) │ │ | |
│ │ ) │ │ | |
│ │ rsrcmgr = <pdfminer.pdfinterp.PDFResourceManager object at 0x2bfaf2810> │ │ | |
│ │ sort_mode = 'xy-cut' │ │ | |
│ │ sorted_page_elements = [ │ │ | |
│ │ │ <unstructured.documents.elements.Title object at │ │ | |
│ │ 0x2d23f00d0>, │ │ | |
│ │ │ <unstructured.documents.elements.Text object at │ │ | |
│ │ 0x2d21974d0>, │ │ | |
│ │ │ <unstructured.documents.elements.Title object at │ │ | |
│ │ 0x2d2162650>, │ │ | |
│ │ │ <unstructured.documents.elements.NarrativeText object at │ │ | |
│ │ 0x2d2558c90>, │ │ | |
│ │ │ <unstructured.documents.elements.NarrativeText object at │ │ | |
│ │ 0x2bfe4f310>, │ │ | |
│ │ │ <unstructured.documents.elements.Title object at │ │ | |
│ │ 0x2d2302690>, │ │ | |
│ │ │ <unstructured.documents.elements.Title object at │ │ | |
│ │ 0x2bfd0bdd0>, │ │ | |
│ │ │ <unstructured.documents.elements.Title object at │ │ | |
│ │ 0x2bfbb6510>, │ │ | |
│ │ │ <unstructured.documents.elements.Title object at │ │ | |
│ │ 0x2d219b990>, │ │ | |
│ │ │ <unstructured.documents.elements.Title object at │ │ | |
│ │ 0x2bfc43cd0>, │ │ | |
│ │ │ ... +8 │ │ | |
│ │ ] │ │ | |
│ │ text = 'affiliation with a research institution located in a foreign │ │ | |
│ │ country of concern?'+6 │ │ | |
│ │ url = { │ │ | |
│ │ │ 'coordinates': CoordinatesMetadata( │ │ | |
│ │ │ │ points=( │ │ | |
│ │ │ │ │ (436.57, 97.29999999999995), │ │ | |
│ │ │ │ │ (436.57, 109.95000000000005), │ │ | |
│ │ │ │ │ (514.12, 109.95000000000005), │ │ | |
│ │ │ │ │ (514.12, 97.29999999999995) │ │ | |
│ │ │ │ ), │ │ | |
│ │ │ │ system=<unstructured.documents.coordinates.PixelSpace │ │ | |
│ │ object at 0x2d25c4c50> │ │ | |
│ │ │ ), │ │ | |
│ │ │ 'bbox': ( │ │ | |
│ │ │ │ 436.57, │ │ | |
│ │ │ │ 97.29999999999995, │ │ | |
│ │ │ │ 514.12, │ │ | |
│ │ │ │ 109.95000000000005 │ │ | |
│ │ │ ), │ │ | |
│ │ │ 'type': "/'URI'", │ │ | |
│ │ │ 'uri': │ │ | |
│ │ 'https://www.ecfr.gov/current/title-13/section-127.300', │ │ | |
│ │ │ 'page_number': 56, │ │ | |
│ │ │ 'text': '13 CFR 127 . 300 .', │ │ | |
│ │ │ 'start_index': 283 │ │ | |
│ │ } │ │ | |
│ │ urls_metadata = [] │ │ | |
│ │ width = 612 │ │ | |
│ │ words = [ │ │ | |
│ │ │ { │ │ | |
│ │ │ │ 'text': 'and', │ │ | |
│ │ │ │ 'bbox': ( │ │ | |
│ │ │ │ │ 72.0, │ │ | |
│ │ │ │ │ 73.65167999999994, │ │ | |
│ │ │ │ │ 87.85512, │ │ | |
│ │ │ │ │ 84.63167999999996 │ │ | |
│ │ │ │ ), │ │ | |
│ │ │ │ 'start_index': 0 │ │ | |
│ │ │ }, │ │ | |
│ │ │ { │ │ | |
│ │ │ │ 'text': 'daily', │ │ | |
│ │ │ │ 'bbox': ( │ │ | |
│ │ │ │ │ 90.66, │ │ | |
│ │ │ │ │ 73.65167999999994, │ │ | |
│ │ │ │ │ 112.61999999999999, │ │ | |
│ │ │ │ │ 84.63167999999996 │ │ | |
│ │ │ │ ), │ │ | |
│ │ │ │ 'start_index': 4 │ │ | |
│ │ │ }, │ │ | |
│ │ │ { │ │ | |
│ │ │ │ 'text': 'business', │ │ | |
│ │ │ │ 'bbox': ( │ │ | |
│ │ │ │ │ 115.46, │ │ | |
│ │ │ │ │ 73.65167999999994, │ │ | |
│ │ │ │ │ 152.67122, │ │ | |
│ │ │ │ │ 84.63167999999996 │ │ | |
│ │ │ │ ), │ │ | |
│ │ │ │ 'start_index': 10 │ │ | |
│ │ │ }, │ │ | |
│ │ │ { │ │ | |
│ │ │ │ 'text': 'operations', │ │ | |
│ │ │ │ 'bbox': ( │ │ | |
│ │ │ │ │ 155.42, │ │ | |
│ │ │ │ │ 73.65167999999994, │ │ | |
│ │ │ │ │ 201.23954, │ │ | |
│ │ │ │ │ 84.63167999999996 │ │ | |
│ │ │ │ ), │ │ | |
│ │ │ │ 'start_index': 19 │ │ | |
│ │ │ }, │ │ | |
│ │ │ { │ │ | |
│ │ │ │ 'text': 'of', │ │ | |
│ │ │ │ 'bbox': ( │ │ | |
│ │ │ │ │ 204.02, │ │ | |
│ │ │ │ │ 73.65167999999994, │ │ | |
│ │ │ │ │ 213.19634000000002, │ │ | |
│ │ │ │ │ 84.63167999999996 │ │ | |
│ │ │ │ ), │ │ | |
│ │ │ │ 'start_index': 30 │ │ | |
│ │ │ }, │ │ | |
│ │ │ { │ │ | |
│ │ │ │ 'text': 'which', │ │ | |
│ │ │ │ 'bbox': ( │ │ | |
│ │ │ │ │ 215.96, │ │ | |
│ │ │ │ │ 73.65167999999994, │ │ | |
│ │ │ │ │ 242.79512000000003, │ │ | |
│ │ │ │ │ 84.63167999999996 │ │ | |
│ │ │ │ ), │ │ | |
│ │ │ │ 'start_index': 33 │ │ | |
│ │ │ }, │ │ | |
│ │ │ { │ │ | |
│ │ │ │ 'text': 'are', │ │ | |
│ │ │ │ 'bbox': ( │ │ | |
│ │ │ │ │ 245.6, │ │ | |
│ │ │ │ │ 73.65167999999994, │ │ | |
│ │ │ │ │ 259.00658, │ │ | |
│ │ │ │ │ 84.63167999999996 │ │ | |
│ │ │ │ ), │ │ | |
│ │ │ │ 'start_index': 39 │ │ | |
│ │ │ }, │ │ | |
│ │ │ { │ │ | |
│ │ │ │ 'text': 'controlled', │ │ | |
│ │ │ │ 'bbox': ( │ │ | |
│ │ │ │ │ 261.74, │ │ | |
│ │ │ │ │ 73.65167999999994, │ │ | |
│ │ │ │ │ 306.32978, │ │ | |
│ │ │ │ │ 84.63167999999996 │ │ | |
│ │ │ │ ), │ │ | |
│ │ │ │ 'start_index': 43 │ │ | |
│ │ │ }, │ │ | |
│ │ │ { │ │ | |
│ │ │ │ 'text': 'by', │ │ | |
│ │ │ │ 'bbox': ( │ │ | |
│ │ │ │ │ 309.08, │ │ | |
│ │ │ │ │ 73.65167999999994, │ │ | |
│ │ │ │ │ 320.09, │ │ | |
│ │ │ │ │ 84.63167999999996 │ │ | |
│ │ │ │ ), │ │ | |
│ │ │ │ 'start_index': 54 │ │ | |
│ │ │ }, │ │ | |
│ │ │ { │ │ | |
│ │ │ │ 'text': ',', │ │ | |
│ │ │ │ 'bbox': ( │ │ | |
│ │ │ │ │ 320.12, │ │ | |
│ │ │ │ │ 73.65167999999994, │ │ | |
│ │ │ │ │ 322.865, │ │ | |
│ │ │ │ │ 84.63167999999996 │ │ | |
│ │ │ │ ), │ │ | |
│ │ │ │ 'start_index': 56 │ │ | |
│ │ │ }, │ │ | |
│ │ │ ... +67 │ │ | |
│ │ ] │ │ | |
│ │ x1 = 84.0 │ │ | |
│ │ x2 = 353.185 │ │ | |
│ │ y1 = 138.29167999999993 │ │ | |
│ │ y2 = 149.27167999999995 │ │ | |
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ | |
│ │ | |
│ /Users/pchalasani/Git/langroid-examples/.venv/lib/python3.11/site-packages/unstructured/partitio │ | |
│ n/pdf.py:1004 in get_word_bounding_box_from_element │ | |
│ │ | |
│ 1001 │ │ │ │ if index == 0: │ | |
│ 1002 │ │ │ │ │ isalnum = char.isalnum() │ | |
│ 1003 │ │ │ │ │ | |
│ ❱ 1004 │ │ │ │ if char.isalnum() != isalnum: │ | |
│ 1005 │ │ │ │ │ isalnum = char.isalnum() │ | |
│ 1006 │ │ │ │ │ words.append( │ | |
│ 1007 │ │ │ │ │ │ {"text": word, "bbox": (x1, y1, x2, y2), "start_index": start_in │ | |
│ │ | |
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │ | |
│ │ char = 'S' │ │ | |
│ │ character = <LTChar 100.560,642.728,106.050,653.708 matrix=[1.00,0.00,0.00,1.00, │ │ | |
│ │ (100.56,645.10)] font='TimesNewRomanPS-ItalicMT' adv=5.49 text='S'> │ │ | |
│ │ characters = [ │ │ | |
│ │ │ <LTChar 84.000,642.728,86.745,653.708 matrix=[1.00,0.00,0.00,1.00, │ │ | |
│ │ (84.00,645.10)] font='TimesNewRomanPSMT' adv=2.745 text=' '>, │ │ | |
│ │ │ <LTChar 86.760,642.728,89.505,653.708 matrix=[1.00,0.00,0.00,1.00, │ │ | |
│ │ (86.76,645.10)] font='TimesNewRomanPSMT' adv=2.745 text=' '>, │ │ | |
│ │ │ <LTChar 89.520,642.728,92.265,653.708 matrix=[1.00,0.00,0.00,1.00, │ │ | |
│ │ (89.52,645.10)] font='TimesNewRomanPSMT' adv=2.745 text=' '>, │ │ | |
│ │ │ <LTChar 92.280,642.728,95.025,653.708 matrix=[1.00,0.00,0.00,1.00, │ │ | |
│ │ (92.28,645.10)] font='TimesNewRomanPSMT' adv=2.745 text=' '>, │ │ | |
│ │ │ <LTChar 95.040,642.728,97.785,653.708 matrix=[1.00,0.00,0.00,1.00, │ │ | |
│ │ (95.04,645.10)] font='TimesNewRomanPSMT' adv=2.745 text=' '>, │ │ | |
│ │ │ <LTChar 97.800,642.728,100.545,653.708 matrix=[1.00,0.00,0.00,1.00, │ │ | |
│ │ (97.80,645.10)] font='TimesNewRomanPSMT' adv=2.745 text=' '>, │ │ | |
│ │ │ <LTChar 100.560,642.728,106.050,653.708 matrix=[1.00,0.00,0.00,1.00, │ │ | |
│ │ (100.56,645.10)] font='TimesNewRomanPS-ItalicMT' adv=5.49 text='S'> │ │ | |
│ │ ] │ │ | |
│ │ height = 792 │ │ | |
│ │ index = 6 │ │ | |
│ │ obj = <LTTextBoxHorizontal(1) 84.000,642.728,353.185,653.708 ' Service-disabled │ │ | |
│ │ veteran-owned small business concern- \n'> │ │ | |
│ │ start_index = 0 │ │ | |
│ │ text_len = 0 │ │ | |
│ │ text_line = <LTTextLineHorizontal 84.000,642.728,353.185,653.708 ' Service-disabled │ │ | |
│ │ veteran-owned small business concern- \n'> │ │ | |
│ │ word = '' │ │ | |
│ │ words = [ │ │ | |
│ │ │ {'text': '', 'bbox': (None, None, None, None), 'start_index': 0}, │ │ | |
│ │ │ {'text': '', 'bbox': (None, None, None, None), 'start_index': 0}, │ │ | |
│ │ │ {'text': '', 'bbox': (None, None, None, None), 'start_index': 0}, │ │ | |
│ │ │ {'text': '', 'bbox': (None, None, None, None), 'start_index': 0}, │ │ | |
│ │ │ {'text': '', 'bbox': (None, None, None, None), 'start_index': 0}, │ │ | |
│ │ │ {'text': '', 'bbox': (None, None, None, None), 'start_index': 0} │ │ | |
│ │ ] │ │ | |
│ │ x1 = None │ │ | |
│ │ x2 = None │ │ | |
│ │ y1 = None │ │ | |
│ │ y2 = None │ │ | |
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ | |
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ | |
UnboundLocalError: cannot access local variable 'isalnum' where it is not associated with a value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment