← All projects

Document AI OCR

Document AI for HWP and PDF notices · key-field F1 0.985 · about 2,000 notices/day

Built withPython · HWP/HWPX · PDF · Gemini 2.5 Flash-Lite · ThreadPool · Deterministic parsing

Document AI pipeline from direct download and magic-byte format routing through HWP and PDF parsers, source-field copying, deterministic numeric parsing, and recoverable batch controls
Browserless format routing with a strict boundary between language extraction and numeric calculation

WHY

Key inputs for model training and joint-bid matching, such as discipline shares and construction-capacity criteria, existed only inside attached HWP and PDF notices rather than in the listing API. Manually opening about 2,000 new notices each day could not support real-time feature creation or client matching. The required system had to structure those documents automatically while keeping every amount and ratio reproducible.

Key-field extractionF1 0.985

HWP/HWPX and PDF procurement notices

Daily throughputAbout 2,000

New notices processed automatically

Numeric boundaryDeterministic

Amounts, ratios, and units validated in code

HOW

Separate document recovery, field copying, and arithmetic

Each stage has one responsibility, making extraction errors observable and numeric outputs reproducible.

  1. 01Direct download

    Fetch the source URL without browser automation and retain the original bytes.

  2. 02Format routing

    Use magic bytes to distinguish HWP, HWPX, PDF, and ZIP rather than trusting the filename.

  3. 03Text recovery

    Apply rhwp, hwp5, or liteparse through format-specific paths with bounded retries.

  4. 04Source-field copy

    Ask Gemini 2.5 Flash-Lite to copy fields from the recovered text without calculation.

  5. 05Deterministic calculation

    Parse amounts, ratios, and units in code, then append structured output and error logs.

RESULT

Measured extraction batch

MeasureResultWhy it matters
Documents199 / 199No failed extraction in the measured batch
Content2,140,021 tokensLarge documents preserved instead of reduced to snippets
License-ratio GTAbout 90%Deterministic ratio handling after source-field extraction
Documented costAbout $0.82Batch-scale use of a lightweight model
Document extraction result cards showing 199 of 199 documents extracted, 2.14 million tokens processed, about 90 percent license-ratio agreement, and documented batch cost of about 82 cents
Anonymized measured batch · HWP/HWPX, PDF, and ZIP documents

Contribution

  • Designed the direct-download, magic-byte routing, parser fallback, and deterministic numeric-processing boundary.
  • Built concurrent batching with stage-specific timeouts, retries, incremental CSV output, and structured error attribution.

Evidence

Private project