Daejeon, July 27–31
This study presents an end-to-end workflow for converting scanned Vedic Sanskrit sources into machine-readable, accent-aware, and translation-aligned digital texts. It integrates three components developed and evaluated in our prior work: transformer-based OCR for printed Devanagari Vedic texts, neural restoration of Vedic accent marks, and machine translation enhanced with philological commentary. The contribution is not another isolated model, but a coupled linguistic pipeline that treats integration itself as a research problem. OCR, accent restoration, alignment, and translation cannot be optimized as independent black boxes: for Vedic materials, philological validity emerges across stages. An OCR result that is adequate by ordinary character accuracy may still fail if it loses accentual evidence needed for restoration or translation. Conversely, a linguistically plausible restoration can identify OCR candidates that are unlikely even when their plain character strings are close to the expected reading. Vedic Sanskrit is one of the earliest attested Indo-European languages and is central to historical linguistics, religious studies, and philology. Its accent marks are not typographic decoration; they can signal morphological, syntactic, lexical, and compound-level distinctions. Many digital resources omit accents, encode them inconsistently, or inherit OCR errors. Thus searchable text can remain linguistically incomplete. For example, sa evāsmād rakṣāṁsy apa hanti is not equivalent to sá evā́ smād rákṣāṁsy ápa hanti: the accented form encodes positions that the downstream pipeline must preserve as linguistic evidence.
The workflow is related to historical OCR and HTR infrastructures such as Transkribus and eScriptorium (Kahle et al., 2017; Nockels et al., 2022; Kiessling et al., 2019), and to recent neural work on OCR, Sanskrit computational infrastructure, and machine learning for ancient languages (Li et al., 2023; Pradeep and Mamidi, 2025; Sommerschield et al., 2023). Our work differs in its Vedic-specific linguistic design: the output must preserve accentual evidence, convert between scripts and scholarly transliteration, and support interpretation through philological commentary. Unlike general HTR tasks, Vedic digitization is not only paleographic transcription but also partial linguistic reconstruction.
The first component is accent-aware OCR. We fine-tune microsoft/trocr-large-printed on 11,740 line images from the Schroeder edition of the Maitrāyaṇī Saṁhitā (https://huggingface.co/datasets/yzk/veda-ocr-ms). The model converts printed Devanagari lines with Vedic accent marks into ISO 15919 transliteration (https://huggingface.co/yzk/trocr-large-printed-vedic). Fine-tuning reduces character error rate from 0.9991 to 0.1044, word error rate from 1.0000 to 0.4094, and increases ChrF1 from 0.0179 to 0.7968 (Tsukagoshi, Kuroiwa, and Ohmukai, 2025). For accent-bearing syllabic positions, post-fine-tuning precision is 0.711, recall is 0.666, and F1 is 0.688. The OCR output is also aligned with existing electronic texts using weighted edit distance. On 5,844 electronic-text sentences, 5,048 are correctly aligned, giving line-identification accuracy of 0.8637, or 0.9101 when correctly detected missing images are counted. This alignment links scans, recognized lines, electronic witnesses, and uncertainty points for later correction. Thus OCR is not only a recognition step: it produces structured evidence about where a reading comes from and how reliable it is.
The second component restores or verifies Vedic accents as sequence-to-sequence generation from unaccented to accented transliteration. The training corpus contains 108,076 samples from eight accented Vedic texts in TITUS, including Saṁhitā, Brāhmaṇa, Āraṇyaka, and Upaniṣad materials (Martínez García and Gippert, 1995). It contains 651,337 word tokens and 133,873 unique word forms, and is publicly available (https://huggingface.co/datasets/yzk/vedic-accent-restoration-dataset). The best model, a LoRA-tuned Llama 3.1 8B model, achieves precision 0.916, recall 0.841, and F1 0.877 for accent placement, with WER 0.161 and ChrF1 87.5 (Tsukagoshi and Ohmukai, 2025a).
The third component addresses translation. Vedic translation depends on lexical and grammatical competence, but also on ritual, mythological, and philological knowledge. We compare standard supervised fine-tuning, where models receive only the Sanskrit source, with commentary-enhanced fine-tuning, where verse-level commentary is serialized with the source verse as auxiliary interpretive context. The implementation uses three modes: source only, source plus commentary, and commentary only. The dataset contains 6,754 Ṛgveda verse-level samples: 5,282 training, 743 validation, and 729 test samples. It combines Sanskrit text from TITUS and Aufrecht’s edition, the English translation by Jamison and Brereton (2014), and the Jamison–Brereton online commentary (Aufrecht, 1877; Jamison and Brereton, 2015). Commentary-enhanced training improves BLEU-4 in four of five tested models: GPT-4.1 nano by 155.0%, Gemini 2.5 Flash by 27.4%, Gemma 2 Mitra by 30.5%, and Llama 3.1 8B by 31.1%; only Llama 3.2 3B decreases, by 11.5% (Tsukagoshi and Ohmukai, 2025b) (https://huggingface.co/collections/yzk/rv-commentary-translation). These results suggest that larger models can use commentary not merely as extra text, but as machine-readable philological supervision that constrains lexical choices, ritual references, and ambiguous syntactic relations.
Figure 1 should be read as a data-and-evidence flow rather than only a module diagram. OCR supplies page-line alignment, transliteration, and uncertain readings; accent restoration recovers phonological evidence absent from OCR-only output; translation consumes the restored form and commentary-derived interpretive context. The central contrast is between searchable OCR text and philologically usable text: the latter preserves accent positions, alignment to scanned witnesses, and interpretive constraints. An isolated OCR benchmark cannot show whether a lost accent will later produce an implausible restoration, and an isolated translation benchmark cannot show whether the input form was philologically well grounded. Component-wise evaluation is therefore necessary but insufficient; the humanities question is whether the full workflow preserves the linguistic structure on which interpretation depends.
The reusable outcomes include the fine-tuned OCR model, the public accent restoration dataset, evaluation protocols, and the workflow design. Copyrighted scans, published translations, and commentary-derived training data must be distributed only where licensing permits, but the reusable models, datasets, and protocols make the approach transferable to other accent-rich historical corpora. The main limitation is that evaluation remains component-level: a fully end-to-end benchmark from the same scanned page image through translation remains future work. Even so, the workflow demonstrates that Vedic texts require linguistically informed digitization; conventional OCR output alone is not enough.