Skip to content

Fix synthetic Layout wrappers returning 0.0 confidence#447

Open
BahramKBaloch wants to merge 1 commit into
aws-samples:masterfrom
BahramKBaloch:fix/synthetic-layout-confidence
Open

Fix synthetic Layout wrappers returning 0.0 confidence#447
BahramKBaloch wants to merge 1 commit into
aws-samples:masterfrom
BahramKBaloch:fix/synthetic-layout-confidence

Conversation

@BahramKBaloch

@BahramKBaloch BahramKBaloch commented Jun 12, 2026

Copy link
Copy Markdown

Description of changes:
When a Textract entity (TABLE, SIGNATURE, KEY_VALUE, LINE) doesn't spatially overlap an existing LAYOUT element, the parser creates a synthetic Layout wrapper. The Layout constructor's confidence parameter defaults to 0, so layout.confidence returned 0.0 even though the child entity had valid confidence from raw_object["Confidence"].

Pass child entity confidence from raw_object when constructing synthetic layouts in four locations in response_parser.py: signatures, tables, lines (fake layouts when LAYOUT API wasn't called), and key-values.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Pass child entity confidence from raw_object when creating synthetic
Layout wrappers for tables, signatures, lines, and key-values that
lack spatial overlap with existing layout elements.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants