aws-samples / aws-samples/amazon-textract-textractor

Exporting text+tables while maintaining layout

Open
#347 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
493
Forks
163
PR merge metrics
No merged PRs in 30d

Description

Supposed I have a document like this:

```

```
Where a table is located between two chunks of text, and I'd like to parse the document and save the parsed information, in order, to a text file.

If I use the `document_analysis` functionality, I can successfully extract the text and tables, and print them separately:

```python
document = extractor.start_document_analysis(
file_source=LOCAL_DOCUMENT_PATH,
s3_upload_path=S3_UPLOAD_PATH,
features=[TextractFeatures.LAYOUT, TextractFeatures.SIGNATURES, TextractFeatures.FORMS],
save_image=True
)

print(document.text)
print(document.tables)
```

However, this loses information about the layout (i.e., that in my example, the table is in between two pieces of text).

So how can I print the parsed text+tables _in order_? As in something like:

`print(document.text_and_tables)`

Is there any convenience functionality in this library to do this?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.