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

Incorrect table cell word and line order

Open
#369 3 comments 0 reactions 1 assignee Claimed by @Belval View on GitHub
bug enhancement
Dominant language
Jupyter Notebook
Stars
493
Forks
163
PR merge metrics
No merged PRs in 30d

Description

Hello, this issue seems very similar to #136 , but I just can't make it work: the word and line order inside table cells is not preserved when invoking the get_text method.

The json attached is a reslt of running Textract `start_document_analysis` with parameters `[TextractFeatures.TABLES, TextractFeatures.LAYOUT]`.

When running
```python
import json

import textractor
from textractor.entities.document import Document

j = json.load(open('../data/processed/6e2ab4b2a234e0410205db117803203a1be55a3fc766d56083c62512d71e556e.json'))

doc = Document.open(j)
print(doc.tables[1].get_text())

print(textractor.__version__)
```
I get as output for example
```
...
of adolescent and girls

6.1.2.4 the Ensure
...
```
But the actual lines are "of adolescent girls and" and "6.1.2.4 Ensure the" and the line order is different.

Blocks seem fine and the child order in "Relationships" also seem correct.

What am i doing wrong?

[6e2ab4b2a234e0410205db117803203a1be55a3fc766d56083c62512d71e556e.json](https://github.com/aws-samples/amazon-textract-textractor/files/15457433/6e2ab4b2a234e0410205db117803203a1be55a3fc766d56083c62512d71e556e.json)

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.