| Metadata | Value |
|---|---|
| Status | Active |
| Version | 1.0.1 |
| Last Updated | 2026-09-10 |
| Author | Sangita Grantha Architect |
| Document Type | Evidence record |
[!NOTE] Historical evidence: results, counts, commands, and observations below belong to the original work described here. The editorial update date is not a new test or corpus verification. For present behavior, use current quality checks.
This changeset hardens the Python-based PDF extraction service to handle complex academic encodings, garbled diacritics (Utopia fonts), Sanskrit Velthuis encoding, and Devanagari font segmentation. It ensures high-fidelity text extraction from authoritative PDF sources like guruguha.org.
tools/krithi-extract-enrich-worker/src/diacritic_normalizer.py: Implemented a rule-based engine to decode garbled macron/acute/dot-above sequences and consonant-dot patterns (n. -> ṇ).tools/krithi-extract-enrich-worker/src/velthuis_decoder.py: Added a decoder for Velthuis-dvng Type 1 fonts without /ToUnicode maps, supporting 150+ glyph mappings and mātrā reordering.tools/krithi-extract-enrich-worker/src/metadata_parser.py: Updated to normalize titles and handle multi-line headers.tools/krithi-extract-enrich-worker/src/page_segmenter.py: Replaced font-name-based bold detection with PyMuPDF font flags (span["flags"] & 16) and added a font-size fallback heuristic for Devanagari PDFs.tools/krithi-extract-enrich-worker/src/structure_parser.py: Enhanced section detection to handle parenthesized Madhyama Kala tags and optional whitespace/newlines within delimiters.tools/krithi-extract-enrich-worker/src/worker.py: Integrated OCR fallback triggering when extraction quality (replacement characters) falls below 90%.tools/krithi-extract-enrich-worker/tests/test_diacritic_normalizer.py: Coverage for all encoding rules.tools/krithi-extract-enrich-worker/tests/test_velthuis_decoder.py: Glyph-to-Unicode mapping tests.tools/krithi-extract-enrich-worker/tests/test_structure_parser.py: Regression tests for PAC structure and Madhyama Kala splitting.akhil¯an. d. e´svari -> akhilāṇḍeśvari.mdskt.pdf (previously 1).Ref: application_documentation/07-quality/track-054-pdf-extraction-hardening-implementation.md