# Haimavyākaraṇa Digitization Project

**Hemacandra's *Śabdānuśāsana* — Interactive Digital Edition**

*Part of [svyoma.github.io/jl](https://svyoma.github.io/shs/) · Live at [svyoma.github.io/shs](https://svyoma.github.io/shs)*

---

## About Hemacandra and the *Śabdānuśāsana*

**Hemacandra** (c. 1088–1172 CE) was one of the most extraordinary polymath scholars of medieval India. A Jain monk-scholar at the court of the Caulukya king Kumārapāla in Aṇahilavāḍa (Gujarat), he earned the title *Kalikālasarvajña* — "the omniscient one of the Kali age." He composed authoritative works in grammar, Prakrit, poetry, logic, yoga, biography, and lexicography, reshaping Jain literature and leaving an indelible mark on Indian intellectual history.

His **Siddha-Hema-Candraśabdānuśāsana** (सिद्धहेमचन्द्रशब्दानुशासन, c. 1145 CE) is a monumental grammar treating **both Sanskrit and the Prakrit languages** in a single integrated work. It is structured as eight adhyāyas (chapters):

- **Adhyāyas 1–7**: Grammar of Sanskrit, following a Pāṇinian framework but with significant original contributions
- **Adhyāya 8**: Grammar of the Prakrit languages (Māhārāṣṭrī, Śauraseni, Māgadhī, Paiśācī, Apabhraṃśa), the only surviving comprehensive systematic grammar of all the Prakrits from classical India

The text comes with Hemacandra's own *Laghuvṛtti* (brief auto-commentary), his more elaborate *BṛhadVṛtti*, and several later commentaries.

### Why This Matters

1. **Linguistic heritage**: The *Śabdānuśāsana* is primary source for understanding Sanskrit and Prakrit grammar as a unified system. For Jain canonical literature (written almost entirely in Prakrits), Hemacandra's grammar is indispensable.

2. **Scarcity of digital resources**: Despite its importance, no comprehensive, searchable, annotated digital edition exists. Scholars must work from early 20th-century printed editions (often in difficult-to-access journals) or manuscripts.

3. **Endangered knowledge**: The traditional oral and scholastic transmission of this text is extremely thin. Digitization preserves and opens access to this living tradition.

4. **Cross-disciplinary relevance**: Linguists, Indologists, Jain studies scholars, historical grammarians, and Sanskrit computational linguists all benefit from an accessible, searchable edition.

---

## This Project

This repository provides a **lightweight, static, mobile-friendly web interface** for browsing and searching the sūtras and commentaries of the *Śabdānuśāsana*. It is hosted at:

> **https://svyoma.github.io/shs**

### Features

- **Full-text search** across Devanagari, IAST, ISO 15919, and Harvard-Kyoto simultaneously — type in any script and find results in all
- **Script switching** — read in Devanagari (देव), IAST, ISO, or HK at any time
- **Commentary display** — Hemacandra's own *Laghuvṛtti* alongside each sūtra
- **Keyboard navigation** — press `/` to search, `←`/`→` arrows on the detail page, swipe on mobile
- **Mobile-first responsive** — works well on phones, tablets, and desktops
- **Zero dependencies** — pure HTML/CSS/JS, no frameworks, no tracking, no ads
- **Fast** — all transliterations pre-baked into `sutras.json` at build time

### Current Status

| Adhyāya | Pāda | Sūtras | Laghuvṛtti | Bṛhadavṛtti | Other |
|---------|------|--------|-----------|-------------|-------|
| 1       | 1    | ✓ 43   | ✓          | —           | —     |
| 1       | 2    | ✓ 42   | ✓          | —           | —     |
| 1       | 3–4  | planned | —         | —           | —     |
| 2–7     | all  | planned | —         | —           | —     |
| 8       | 1–4  | planned | —         | —           | —     |

---

## Repository Structure

```
haima/
├── index.html          # Main browse & search page
├── sutra.html          # Individual sūtra detail view
├── hemacandra.css      # Shared stylesheet
├── hemacandra.js       # Shared JavaScript utilities
├── sutras.json         # Pre-built data (generated by build.py)
├── haima-vyākaraṇa.csv # Source data (sūtras + Laghuvṛtti)
├── build.py            # CSV → sutras.json converter
└── README.md           # This file
```

---

## Building the Data

The `sutras.json` file is generated from `haima-vyākaraṇa.csv` using the build script.

### Requirements

```bash
pip install aksharamukha
```

Transliteration is powered by [Aksharamukha](https://aksharamukha.appspot.com/) — a comprehensive transliteration engine supporting 100+ scripts.

### Run

```bash
python build.py
```

This reads `haima-vyākaraṇa.csv`, generates transliterations for all four scripts (Devanagari, IAST, ISO 15919, Harvard-Kyoto), and writes `sutras.json`.

### CSV Format

The source CSV has three columns:

| Column       | Description                               | Example            |
|-------------|-------------------------------------------|--------------------|
| `sūtra ID`  | Adhyāya.Pāda.Sūtra number                 | `1.1.4`            |
| `sūtra`     | Sūtra text in Devanagari                  | `औदन्ताः स्वराः॥`   |
| `laghuvṛtti`| Hemacandra's brief auto-commentary (Dev.) | `औकारावसाना वर्णाः…` |

---

## How to Contribute

This is a **long-term solo project** and contributions from scholars, students, and enthusiasts are very welcome. There is a great deal of work to be done:

### What We Need

1. **Sūtra data entry** — transcribing sūtras from Adhyāyas 1–8 into the CSV format
2. **Laghuvṛtti transcription** — Hemacandra's own brief commentary (underway)
3. **Bṛhadvṛtti transcription** — Hemacandra's full commentary (major undertaking)
4. **Later commentaries** — Particularly the *Laghunyāsa* and *Ḍhuṇḍhikā*
5. **Proofreading** — Cross-checking against the critical edition
6. **Encoding corrections** — Fixing any errors in existing entries

### Manuscript and Edition Sources

The primary printed edition is:

- **Laghuvṛtti edition**: Jambuvijaya, Muni *Hemacandra's Siddhahemacandraśabdānuśāsana with Laghuvṛtti*, Patan, 1994.

### How to Submit Contributions

1. **Fork this repository** on GitHub (at [github.com/svyoma](https://github.com/svyoma))
2. **Edit `haima-vyākaraṇa.csv`** following the existing format
3. **Submit a pull request** with a brief description of what you added
4. Alternatively, **open an issue** with corrections or new data pasted in the body

### Contribution Guidelines

- Use standard Unicode Devanagari (NFC normalization preferred)
- Follow the existing sūtra ID numbering scheme (`adhyāya.pāda.sūtra`)
- For sūtras with subdivisions, use the decimal format (e.g., `1.1.42.1`)
- Leave the laghuvṛtti cell empty if not available rather than guessing
- When in doubt, reference the printed edition and note any uncertainty

---

## Contact

**Project maintainer**: Vyom A.
**Website**: [svyoma.github.io](https://svyoma.github.io)
**GitHub**: [github.com/svyoma](https://github.com/svyoma)

For questions about the grammar, historical context, or scholarly collaboration, please open a GitHub issue. Correspondence in Sanskrit, Hindi, Gujarati, or English is welcome.

---

## License

The **code** (HTML, CSS, JavaScript, Python build script) is released under the **MIT License**.

The **textual data** (sūtras and commentaries) is in the public domain — Hemacandra composed them in the 12th century. Our transcriptions of this data are dedicated to the public domain under **CC0 4.0**.

---

## Acknowledgements

- [Aksharamukha](https://aksharamukha.appspot.com/) by Vinodh Rajan for comprehensive cross-script transliteration (100+ scripts supported)
- The [Noto Serif Devanagari](https://fonts.google.com/noto/specimen/Noto+Serif+Devanagari) and [Cormorant Garamond](https://fonts.google.com/specimen/Cormorant+Garamond) typefaces
- Scholars and editors of Hemacandra's works across two centuries of Indological scholarship

---

*"स्याद्वादात् लोकात् सिद्धिः" — From perspectivism and from common usage comes understanding.*
— Hemacandra, *Śabdānuśāsana* 1.1.2–3
