googleapis / python-documentai-toolbox

Document AI Toolbox is an SDK for Python that provides utility functions for managing, manipulating, and extracting information from the document response. It creates a "wrapped" document object from JSON files in Cloud Storage, local JSON files, or output directly from the Document AI API.
https://cloud.google.com/document-ai/docs/toolbox
Apache License 2.0
33 stars 13 forks source link

fix: Change `if` condition typo in `_get_children_of_element()` #313

Closed holtskinner closed 1 month ago

holtskinner commented 1 month ago

The previous if condition was inefficient and should have been written with an and This resulted in a performance gap.

cProfile timing of export_hocr_string() on the same document

Before

143598720 function calls (129111346 primitive calls) in 44.487 seconds

After

97883150 function calls (88084552 primitive calls) in 30.235 seconds

Fixes #312 🦕