GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - putoutjs/bindu: Pāṇini Aṣṭādhyāyī

BranchesTags
Open more actions menu

Latest commit

 

History

260 Commits
260 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
bin
bin
 
 
dictionary
dictionary
 
 
images
images
 
 
lib
lib
 
 
test
test
 
 
.gitignore
.gitignore
 
 
.madrun.js
.madrun.js
 
 
.npmignore
.npmignore
 
 
.npmrc
.npmrc
 
 
.nycrc.json
.nycrc.json
 
 
.putout.json
.putout.json
 
 
.typos.toml
.typos.toml
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
ChangeLog
ChangeLog
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
eslint.config.js
eslint.config.js
 
 
package.json
package.json
 
 

Repository files navigation

Bindu License NPM version Build Status Coverage Status

image

Bindu (Sanskrit: बिंदु) is a Sanskrit word meaning "point", "drop" or "dot".

Pāṇini Aṣṭādhyāyī set of sanscrit grammar rules.

Install

npm i bindu -g

Input

The input script is detected automatically: any Devanāgarī character means Devanāgarī, any IAST diacritic (ā, ṣ, ḥ, combining marks too) means IAST, anything else is SLP1. Override it with the from option ('devanagari', 'iast', 'slp1'). The type option sets the script of the output, the same three values, Devanāgarī by default. A space stays a pada boundary.

Plain ASCII IAST without diacritics (rama eza) reads as SLP1, so pass from: 'iast' if you need it read otherwise.

import {bindu} from 'bindu';

bindu('प्रतिएक');

// returns {code: 'प्रत्येक'}
bindu('द्रौपदी अश्वम्', {
    type: 'iast',
});

// returns {code: 'draupadyaśvam'}
const {places} = bindu('प्रतिएक', {
    fix: false,
});

places[0].message;

// vṛddhirādaic: ie -> ye
bindu('rāma eṣa', {
    from: 'iast',
    type: 'iast',
});
// returns {code: 'rāmaiṣa'}

Text

Sandhi is applied between words separated by one space. Everything else stays as written: punctuation, danda, digits, quotes, line breaks and extra spaces. A line break, a punctuation mark or a digit ends the sandhi: the words around it do not meet. A punctuation mark (. , ; : ! ? | । ॥) is also a pause: a final s or r before it becomes a visarga, and the final stop before it is kept as written.

रामः अत्र। हरिः अत्र → रामोऽत्र। हरिरत्र
rAmaH atra. hariH atra → rAmo'tra. hariratra
rāmaḥ atra. hariḥ atra → rāmo'tra. hariratra

With fix: false the result has the text unchanged, and places tells what would change. position.line is the number of the group of words, counted from one.

Options

option default what it does
type 'devanagari' script of the result: 'devanagari', 'iast', 'slp1'
from detected script of the input, same values
fix true false only reports what would change, in places
rules {} switch rules on or off by name

Every rule has a name: its group and its folder, like sandhi/hal/apply-shtutva. Switch one rule off, a whole group off, or an optional rule on:

bindu('tat wIkA', {
    type: 'slp1',
    rules: {
        'sandhi/hal/apply-shtutva': 'off',
    },
});
// returns {code: 'tat wIkA'}

Some sūtras allow two correct forms. The rule list marks them "optional" and says which form you get by default; switch the rule to get the other one.

Not supported

Some sūtras need to know the morphemes of a word, and a text does not carry them. Their results differ for the same letters, so bindu applies the general rule instead:

sūtra needs bindu gives
6.1.94 pra + a root that starts with e: prejate prEjate
6.1.89 pra + edhate: praidhate prEdhate
6.1.91 upa + a root that starts with ṛ: upārcchati uparcCati
6.1.107 a stem + the ending am: rāmam rAmAm
8.3.25 samrāj saM rAj
8.4.1, 8.4.2, 8.4.14 ṇ inside a word: rāmeṇa, praṇayati no change
8.2.30, 8.2.31, 8.2.40 endings of verbs: vakti, labdha no change

Two more limits:

  • A last word without punctuation gets no pause: write . after it to get rāmaḥ. from rāmas.
  • Vedic accent marks are not letters: they end the word.

Rules

Sandhi

ac

  • ✅ac/apply-dirgha: अकः सवर्णे दीर्घः — 6.1.101
  • ✅ac/apply-yan: इको यणचि — 6.1.77
  • ✅ac/apply-guna: आद्गुणः — 6.1.87
  • ✅ac/apply-vriddhi: वृद्धिरेचि — 6.1.88
  • ✅ac/apply-purvarupa: एकः पूर्वपरयोः — 6.1.84
  • ✅ac/apply-padantad: एङः पदान्तादति — 6.1.109
  • ✅ac/apply-eco-yavayava: एचोऽयवायावः — 6.1.78
  • ✅ac/apply-omang: ओमाङोश्च — 6.1.95
  • ✅pragrhya: प्लुतप्रगृह्या अचि नित्यम् — 6.1.125

visarga

  • ✅visarga/apply-rori: रो रि। — 8.3.14
  • ✅visarga/apply-rori-dirgha: ढ्रलोपे पूर्वस्य दीर्घोऽणः — 6.3.111
  • ✅visarga/apply-visarga-sha: इदुदुपधस्य चाप्रत्ययस्य — 8.3.41
  • ✅visarga/apply-bhobhago: भोभगोअघोअपूर्वस्य योऽशि — 8.3.17
  • ✅visarga/apply-kharovasana:खरवसानयोर्विसर्जनीयः — 8.3.15
  • ✅visarga/apply-etat-tadoh: एतत्तदोः सुलोपोऽकोरनञ्समासे हलि — 6.1.132
  • ✅visarga/apply-hali-sarvesham: हलि सर्वेषाम् — 8.3.22
  • ✅visarga/apply-visarga-voiced: अतो रोरप्लुतादप्लुते — 6.1.113
  • ✅visarga/apply-ruh: ससजुषो रुः — 8.2.66
  • ✅visarga/apply-visarga-vowel: हशि च — 6.1.114
  • ✅visarga/apply-ah-sandhi: लोपः शाकल्यस्य — 8.3.19
  • ✅visarga/apply-as-sandhi: अतो रोरप्लुतादप्लुते — 6.1.113
  • ✅visarga/apply-sassa: विसर्जनीयस्य सः — 8.3.34 (stays before a khar sibilant: 8.3.35; optional sibilant form: 8.3.36)

hal

  • ✅hal/apply-pumah-khayyampare: पुमः खय्यम्परे — 8.3.6
  • ✅hal/apply-mo-nusvara: मोऽनुस्वारः — 8.3.23
  • ✅hal/apply-anusvara: अनुस्वारस्य ययि परसवर्णः — 8.4.58
  • ✅hal/apply-jashtva: झलां जशोऽन्ते — 8.2.39
  • ✅hal/apply-shchutva: स्तोः श्चुना श्चुः — 8.4.40
  • ✅hal/apply-shtutva: ष्टुना ष्टुः — 8.4.41
  • ✅hal/apply-shtutva: न पदान्ताट्टोरनाम् — 8.4.42, guard of 8.4.41
  • ✅hal/apply-yaro-anunasike: यरोऽनुनासिकेऽनुनासिको वा — 8.4.45 (optional, nasal form is the default)
  • ✅hal/apply-udah-sthastambhoh: उदः स्थास्तम्भोः पूर्वस्य — 8.4.61
  • ✅hal/apply-nash-chavy-aprashan: नश्छव्यप्रशान् — 8.3.7
  • ✅hal/apply-samparibhyam-karotau: सम्परिभ्यां करोतौ भूषणे — 6.1.137
  • ✅hal/apply-upasargat-satvam: उपसर्गात् सुनोतिसुवतिस्यतिस्तौतिस्तोभतिस्थासेनयसेधसिचसञ्जस्वञ्जाम् — 8.3.65
  • ✅hal/apply-sadiraprateh: सदिरप्रतेः — 8.3.66
  • ✅hal/apply-shash-cho-ati: शश्छोऽटि — 8.4.63 (optional, the aspirated form is the default)
  • ✅hal/apply-jhayo-ho: झयो होऽन्यतरस्याम् — 8.4.62 (optional, off by default)
  • ✅hal/apply-vavasane: वावसाने — 8.4.56 (optional, off by default)
  • ✅hal/apply-anmano: आङ्माङोश्च — 6.1.74
  • ✅hal/apply-namuna: ङमो ह्रस्वादचि ङमुण्नित्यम् — 8.3.32
  • ✅hal/apply-padantad-va: पदान्ताद्वा — 6.1.76 (optional, off by default)
  • ✅hal/apply-cch: छे च — 6.1.73
  • ✅hal/apply-topadhasha: तोर्लि — 8.4.60
  • ✅hal/apply-natva: रषाभ्यां नो णः समानपदे — 8.4.1
  • ✅hal/apply-charva: खरि च — 8.4.55
  • ✅hal/apply-satvam: आदेशप्रत्यययोः — 8.3.59

apply-pumah-khayyampare

The word pum before a voiceless or aspirated stop (khay) that is followed by a vowel, h, y, v, r, l or a nasal gets an s after the anusvāra.

पुम् + कोकिल → पुंस् कोकिल
pum + kokila → puMs kokila
pum + kokila → puṃs kokila

पुम् + चक्र → पुंश् चक्र
pum + cakra → puMS cakra
pum + cakra → puṃś cakra

