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

heuristic_line_break_threshold, along with other heuristic constants not doing anything

Open
#294 4 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

I noticed that even when testing extreme values of heuristic_line_break_threshold, heuristic_overlap_ratio, and heuristic_h_tolerance there was no change in the output. This led me to examine their use in the library, and it appears heuristic_line_break_threshold is never once utilized outside of the class parameter declaration. The other two are used, but still do nothing. Were these features simply released prematurely, or am I doing something wrong?

This is my basic logic for getting output:

`from textractor.data.text_linearization_config import TextLinearizationConfig
from textractor import Textractor

extractor = Textractor(profile_name="default")

document = extractor.analyze_document(
file_source=png_path,
features=[TextractFeatures.TABLES, TextractFeatures.SIGNATURES, TextractFeatures.LAYOUT],
save_image=True
)

config = TextLinearizationConfig(
title_prefix="# ",
section_header_prefix="## ",
add_prefixes_and_suffixes_in_text=True,
heuristic_line_break_threshold=0.9,
heuristic_overlap_ratio=0.5,
table_linearization_format="markdown",
)
print(document.get_text(config=config))`

Contributor guide

Open the contributing guide

Research direction

Start with textractor.data.text_linearization_config.TextLinearizationConfig and the document.get_text(config=config) entry point shown in the report. Reproduce the example while varying heuristic_line_break_threshold, heuristic_overlap_ratio, and heuristic_h_tolerance; done means determining whether each setting is intended to affect output and capturing the result in tests or documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.