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42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
---
language:
- sa
- en
license:
- cc-by-4.0
- cc-by-sa-4.0
multilinguality:
- monolingual
size_categories:
- 100K<n<1M
task_categories:
- token-classification
- structured-prediction
- sequence-modeling
task_ids:
- part-of-speech-tagging
- lemmatization
- morphological-analysis
pretty_name: Sanskrit Morphological Sequence Corpus (Vidyut-Verified)
tags:
- sanskrit
- morphology
- vyakarana
- pāṇinian
- vidyut
- dcs
- universal-dependencies
- slp1
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
dataset_info:
  features:
  - name: id
    dtype: string
  - name: tokens
    sequence: string
  - name: lemmas
    sequence: string
  - name: aupadeshika
    sequence: string
  - name: pos_tags
    sequence: string
  - name: vibhakti
    sequence: string
  - name: vacana
    sequence: string
  - name: purusha
    sequence: string
  - name: prayoga
    sequence: string
  - name: linga
    sequence: string
  - name: n_match
    dtype: int64
  - name: n_mismatch
    dtype: int64
  - name: n_unverified
    dtype: int64
  - name: verification
    dtype: string
  splits:
  - name: train
    num_bytes: 501686774
    num_examples: 710785
  download_size: 82377323
  dataset_size: 501686774
---

# Sanskrit Morphological Sequence Corpus (Vidyut-Verified)

A large-scale, **Pāṇinian-verified** morphological sequence dataset for
classical and Vedic Sanskrit. Every token is annotated with its lemma,
generative root (aupadeśika), part-of-speech, case, number, person, voice,
and gender — all in the SLP1 transliteration, and all aligned at the
sentence level for sequence-tagging / seq2seq training.

- **710,785 sentences** (after deduplication)
- **5,511,664 tokens**
- **14 columns** (10 linguistic + 4 Vidyut verification annotations)
- **Parquet format** (columnar, compressed)
- **Sources**: Digital Corpus of Sanskrit (DCS, CC BY 4.0) + Universal
  Dependencies Sanskrit treebanks (UD-Sanskrit-Vedic, UD-Sanskrit-UFAL;
  CC BY-SA 4.0)

---

## Dataset Summary

| | |
|---|---|
| Sentences | 710,785 |
| Tokens | 5,511,664 |
| Vocabulary (types) | ~30k lemmas |
| Transliteration | SLP1 (Sanskrit Library Phonetic Basic) |
| Schema per row | sentence-aligned sequences of token-level annotations |
| Verification | Vidyut 0.4.0 Pāṇinian round-trip checksum on every token |
| Format | Apache Parquet |
| License | CC BY 4.0 (DCS) / CC BY-SA 4.0 (UD) — see *Licensing* below |

### Token-level POS distribution

| Vidyut POS | Tokens | % | Meaning |
|---|---:|---:|---|
| `Subanta` | 3,542,853 | 64.3% | Declined nominals (nouns, pronouns, adjectives, numerals) |
| `Avyaya` | 1,002,920 | 18.2% | Indeclinables (adverbs, particles, conjunctions) |
| `Tinanta` | 520,321 | 9.4% | Finite verbs |
| `Krdanta` | 445,570 | 8.1% | Non-finite verb forms (participles, infinitives, gerunds, absolutives) |

---

## Schema (14 columns)

Each row is one sentence. All `Sequence` columns are equal-length, aligned
token-by-token.

### Linguistic columns (10)

| Column | Type | Description |
|---|---|---|
| `id` | `string` | Source sentence id (DCS occurrence id or UD `sent_id`) |
| `tokens` | `Sequence[string]` | SLP1 surface words (sandhi-split padāni) |
| `lemmas` | `Sequence[string]` | SLP1 clean lexical lemma (dictionary form) |
| `aupadeshika` | `Sequence[string]` | SLP1 generative root blueprint (accented, with prefixes/sanādi); for `Subanta`/`Avyaya` equals the lemma; for `Tinanta`/`Krdanta` resolved via the Vidyut Kosha (e.g. `kf``kf\Y`) |
| `pos_tags` | `Sequence[string]` | Vidyut POS: `Subanta` / `Tinanta` / `Krdanta` / `Avyaya` |
| `vibhakti` | `Sequence[string]` | Vidyut case (8 values) or `"None"` if inapplicable |
| `vacana` | `Sequence[string]` | Vidyut number: `eka` / `dvi` / `bahu`, or `"None"` |
| `purusha` | `Sequence[string]` | Vidyut person: `praTama` / `maDyama` / `uttama`, or `"None"` |
| `prayoga` | `Sequence[string]` | Vidyut voice: `kartari` / `karmaRi` / `BAve`, or `"None"` |
| `linga` | `Sequence[string]` | Vidyut gender: `puM` / `strI` / `napuMsaka`, or `"None"` |

