Skip to content

[Parser] Trailing commas from truncated page-break text not cleaned #8

Description

@ilhamfp

Parser Improvement: Trailing commas from truncated page-break text not cleaned

Severity: MEDIUM
File: ocr_correct.py
Function: correct_ocr_errors
Estimated errors fixed: 1

Current Behavior

When text is truncated at a page break (e.g., 'keamanan , , ,'), trailing sequences of commas/spaces remain in the output. These are artifacts of partial text extraction where the rest of the line was on the next page.

Proposed Fix

Add a pattern to clean up trailing sequences of commas (with optional spaces) that indicate truncated text at page boundaries.

Code Before

    # Common scanner artifacts
    (re.compile(r'^[;,.]$', re.MULTILINE), ''),  # Lone punctuation on a line

Code After

    # Common scanner artifacts
    (re.compile(r'^[;,.]$', re.MULTILINE), ''),  # Lone punctuation on a line
    # Trailing comma sequences from page-break truncation: 'word , , ,'
    (re.compile(r'(?:\s*,\s*){2,}\s*$', re.MULTILINE), ''),

Generated by the Pasal.id Correction Agent (Opus 4.6) after analyzing 3 parser feedback entries.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions