Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Example code is parsing pages, but intends to parse paragraphs #145

Closed
dgallegos opened this issue May 14, 2021 · 1 comment · Fixed by #147
Closed

Example code is parsing pages, but intends to parse paragraphs #145

dgallegos opened this issue May 14, 2021 · 1 comment · Fixed by #147
Labels
api: documentai Issues related to the googleapis/python-documentai API. 🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@dgallegos
Copy link
Contributor

dgallegos commented May 14, 2021

The following code in

           # Read the text recognition output from the processor
            for page in document.pages:
                for form_field in page.form_fields:
                    field_name = get_text(form_field.field_name, document)
                    field_value = get_text(form_field.field_value, document)
                    print("Extracted key value pair:")
                    print(f"\t{field_name}, {field_value}")
                for paragraph in document.pages:
                    paragraph_text = get_text(paragraph.layout, document)
                    print(f"Paragraph text:\n{paragraph_text}") 

code intention, that matches the "Upload Test Document" functionality should be

            for page in document.pages:
                for form_field in page.form_fields:
                    field_name = get_text(form_field.field_name, document)
                    field_value = get_text(form_field.field_value, document)
                    print("Extracted key value pair:")
                    print(f"\t{field_name}, {field_value}")
                for paragraph in page.paragraphs:
                    paragraph_text = get_text(paragraph.layout, document)
                    print(f"Paragraph text:\n{paragraph_text}") 

Reference: #147

@product-auto-label product-auto-label bot added the api: documentai Issues related to the googleapis/python-documentai API. label May 14, 2021
@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels May 14, 2021
@munkhuushmgl
Copy link
Contributor

@dgallegos Thanks for filing and fixing this bug.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: documentai Issues related to the googleapis/python-documentai API. 🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
3 participants