### Verification columns (4)

| Column | Type | Description |
|---|---|---|
| `n_match` | `int64` | # tokens Vidyut generated and matched the surface form |
| `n_mismatch` | `int64` | # tokens Vidyut generated but did NOT match (likely ārṣa/Vedic irregularity or rare mapping edge-case) |
| `n_unverified` | `int64` | # tokens Vidyut could not attempt (engine coverage gap: pronoun sarvanāmasa, special `-ī` stems, some kṛt pratyayas) |
| `verification` | `string` | Categorical status (see *Verification status* below) |

### Null-padding convention

Features that don't apply to a given POS class are the literal string
`"None"` (not the Python `None`):

| POS class | `vibhakti` | `vacana` | `purusha` | `prayoga` | `linga` |
|---|---|---|---|---|---|
| `Subanta` (nominal) | ✓ | ✓ | None | None | ✓ |
| `Tinanta` (finite verb) | None | ✓ | ✓ | ✓ | None |
| `Krdanta` (participle) | ✓ | ✓ | None | ✓ | ✓ |
| `Avyaya` (indeclinable) | None | None | None | None | None |

### Vidyut enum value strings

The `vibhakti` / `vacana` / `purusha` / `prayoga` / `linga` columns use the
exact SLP1 strings Vidyut's `from_string` classmethods accept, so the
columns can be fed directly into `vidyut.prakriya.{Vibhakti,Vacana,Purusha,
Prayoga,Linga}.from_string(value)`:

- **vibhakti**: `praTamA`, `dvitIyA`, `tftIyA`, `caturTI`, `paYcamI`, `zazWI`, `saptamI`, `samboDanam`
- **vacana**: `eka`, `dvi`, `bahu`
- **purusha**: `praTama`, `maDyama`, `uttama`
- **prayoga**: `kartari`, `karmaRi`, `BAve`
- **linga**: `puM`, `strI`, `napuMsaka`

---

## Sources

### 1. Digital Corpus of Sanskrit (DCS) — primary

- URL: https://github.com/OliverHellwig/sanskrit
- Path in repo: `dcs/data/conllu/`
- Format: UD-compatible CoNLL-U, **IAST** transliteration
- Size: ~745k sentences / ~5.5M tokens, ~15,900 `.conllu` files
- Coverage: Ṛgveda, Atharvaveda (Śaunaka & Paippalāda), Mahābhārata, Rāmāyaṇa, major Upaniṣads, sūtras, Purāṇas, Buddhist Sanskrit, grammatical treatises, and more.
- License: **CC BY 4.0**
- Citation: *Oliver Hellwig, Digital Corpus of Sanskrit (DCS), 2010–2024.*

DCS is not web-scraped text. It is the product of over a decade of
computational-linguistic work by Dr. Oliver Hellwig and collaborators,
run through constraint-solvers and hand-corrected by Sanskrit experts.
It is currently the most rigorously peer-reviewed Sanskrit morphological
database in existence.

### 2. Universal Dependencies — Sanskrit treebanks

- **UD_Sanskrit-Vedic**: https://github.com/UniversalDependencies/UD_Sanskrit-Vedic
- **UD_Sanskrit-UFAL**: https://github.com/UniversalDependencies/UD_Sanskrit-UFAL
- Format: CoNLL-U, **IAST** transliteration
- License: **CC BY-SA 4.0**

UD rows are identifiable by a `_` in their `id` (e.g. `71508_1`); DCS rows
by a numeric occurrence id (e.g. `96540`).

---

## Construction Pipeline

The dataset was built by the `sanskrit_morpho` package:

1. **Fetch** — shallow-clone UD treebanks; sparse-checkout only
   `dcs/data/conllu/` from the DCS repo (no C++/R analysis code).
2. **Parse** — standard CoNLL-U parser; multi-word sandhi-fused range
   rows (e.g. `1-2 bhagavāñśrāvastyāṃ`) are dropped when the split
   padāni follow; purely fused blocks with no split forms are dropped.
3. **Normalize to SLP1** — all tokens and lemmas transliterated from IAST
   to SLP1. The terminal-anusvāra rule is applied per token: a trailing
   `M` (anusvāra) at word-end is normalized to the labial nasal `m`
   (e.g. `vanaM``vanam`); medial anusvāras are preserved (sandhi-relevant).