apply-mo-nusvara

A final m before a consonant becomes anusvāra. Before a stop the anusvāra then becomes the nasal of that stop (apply-anusvara).

हरिम् + वन्दे → हरिं वन्दे
harim + vande → hariM vande
harim + vande → hariṃ vande

किम् + करोति → किङ्करोति
kim + karoti → kiNkaroti
kim + karoti → kiṅkaroti

apply-anusvara

सम् + गच्छति → संगच्छति
saM + gacCati → saNgacCati
saṃ + gacchati → saṅgacchati

सम् + योग → सं योग
saM + yoga → saM yoga
saṃ + yoga → saṃ yoga

apply-jashtva

वाक् + देव → वाग्देव
vAk + deva → vAgdeva
vāk + deva → vāgdeva

तत् + अपि → तदपि
tat + api → tadapi
tata + api → tadapi

apply-omang

a or ā before oṃ disappears into it.

शिवाय + ओं → शिवायों
SivAya + oM → SivAyoM
śivāya + oṃ → śivāyoṃ

apply-padantad

ए + अ → एऽ
e + a → e'

ओ + अ → ओऽ
o + a → o'

Pragrhya words are exempt, deve atra stays.

देवे + अत्र → देवे अत्र
deve + atra → deve atra
deve + atra → deve atra

apply-etat-tadoh

saḥ and eṣaḥ lose the visarga before a consonant.

सः + गच्छति → स गच्छति
saH + gacCati → sa gacCati
saḥ + gacchati → sa gacchati

apply-hali-sarvesham

After bhoḥ, bhagoḥ and aghoḥ the visarga disappears before a voiced consonant.

भोः + देव → भो देव
BoH + deva → Bo deva
bhoḥ + deva → bho deva

apply-as-sandhi

ramas + asti → ramo'sti
rAmas + asti → rAmo'sti
rAmas + ca → rAmaS ca

apply-kharovasana

Before a voiceless consonant or a pause, a final s or r becomes a visarga.

रामस् + करोति → रामः करोति
rAmas + karoti → rAmaH karoti
rāmas + karoti → rāmaḥ karoti

रामस्। → रामः।
rAmas. → rAmaH.
rāmas. → rāmaḥ.

apply-ruh

A visarga after any vowel except a and ā becomes r before a voiced consonant. The words punaḥ, antaḥ, prātaḥ, svaḥ, ahaḥ come from r and keep it as well.

हरिः + गच्छति → हरिर् गच्छति
hariH + gacCati → harir gacCati
hariḥ + gacchati → harir gacchati

पुनः + गच्छति → पुनर् गच्छति
punaH + gacCati → punar gacCati
punaḥ + gacchati → punar gacchati

apply-visarga-vowel

A visarga after short a becomes o before a (the a turns into an avagraha) and disappears before any other vowel. A written aḥ is read as coming from s; punaḥ, prātaḥ, antaḥ, svaḥ, ahaḥ come from r and keep it (punar api → punarapi).

रामः + अत्र → रामोऽत्र
rAmaH + atra → rAmo'tra
rāmaḥ + atra → rāmo'tra

रामः + इति → राम इति
rAmaH + iti → rAma iti
rāmaḥ + iti → rāma iti

apply-ah-sandhi

ramāḥ + asti → ramā asti
rAmAH + asti → rAmA asti
ramāḥ + deva → ramā deva
rAmAH + deva → rAmA deva

apply-rori-dirgha

punar + ramate → punA ramate

apply-sassa

The visarga stays before a khar followed by a sibilant.

रामः + त्सरति → रामः त्सरति
rAmaH + tsarati → rAmaH tsarati
rāmaḥ + tsarati → rāmaḥ tsarati

apply-visarga-sha

nis + kfta → nizkfta
agniH + karoti → agniH karoti

apply-shtutva

After a word-final ṭ, ṭh, ḍ, ḍh or ṇ the next word does not change, except nām.

षट् + नाम् → षण्णाम्
zaw + nAm → zaRRAm
ṣaṭ + nām → ṣaṇṇām

षट् + ते → षट् ते
zaw + te → zaw te
ṣaṭ + te → ṣaṭ te

apply-yaro-anunasike

tat + mama → tanmama
jagat + nAtha → jagannAtha

उद् + मान → उन्मान
ud + mAna → unmAna
ud + māna → unmāna

apply-udah-sthastambhoh

ut + sTAna → utTAna

apply-nash-chavy-aprashan

mahAn + ca → mahAMS ca

apply-samparibhyam-karotau

sam + kfta → saMskfta
pari + kfta → parizkfta

apply-sadiraprateh

After an upasarga that ends in i, u, e, o or a velar, the root sad gets ṣ, except after prati.

