Skip to content
roomi fields

Composing with structure

Saṅgītaratnākara, OCR text

The text of the four volumes of the Adyar edition (1943-1953) of the Saṅgītaratnākara, read by OCR and published as text files.

archived licence CC-BY-SA-4.0

Source code

The scans of the Adyar edition of Śārṅgadeva’s Saṅgītaratnākara (13th century), with Siṃhabhūpāla’s Sudhākara commentary, are on archive.org; this repository gathers their text, one file per volume, so that it can be searched and processed. Its main limitation: this is raw OCR, not a critical edition; the text keeps its misreadings and print marks, and a quotation must always be checked against the printed book.

No demo: these are text files, readable directly in the repository.

One file per volume, in page order

FileVolumeChapters (adhyāya)YearSource of the text
vol1_ocr.txt1I, Svaragata1943archive.org OCR
vol2_archiveorg_ocr.txt2II to IV, Rāgaviveka, Prakīrṇaka, Prabandha1944archive.org OCR
vol2_custom_ocr.txt2the same1944OCR redone for this repository
vol3_ocr.txt3V and VI, Tāla, Vādya1951archive.org OCR
vol4_ocr.txt4VII, Nartana1953archive.org OCR

Volume 2 comes in two readings. The second, made with Tesseract 5.3.4 and its Sanskrit model, marks every page (=== PAGE N ===, 380 marks) and comes with vol2_metadata.json, which locates the 22 śruti, the 15 gamaka, the grāma, and the pages of the rāga and tāla catalogues. The README recommends the archive.org reading for quoting, the second one for finding a page.

Getting started

git clone https://github.com/roomi-fields/sangitaratnakara-ocr.git
cd sangitaratnakara-ocr
grep -n "रागाङ्ग" vol2_custom_ocr.txt

The search for rāgāṅga returns 19 lines, and the page mark before each one locates the passage. Rerun on 28 September 2026. The first line found also shows the limitation: “भाषा रागाङ्गाणि माषाङ्गाणि क्रियाङ्ाप्युपाङ्गानीति”, where माषाङ्गाणि is a misreading of भाषाङ्गाणि.

What it does

  • Provide the text of the four volumes, about 6.6 MB, the Sanskrit and its commentary.
  • Place every passage of volume 2 on its page, through the page marks.
  • Provide the reading pipeline for volume 2: extract_sangitaratnakara.py, under the MIT licence, reusable for another Sanskrit text.

Common issues

Misreadings. Dense ligatures and sandhi produce errors, as in the example above. For the redone volume 2, 375 pages out of 380 have text, and 73.6% of the 431,310 characters read are Devanāgarī: that is the share of script recognised as such, not an accuracy rate.

Library stamps at the start. Roughly the first five pages of volumes 1, 3 and 4 carry library stamps and flyleaves, to be removed for a clean text.

The volume 2 pipeline is very slow. Without OMP_THREAD_LIMIT=1, Tesseract, run in parallel, becomes about twelve times slower.

Two descriptions no longer match the content. The LICENSE file names files that have since been renamed, and GitHub shows an “Other” licence; the repository’s description mentions only volume 2. The README is authoritative: text and metadata under CC BY-SA 4.0, script under MIT.

Where it stands

Archived on GitHub, read-only; the content was published in a single day, on 3 May 2026.

Not done: splitting the text into entries, one rāga, tāla or karaṇa at a time; cleaning the stamps; comparison with the other recension, the one Kallinātha comments on in the Kalānidhi. According to its README, this text feeds the ICM project.

Repository · Volume 1 on archive.org · Volume 2 · Volume 3 · Volume 4

Thanks to the Adyar Library and Research Centre and to S. Subrahmaṇya Śāstrī, editor of these four volumes, to archive.org, which keeps the scans, and to the Tesseract project for its Sanskrit models.

How it was made. Claude Code (Claude Opus 5.5), from the repository, its README and its release notes. Method