aws-samples / aws-samples/amazon-textract-textractor
Exporting text+tables while maintaining layout
- 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
Assessment
This issue has not been assessed yet.