Skip to content

Work / Chitragupt / Wiki / Decisions

parsing

Decisionverified 2026-10-26

Parsing

Choice: Regex parsers first. Claude Haiku is the fallback only when classification confidence is under 0.7, the form type is unknown, a scanned PDF has under 50 characters of text per page, or regex output fails its schema. No Sonnet escalation. Before the fallback, each PAN, email and phone is swapped for a placeholder (pseudonymizePii) and Aadhaar is dropped; a PDF with a text layer is sent as text. Scans from the phone are sent as on-device OCR text.

Why: deterministic parsers are free and explainable for stable government forms; the long tail needs a model. Sending the raw PDF shipped PANs to a vendor the privacy policy did not name.

Rejected: LLM-only parsing (cost, explainability on tax fields) · sending the whole PDF to the model · server-side OCR in V1.