A parser for Amazon Textract results that converts the raw JSON response into a structured document model with pages, lines, words, tables, and forms. Version 0.1.3 (latest as of verification) supports Python >=3.6. The library provides high-level abstractions for navigating Textract output, including bounding boxes, confidence scores, and relationships between elements. It is maintained on GitHub by mludvig.
pip install textract-trpVerified import paths — ran on the pinned version, not inferred.
Parse Amazon Textract output into a structured document with pages, lines, tables, and forms.
Loop over responses by passing NextToken from previous response until NextToken is missing.
Always use 'pip install textract-trp'. Do not confuse with 'textract' (general OCR) or 'amazon-textract-textractor'.
Ensure you pass the response object directly from the boto3 client call, e.g., result = client.analyze_document(...); document = parser.parse(result).
Use .text property on line and word objects. For plain list of strings, use list comprehension: [line.text for line in page.lines].