fix: UnboundLocalError edge_tolerance in Step 5c
Some checks failed
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-school (push) Successful in 31s
CI / test-go-edu-search (push) Successful in 29s
CI / test-python-klausur (push) Failing after 1m58s
CI / test-python-agent-core (push) Successful in 18s
CI / test-nodejs-website (push) Successful in 19s

Variable wurde vor ihrer Definition in Step 7 referenziert.
Eigene margin_thresh Variable fuer Step 5c eingefuehrt.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-03-09 16:18:47 +01:00
parent 7a0ded7562
commit 11126c4436

View File

@@ -1274,17 +1274,15 @@ def detect_column_geometry(ocr_img: np.ndarray, dewarped_bgr: np.ndarray) -> Opt
if len(validated_gaps) > 2:
edge_tolerance_align = max(8, content_w // 150)
min_aligned_ratio = 0.25 # at least 25% of words must share a left-edge bin
margin_left_end = edge_tolerance if validated_gaps and validated_gaps[0][0] <= max(10, int(content_w * 0.02)) else -1
margin_right_start = content_w - max(10, int(content_w * 0.02))
margin_thresh = max(10, int(content_w * 0.02))
alignment_validated = []
for gap_start_rel, gap_end_rel in validated_gaps:
# Skip margin gaps — they don't need alignment validation
if gap_start_rel <= max(10, int(content_w * 0.02)):
if gap_start_rel <= margin_thresh:
alignment_validated.append((gap_start_rel, gap_end_rel))
continue
if gap_end_rel >= margin_right_start:
if gap_end_rel >= content_w - margin_thresh:
alignment_validated.append((gap_start_rel, gap_end_rel))
continue