4. **Tag-map to Vidyut** — UD `UPOS` → Vidyut `Subanta/Tinanta/Avyaya/Krdanta`;
   UD `Case/Number/Person/Voice/Gender` → Vidyut
   `vibhakti/vacana/purusha/prayoga/linga`. Non-finite `VerbForm`
   (`Part`, `Inf`, `Ger`, `Conv`, `Abs`) overrides `Tinanta``Krdanta`.
5. **Null-pad** — inapplicable features set to the string `"None"`.
6. **Aupadeśika resolution** — for `Tinanta`/`Krdanta`, the clean SLP1
   lemma is looked up in the Vidyut Kosha (45k-entry dhatu index) and the
   metalanguage `aupadeshika` root (accented, with prefixes/sanādi) is
   stored in the `aupadeshika` column.
7. **QC drop (build-time)** — drop incomplete sentences (any token with
   missing POS or lemma) and purely-sandhi-fused blocks with no split
   forms. 1 row dropped at build time.
8. **Dedup + verify (post-build)** — exact-sentence deduplication +
   structural validation + Vidyut round-trip verification.

---

## Verification (Vidyut Round-Trip Checksum)

Every token was verified using [Vidyut 0.4.0](https://github.com/ambuda-org/vidyut)
(Ambuda's Pāṇinian engine) as a cryptographic checksum. The direction is
**backward** (the only direction Vidyut supports — it can generate but
cannot decompose):

1. **Read row**: pull a token's `aupadeshika` / `lemmas` + `pos_tags` +
   `vibhakti` / `vacana` / `purusha` / `prayoga` / `linga`.
2. **Generate**: construct a `vidyut.prakriya.Pada` and call
   `Vyakarana().derive()` to produce all Pāṇinian surface forms.
3. **Assert**: check if Vidyut's generated output contains the surface
   token from the dataset.

A per-token verdict of `match` / `mismatch` / `unverified` is recorded,
then aggregated per sentence into the `verification` column. Missing
features iterate over all possible enum values so partially-annotated
tokens (e.g. pronouns without gender) can still match.

### Verification status distribution

| `verification` | Sentences | % | Meaning |
|---|---:|---:|---|
| `full_match` | 35,500 | 5.0% | Every token Pāṇini-compliant — **verified strict gold** |
| `partial_match` | 124,056 | 17.5% | All verifiable tokens matched; some `unverified` (Vidyut coverage gaps only, zero mismatches) |
| `has_mismatch` | 546,229 | 76.8% | ≥1 token Vidyut could not match (ārṣa / Vedic irregularities, pronoun sarvanāmasa, special `-ī` stems) |
| `all_unverified` | 5,000 | 0.7% | No token could be verified (full Vidyut coverage gap) |

**The `has_mismatch` rows are NOT bad data.** They are correct DCS/UD
gold annotations that Vidyut's classical-Pāṇinian engine cannot generate
(e.g. Vedic `ārṣa prayoga` that violates strict classical rules, or
pronoun paradigms outside the `Pratipadika.basic()` generation path).
They are retained so the corpus is lossless; consumers can filter them
out for a strict-classical subset.

### Recommended subsets

- **Vidyut-Verified Strict Gold**: `verification == "full_match"` → 35,500 sentences
- **No-mismatch gold** (includes engine-coverage gaps): `verification in {"full_match", "partial_match"}` → 159,556 sentences
- **Full corpus** (includes Vedic irregularities): all 710,785 sentences

---

## Quickstart

### Load with Hugging Face `datasets`

```python
from datasets import load_dataset
ds = load_dataset("parquet", data_files="./data-train-0.parquet")["train"]
print(ds[0])
```

### Load with pyarrow

```python
import pyarrow.parquet as pq
t = pq.read_table("./data-train-0.parquet")
# strict gold subset
mask = [v == "full_match" for v in t.column("verification").to_pylist()]
strict = t.filter(mask)
```

### Example row (full_match)

```json
{
  "id": "71509_1",
  "tokens": ["prayacCati"],
  "lemmas": ["prayam"],
  "aupadeshika": ["ya\\ma~"],
  "pos_tags": ["Tinanta"],
  "vibhakti": ["None"],
  "vacana": ["eka"],
  "purusha": ["praTama"],
  "prayoga": ["None"],
  "linga": ["None"],
  "n_match": 1,
  "n_mismatch": 0,
  "n_unverified": 0,
  "verification": "full_match"
}
```

The surface token `prayacCati` ("he gives") is regenerated by Vidyut from
the root `ya\ma~` (= `pra` + `yam`) + `Tinanta` + `kartari` (default) +
`praTama` + `eka` + `Lat` (present) — confirming the annotation is
Pāṇini-compliant.

---

## Intended Uses

- **Morphological tagging (CRF / neural sequence models)**: input
  `tokens`, predict `pos_tags` / `vibhakti` / `vacana` / `purusha` /
  `prayoga` / `linga`. The `prayoga` (voice) column is especially
  critical for learning passive-construction transition weights.
- **Lemmatization (seq2seq)**: input `tokens`, predict `lemmas`.
- **Generative verification**: input `aupadeshika` + morph features,
  generate the surface form and compare — useful as a Pāṇinian
  auto-grader or for data augmentation.
- **Transliterator normalization benchmark**: train/test SLP1 normalization
  on real-world IAST input.

### Out-of-scope

- Sandhi splitting (the dataset stores already-split padāni).
- Dependency parsing (UD `head`/`deprel` are not in the schema; DCS
  doesn't annotate them).
- Semantics / WordNet senses (DCS ships `WordSem` ids in the raw CoNLL-U
  `MISC` field but they are not surfaced here).

---

## Limitations

1. **`has_mismatch` is 76.8%.** This is mathematically expected — the
   corpus is dominated by DCS classical/Vedic text containing many
   ārṣa prayoga and forms outside Vidyut's basic-substantive generation
   path. It does NOT indicate annotation errors. Use the `verification`
   column to select the subset appropriate for your task.
2. **Tense/Mood not stored.** The verifier defaults verbs to the present
   indicative (`Lat`) when `Tense`/`Mood` are absent from the schema.
   Non-present verbs that Vidyut generates under `Lat` may therefore
   appear as `has_mismatch` even when the annotation is correct. If you
   need tense/lakara, re-parse the source CoNLL-U `FEATS` field.
3. **`is_akarmaka` (transitivity) is not in the dataset.** It is
   derivable at runtime from the `aupadeshika` via the Vidyut Kosha /
   Dhatupatha lookup (the dhatu entry's `karmatva` field), per the
   downstream CRF feature design.
4. **Causative voice** (`kartRka`) is not a Vidyut `Prayoga` enum
   (Vidyut 0.4.0 has only `kartari` / `karmaRi` / `BAve`); causative
   verbs will show `prayoga="None"` or `unverified`.

---

## Licensing

This dataset is a transformation of three upstream sources:

- **DCS** (Oliver Hellwig): **CC BY 4.0**
- **UD_Sanskrit-Vedic**: **CC BY-SA 4.0**
- **UD_Sanskrit-UFAL**: **CC BY-SA 4.0**

The combined dataset is released under **CC BY-SA 4.0** (the most
restrictive of the upstream licenses). You must:

- Provide attribution (cite the sources below).
- Indicate any modifications.
- Distribute derivatives under a compatible license (Share-Alike).

### Citation

```bibtex
@misc{sanskrit_morpho_v1_verified,
  title  = {Sanskrit Morphological Sequence Corpus (Vidyut-Verified)},
  year   = {2026},
  note   = {Built from DCS and Universal Dependencies Sanskrit treebanks,
            with Vidyut 0.4.0 Pāṇinian round-trip verification.},
}

@misc{hellwig_dcs,
  author = {Hellwig, Oliver},
  title  = {Digital Corpus of Sanskrit (DCS)},
  year   = {2010--2024},
  url    = {https://github.com/OliverHellwig/sanskrit},
}

@misc{ud_sanskrit,
  author = {Universal Dependencies},
  title  = {UD Sanskrit (Vedic + UFAL)},
  url    = {https://universaldependencies.org/sa/index.html},
}

@misc{vidyut,
  author = {Ambuda},
  title  = {Vidyut: A Pāṇinian Sanskrit toolkit},
  url    = {https://github.com/ambuda-org/vidyut},
}
```

---

## Reproducibility

The dataset is fully reproducible from sources with the `sanskrit_morpho`
package:

```bash
# 1. Build (fetch + parse + SLP1 + tag-map + aupadeshika)
PYTHONPATH=src python -m sanskrit_morpho.build \
    --raw-dir ./raw_morpho_data \
    --out-dir ./sanskrit_morpho_v1 \
    --sources ud_vedic,ud_ufal,dcs

# 2. Verify + dedup + write parquet
PYTHONPATH=src python -m sanskrit_morpho.verify \
    --in-dir ./sanskrit_morpho_v1/full \
    --out-dir ./sanskrit_morpho_v1_verified \
    --kosha-dir ./vidyut-data/kosha \
    --format parquet
```

Vidyut's linguistic data pack is downloaded once via
`python -c "import vidyut; vidyut.download_data('./vidyut-data')"`.