नि + सीदति → निषीदति
ni + sIdati → nizIdati
ni + sīdati → niṣīdati

apply-upasargat-satvam

aBi + sTA → aBizTA
prati + stu → pratizwu

apply-shash-cho-ati

tat + Siva → tacCiva

तत् + श्री → तच्छ्री
tat + SrI → tacCrI
tat + śrī → tacchrī

Optional; on by default. Switch it off with rules: {'sandhi/hal/apply-shash-cho-ati': 'off'} to get tac Siva.

apply-satvam

nis + kRta → nizkRta

apply-vavasane

Before a pause, a final voiced stop may become voiceless. Optional, off by default.

With rules: {'sandhi/hal/apply-vavasane': 'on'}:

वाग्। → वाक्।
vAg. → vAk.
vāg. → vāk.

apply-jhayo-ho

After a stop, h may become the aspirate of that stop. Optional, off by default.

तत् + हि → तद् हि
tat + hi → tad hi
tat + hi → tad hi

With rules: {'sandhi/hal/apply-jhayo-ho': 'on'}:

तत् + हि → तद्धि
tat + hi → tadDi
tat + hi → taddhi

apply-anmano

After the words ā and mā, ch becomes cch.

आ + छाया → आच्छाया
A + CAyA → AcCAyA
ā + chāyā → ācchāyā

apply-namuna

A final ṅ, ṇ or n after a short vowel is doubled before a vowel.

कुर्वन् + आस्ते → कुर्वन्नास्ते
kurvan + Aste → kurvannAste
kurvan + āste → kurvannāste

apply-padantad-va

After a word-final long vowel, ch may become cch. Optional, off by default.

With rules: {'sandhi/hal/apply-padantad-va': 'on'}:

विद्या + छत्त्र → विद्याच्छत्त्र
vidyA + Cattra → vidyAcCattra
vidyā + chattra → vidyācchattra

apply-topadhasha

तत् + लभते → तल्लभते
tat + labhate → tallabhate

तद् + लभते → तल्लभते
tad + labhate → tallabhate

apply-natva

n becomes retroflex ṇ (SLP1 R) after r, ṣ or ś in the same pada.

पितर् + नः → पितर्णः
pitar + naH → pitarRaH
pitar + naḥ → pitarṇaḥ

पुर् + नः → पुर्णः
pur + naH → purRaH
pur + naḥ → purṇaḥ

apply-charva

A voiced final consonant becomes voiceless before a voiceless (khar) consonant. Opposite of apply-jashtva.

वाग् + च → वाक्च
vAg + ca → vAkca
vāg + ca → vākca

वाग् + ते → वाक्ते
vAg + te → vAkte
vāg + te → vākte

apply-pragrhya

Pragrhya words are exempt from sandhi: their final vowel stays separate.

कवी + अपि → कवी अपि
kavI + api → kavI api

साधु + अपि → साधु अपि
sADU + api → sADU api

अमी + अत्र → अमी अत्र
amI + atra → amI atra
amī + atra → amī atra

apply-guna

भूत्वा + इह → भूत्वेह
bhUtvA + iha → bhUtveha
bhūtvā + iha → bhūtveha

देव + ऋषि → देवर्षि
deva + fzi → devarzi
deva + ṛṣi → devarṣi

apply-eco-yavayava

ए
ए + इ  → अयि
e + i  → ayi

ए + उ  → अयु
e + u  → ayu

ए + ए  → अये
e + e  → aye

ए + ओ  → अयो
e + o  → ayo
ओ
ओ + इ  → अवि
o + i  → avi

ओ + उ  → अवु
o + u  → avu
ऐ
ऐ + अ  → आय
ai + a  → āya

ऐ + इ  → आयि
ai + i  → āyi
औ
औ + अ  → आव
au + a  → āva

औ + इ  → आवि
au + i  → āvi
Vocative and non-pragrhya

Pragrhya words such as deve are exempt (see apply-pragrhya).

हरे + एव → हरयेव
hare + eva → harayeva
hare + eva → harayeva

नौ + इह → नाविह
nO + iha → nAviha
nau + iha → nāviha

apply-dirgha

अ + अ → आ
a + a → ā

इ + इ → ई
i + i → ī

उ + उ → ऊ
u + u → ū

ऋ + ऋ → ॠ
ṛ + ṛ → ṝ

apply-purvarupa

ए + अ → ए
e + a → e

ओ + अ → ओ 
o + a → o

Example:

अन्ते + अपि → अन्तेऽपि

License

MIT

About

Pāṇini Aṣṭādhyāyī

Resources

Readme
MIT license

Code of conduct

Code of conduct

Contributing

Contributing
Activity
Custom properties

Stars

3 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Sponsor this project

Packages

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.