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

Mistake a text field above a table as table title

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

Description

# Problem

Mistaking a text field as table title.

image

## Environment

```
import textractor
textractor.__version__
-----
'1.7.4'

from platform import python_version
print(python_version())
-----
3..10.10
```

## Reproduction

```
import os
import pathlib
from textractor import Textractor
from textractor.data.constants import TextractFeatures
import textractor

textractor.__version__

from platform import python_version
print(python_version())

DATA_DIR=pathlib.Path.home().joinpath("home/repository/data/ml/medical_report/pdf")
FILEPATH=DATA_DIR.joinpath("MedicalExaminerReportExample_13.pdf")

extractor = Textractor(profile_name="eml-ap-southeast-2")
document = extractor.analyze_document(
file_source=str(FILEPATH),
features=[
TextractFeatures.LAYOUT,
TextractFeatures.FORMS,
TextractFeatures.TABLES
],
save_image=True, # To use images property and visualize of the document instance.
)

table = document.tables[0]
table.visualize()

print(table.title.text)
-----
'Addendum: On 02/28/2012 at approximately 1230 hours, FI Malphurs received a fax from Sanford Police Department confirming positive identification as: Trayvon Martin, 17yoa B/M, DOB: 02/05/1995. The Identification was made by his father from a crime scene photograph. ECC and MEO staff were notified and an Identification sheet was completed. TSM'
```

## PDF

* [MedicalExaminerReportExample_13.pdf](https://github.com/aws-samples/amazon-textract-textractor/files/14457466/MedicalExaminerReportExample_13.pdf)

Contributor guide

Open the contributing guide

Research direction

Reproduce the behavior with MedicalExaminerReportExample_13.pdf using the shown Textractor.analyze_document call and the TABLES and LAYOUT features. Inspect document.tables[0].title and compare its text with the table visualization; done means the text field above the table is not reported as the table title while the actual table title remains available.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.