# Devanagari lookup data

These two uncompressed UTF-8 tables provide single-word dictionary lookup
candidates. They retain their respective data licenses.

## Hindi

`hindi.tsv` uses single-word forms and lemmas from English Wiktionary
contributors, distributed here under [CC BY-SA 4.0](LICENSE-CC-BY-SA-4.0.txt).
The data comes from the Kaikki Hindi extraction by Tatu Ylonen and Wiktextract,
dated October 30, 2026, from the October 1, 2026 English Wiktionary dump. Each
lemma names the source entry in English Wiktionary, where the page history
lists its contributors. [Kaikki Hindi data](https://kaikki.org/dictionary/Hindi/) · [Wiktionary license](https://en.wiktionary.org/wiki/Wiktionary:Copyrights)

Input `kaikki.org-dictionary-Hindi.jsonl` SHA-256
`f4a417e93e7d494712a974e0ce167d071d01a75898917e194f4ca58ec7817e6c`.
The export takes explicit form-to-lemma links and declension and conjugation
table entries. It normalizes Devanagari spelling to NFC and puts explicit
links ahead of table entries.

## Sanskrit

`sanskrit.tsv` is derived from Oliver Hellwig's *Digital Corpus of Sanskrit
(DCS)*, 2010–2024, via the Nabu form-to-lemma export, under
[CC BY 4.0](LICENSE-CC-BY-4.0.txt). The export converts IAST to Devanagari,
indexes single-word analyses and attested word-final sandhi variants, and
orders alternative lemmas by attestation count.
[DCS attribution and license](https://github.com/OliverHellwig/sanskrit/blob/master/dcs/data/readme.md) · [Pinned Nabu dataset and provenance](https://github.com/arvicco/nabu-data/tree/d72747424d17ed3ded80b55c8d0b92a5851cfcc4/san/form-lemma)

## Sanskrit segmentation

`sanskrit-sandhi.json` combines an index of annotated splits with separate
Vedic and classical counts for ranking unseen forms. The derived table is
distributed under [CC BY-SA 4.0](LICENSE-CC-BY-SA-4.0.txt).

- [UD Sanskrit Vedic r2.18](https://github.com/UniversalDependencies/UD_Sanskrit-Vedic/tree/r2.18),
  by Salvatore Scarlata, Elia Ackermann, Oliver Hellwig, Erica Biagetti,
  Paul Widmer and Sven Sellmer, CC BY-SA 4.0.
- [UD Sanskrit UFAL r2.18](https://github.com/UniversalDependencies/UD_Sanskrit-UFAL/tree/r2.18),
  by Puneet Dwivedi, Daniel Zeman and Erica Biagetti, CC BY-SA 4.0.
- Oliver Hellwig, *Digital Corpus of Sanskrit*, 2010–2024, CC BY 4.0.
  The classical model also uses the first five
  [Hitopadeśa sections at commit 8aeed5a](https://github.com/OliverHellwig/sanskrit/tree/8aeed5a1343d0e48b64eb32af8c00e8c6eb29359/dcs/data/conllu/files/Hitopade%C5%9Ba).
- The reviewed forms from Ṛgveda 1.1.1 use its
  [DCS annotation](https://github.com/OliverHellwig/sanskrit/blob/8aeed5a1343d0e48b64eb32af8c00e8c6eb29359/dcs/data/conllu/files/%E1%B9%9Agveda/%E1%B9%9Agveda-0000-%E1%B9%9AV%2C%201%2C%201-9981.conllu)
  and the [Padapāṭha in GRETIL](https://gretil.sub.uni-goettingen.de/gretil/1_sanskr/1_veda/1_sam/1_rv/rvpp_01u.htm).
  They preserve the lateral in the Vedic form `ईळे`.

The export converts the forms to Devanagari, retains annotated multiword
tokens and compound components, and composes the written form of marked
compounds from their corpus spellings. It counts lemmas, part-of-speech
transitions and repeated adjacent lemmas. The builder tunes each register
on validation data and reports a separate held-out check before it adds
those splits to the index.

To regenerate it, place the three `sa_vedic-ud-*.conllu` files and
`sa_ufal-ud-test.conllu` in the input directory. Copy the DCS Hitopadeśa
files numbered 0000–0004 there as `classical-dcs-1.conllu` through
`classical-dcs-5.conllu` in order. Run
`node tools/build-sanskrit-sandhi-data.mjs <input-directory>`.

The expanded index also uses all titles, including Buddhist Sanskrit texts,
from the [DCS CoNLL-U archive v1.0.0](https://github.com/tokushige-koyasan/dcs-corpus/tree/v1.0.0).
The archive reproduces the [DCS annotations at commit 04e0778](https://github.com/OliverHellwig/sanskrit/tree/04e0778d3dc971030229179e25eea043d06ff397/dcs/data/conllu/files),
by Oliver Hellwig, CC BY 4.0. For the Rigveda, the importer uses
[`morpho-lexical/rigveda.csv`](https://github.com/sanskrit-texts/rigveda/tree/master/morpho-lexical)
from the CC BY 4.0 annotation by Oliver Hellwig, Heinrich Hettrich, Ashutosh
Modi and Manfred Pinkal.

To expand the base data, run `python tools/expand-sanskrit-sandhi-index.py
<dcs.zip> <rigveda.csv> <base.json> <output.json>`. The tool reads annotated
multiword spans, marked compounds and unambiguously aligned written forms.
It also indexes adjacent Rigvedic words when the annotation records both a
surface sibilant before a matching stop and its underlying visarga.
It keeps up to 200,000 distinct spellings with their competing splits and
counts. Spellings with a split in a Vedic Saṃhitā or Upaniṣad have priority.
The remaining places go to the most frequent spellings with splits in the
rest of the corpus, including Buddhist Sanskrit. Within each group, base
entries take priority at equal frequency. The ranking model comes from the
base data.

The local input files are in `../corpus-data/sanskrit` relative to the
WebExtension repository. Pass `--limit` to generate a different sample.

## Regenerating the tables

Pass the two input files and the output directory to the repository's
export script. Each row contains one form followed by its distinct lemmas,
separated by tabs and sorted by form for lookup.

```powershell
python tools/build-devanagari-lemma-data.py hindi.jsonl form-lemma.csv src/lex/devanagari/lemma-data
```
