bindu 1.8.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ChangeLog CHANGED
@@ -1,3 +1,14 @@
1
+ 2025.12.19, v1.9.0
2
+
3
+ feature:
4
+ - 7bb407a bindu: sandhi: apply-bhobhago: add
5
+ - 87cb189 bindu: apply-rori: add
6
+
7
+ 2025.12.15, v1.8.1
8
+
9
+ feature:
10
+ - 3e8aee4 bindu: sandhi: ayadaya: improve
11
+
1
12
  2025.12.15, v1.8.0
2
13
 
3
14
  feature:
package/README.md CHANGED
@@ -45,6 +45,8 @@ places[0].message;
45
45
 
46
46
  ### Sandhi
47
47
 
48
+ #### ac
49
+
48
50
  - ✅[`sandhi/apply-dirgha`](https://putout.cloudcmd.io/#/gist/0ad8154614be489ae50931109618100a/5ce86f7344b37fd40afeb229e6cb1f668d4f92fd): [अकः सवर्णे दीर्घः](https://www.learnsanskrit.org/vyakarana/sounds/ac-sandhi/#:~:text=a%20new%20rule%3A-,%E0%A4%85%E0%A4%95%E0%A4%83%20%E0%A4%B8%E0%A4%B5%E0%A4%B0%E0%A5%8D%E0%A4%A3%E0%A5%87%20%E0%A4%A6%E0%A5%80%E0%A4%B0%E0%A5%8D%E0%A4%98%E0%A4%83%E0%A5%A4%20%E0%A5%AC.%E0%A5%A7.%E0%A5%A7%E0%A5%A6%E0%A5%A7,-aka%E1%B8%A5%20savar%E1%B9%87e%20d%C4%ABrgha%E1%B8%A5);
49
51
  - ✅[`sandhi/apply-yan`](https://putout.cloudcmd.io/#/gist/3091528d3d3eb095032fbec200599df0/c4dcefa2d29fd85f9d3d768b6eaf6934fd5a3fbb): [इको यणचि](https://www.learnsanskrit.org/vyakarana/sounds/vidhi-rules);
50
52
  - ✅[`sandhi/apply-guna`](https://putout.cloudcmd.io/#/gist/c057229cbbedf356c1d317022141f8ca/dea60bda78c84f12aef77a9e08bc17274d66c65e): [आद्गुणः](https://www.learnsanskrit.org/panini/vowel/#:~:text=in%20ayav%C4%81y%C4%81v.-,6.1.87,-%E0%A4%86%E0%A4%A6%E0%A5%8D%E0%A4%97%E0%A5%81%E0%A4%A3%E0%A4%83);
@@ -52,6 +54,10 @@ places[0].message;
52
54
  - ✅[`sandhi/apply-purvarupa`](https://putout.cloudcmd.io/#/gist/23e2b612a185529ea6823e5f81d35b7d/2ace30ac469be03af1c41911b78d85e85b9a1120): [एकः पूर्वपरयोः](https://www.learnsanskrit.org/panini/vowel/#:~:text=this%20rule%20mean%3F-,%E0%A4%8F%E0%A4%95%E0%A4%83%20%E0%A4%AA%E0%A5%82%E0%A4%B0%E0%A5%8D%E0%A4%B5%E0%A4%AA%E0%A4%B0%E0%A4%AF%E0%A5%8B%E0%A4%83,-eka%E1%B8%A5%20p%C5%ABrvaparayo%E1%B8%A5)
53
55
  - ✅[`sandhi/apply-ayadaya`](https://putout.cloudcmd.io/#/gist/39db56c40174f61caed795c2a2dc89a7/dc956c6b0834167d9814ba70036674f4a10f56f9): [आयादयः](https://www.learnsanskrit.org/references/sandhi/vowel/#:~:text=madhu%20iva%20%E2%86%92%20madhviva-,Now,-%2C%20some%20examples%20for)
54
56
  - ✅[`sandhi/apply-padantad`](https://putout.cloudcmd.io/#/gist/f73f49bf102a6f2ab34a100ee29f81cc/6b1c3f1595841a08a035437924165e4b8d27896d): [एङः पदान्तादति](https://www.gingersunrise.com/i/133147357/एङ-पदनतदत);
57
+
58
+ #### visarga
59
+ - ✅[`sandhi/apply-rori`](https://putout.cloudcmd.io/#/gist/839c4d49726a2f869dc2854a110001d9/f443ecb1522b2b0f8d18a86eaaf8bdfe9325eaf6): [रो रि।](https://www.learnsanskrit.org/vyakarana/sounds/hal-sandhi/#:~:text=rule%208.3.15%20below%3A-,%E0%A4%B0%E0%A5%8B%20%E0%A4%B0%E0%A4%BF%E0%A5%A4%20%E0%A5%AE.%E0%A5%A9.%E0%A5%A7%E0%A5%AA,-ro%20ri%20);
60
+ - ✅[`sandhi/apply-bhobhago`](https://putout.cloudcmd.io/#/gist/839c4d49726a2f869dc2854a110001d9/f443ecb1522b2b0f8d18a86eaaf8bdfe9325eaf6): [भोभगोअघोअपूर्वस्य योऽशि](https://ashtadhyayi.com/sutraani/8/3/17);
55
61
 
56
62
  #### apply-padantad
57
63
 
@@ -76,6 +82,60 @@ au + a → au'
76
82
  bhoati → bhavati
77
83
  ```
78
84
 
85
+ #### apply-ayadaya
86
+
87
+ ##### ए
88
+
89
+ ```
90
+ ए + अ → अय
91
+ e + a → aya
92
+
93
+ ए + इ → अयि
94
+ e + i → ayi
95
+
96
+ ए + उ → अयु
97
+ e + u → ayu
98
+
99
+ ए + ए → एय
100
+ e + e → eye
101
+
102
+ ए + ओ → एयो
103
+ e + o → eyo
104
+ ```
105
+
106
+ ##### ओ
107
+
108
+ ```
109
+ ओ + अ → अव
110
+ o + a → av
111
+
112
+ ओ + इ → अवि
113
+ o + i → avi
114
+
115
+ ओ + उ → अवु
116
+ o + u → avu
117
+ ```
118
+
119
+ ##### ऐ
120
+
121
+ ```
122
+ ऐ + अ → आय
123
+ ai + a → āya
124
+
125
+ ऐ + इ → आयि
126
+ ai + i → āyi
127
+ ```
128
+
129
+ ##### औ
130
+
131
+ ```
132
+ औ + अ → आव
133
+ au + a → āvā
134
+
135
+ औ + इ → आवि
136
+ au + i → āvi
137
+ ```
138
+
79
139
  #### apply-dirgha
80
140
 
81
141
  ```
package/lib/bindu.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import putout from 'putout';
2
2
  import Sanscript from '@indic-transliteration/sanscript';
3
- import * as sandhi from './sandhi/index.js';
3
+ import * as acSandhi from './sandhi/ac/index.js';
4
+ import * as visargaSandhi from './sandhi/visarga/index.js';
4
5
  import {postProcess, preProcess} from './process.js';
5
6
 
6
7
  export const toSLP1 = (a) => Sanscript.t(a, 'devanagari', 'slp1');
@@ -14,7 +15,8 @@ export const bindu = (text, overrides = {}) => {
14
15
  const {code, places} = putout(source, {
15
16
  fix,
16
17
  plugins: [
17
- ['sandhi', sandhi],
18
+ ['sandhi/ac', acSandhi],
19
+ ['sandhi/visarga', visargaSandhi],
18
20
  ],
19
21
  });
20
22
 
@@ -0,0 +1,3 @@
1
+ export const astiAc = (a) => {
2
+ return /[aoiufx]/.test(a);
3
+ };
@@ -0,0 +1,69 @@
1
+ import {operator} from 'putout';
2
+ import {avagraha} from '../../../symbols.js';
3
+
4
+ const {remove} = operator;
5
+
6
+ export const report = () => `ayādayaḥ`;
7
+
8
+ export const fix = ({path, next, name, nextName}) => {
9
+ remove(next);
10
+
11
+ if (name.endsWith('au')) {
12
+ path.node.name = `${name.slice(0, -1)}Av${nextName}`;
13
+ return;
14
+ }
15
+
16
+ if (name.endsWith('ai')) {
17
+ path.node.name = `${name.slice(0, -2)}Ay${nextName}`;
18
+ return;
19
+ }
20
+
21
+ if (name.endsWith('e')) {
22
+ if (nextName.startsWith('a')) {
23
+ path.node.name = `${name.slice(0, -1)}aye${avagraha.code}${nextName.slice(1)}`;
24
+ return;
25
+ }
26
+
27
+ path.node.name = `${name.slice(0, -1)}ay${nextName}`;
28
+ return;
29
+ }
30
+
31
+ if (name.endsWith('o')) {
32
+ path.node.name = `${name.slice(0, -1)}av${nextName}`;
33
+ return;
34
+ }
35
+ };
36
+
37
+ export const traverse = ({push}) => ({
38
+ Identifier(path) {
39
+ const next = path.getNextSibling();
40
+
41
+ if (!next.node)
42
+ return;
43
+
44
+ const {name} = path.node;
45
+ const nextName = next.node.name;
46
+
47
+ if (!/([eo]|a[iu])$/.test(name))
48
+ return;
49
+
50
+ if (name.endsWith('e') && !/^[aueio]/.test(nextName))
51
+ return;
52
+
53
+ if (name.endsWith('o') && !/^[aiu]/.test(nextName))
54
+ return;
55
+
56
+ if (name.endsWith('ai') && !/^[ai]/.test(nextName))
57
+ return;
58
+
59
+ if (name.endsWith('au') && !/^[ai]/.test(nextName))
60
+ return;
61
+
62
+ push({
63
+ path,
64
+ next,
65
+ name,
66
+ nextName,
67
+ });
68
+ },
69
+ });
@@ -1,5 +1,5 @@
1
1
  import {operator} from 'putout';
2
- import {avagraha} from '../../symbols.js';
2
+ import {avagraha} from '../../../symbols.js';
3
3
 
4
4
  const {remove} = operator;
5
5
 
@@ -0,0 +1,47 @@
1
+ import {operator} from 'putout';
2
+ import {astiAc} from '../../../pratyahara.js';
3
+
4
+ const {remove} = operator;
5
+ const purvasya = [
6
+ 'bhoH',
7
+ 'bhagoH',
8
+ 'aghoH',
9
+ 'namaH',
10
+ ];
11
+
12
+ export const report = () => `bhobhago’gho’pūrvasya yo’śi`;
13
+
14
+ export const fix = ({path, next, name, nextName}) => {
15
+ path.node.name = `${name.slice(0, -2)}o'${nextName}`;
16
+ remove(next);
17
+ };
18
+
19
+ export const traverse = ({push}) => ({
20
+ Identifier(path) {
21
+ const next = path.getNextSibling();
22
+
23
+ if (!next.node)
24
+ return;
25
+
26
+ const {name} = path.node;
27
+
28
+ if (!purvasya.includes(name))
29
+ return;
30
+
31
+ const nextName = next.node.name;
32
+
33
+ const first = nextName
34
+ .at(0)
35
+ .toLowerCase();
36
+
37
+ if (!astiAc(first))
38
+ return;
39
+
40
+ push({
41
+ path,
42
+ next,
43
+ name,
44
+ nextName,
45
+ });
46
+ },
47
+ });
@@ -0,0 +1,39 @@
1
+ import {operator} from 'putout';
2
+ import {astiAc} from '../../../pratyahara.js';
3
+
4
+ const {remove} = operator;
5
+
6
+ export const report = () => `ro ri`;
7
+
8
+ export const fix = ({path, next, name, nextName}) => {
9
+ path.node.name = `${name.slice(0, -1)}r${nextName}`;
10
+ remove(next);
11
+ };
12
+
13
+ export const traverse = ({push}) => ({
14
+ Identifier(path) {
15
+ const next = path.getNextSibling();
16
+
17
+ if (!next.node)
18
+ return;
19
+
20
+ const {name} = path.node;
21
+ const nextName = next.node.name;
22
+
23
+ const first = nextName
24
+ .at(0)
25
+ .toLowerCase();
26
+
27
+ const last = name.at(-1);
28
+
29
+ if (last !== 'H' || !astiAc(first))
30
+ return;
31
+
32
+ push({
33
+ path,
34
+ next,
35
+ name,
36
+ nextName,
37
+ });
38
+ },
39
+ });
@@ -0,0 +1,7 @@
1
+ import * as applyBhobhago from './apply-bhobhago/index.js';
2
+ import * as applyRori from './apply-rori/index.js';
3
+
4
+ export const rules = {
5
+ 'apply-bhobhago': applyBhobhago,
6
+ 'apply-rori': applyRori,
7
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bindu",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "Pāṇini Aṣṭādhyāyī",
5
5
  "main": "lib/bindu.js",
6
6
  "bin": {
@@ -1,46 +0,0 @@
1
- import {operator} from 'putout';
2
-
3
- const {remove} = operator;
4
-
5
- export const report = () => `ayādayaḥ`;
6
-
7
- export const fix = ({path, next, name, nextName}) => {
8
- remove(next);
9
-
10
- if (nextName.startsWith('a')) {
11
- path.node.name = `${name}${nextName.slice(1)}`;
12
- return;
13
- }
14
-
15
- if (nextName.startsWith('ya')) {
16
- path.node.name = `${name.slice(0, -1)}${nextName.slice(1)}`;
17
- return;
18
- }
19
-
20
- path.node.name = `${name.slice(0, -1)}i${nextName.slice(1)}`;
21
- };
22
-
23
- export const traverse = ({push}) => ({
24
- Identifier(path) {
25
- const next = path.getNextSibling();
26
-
27
- if (!next.node)
28
- return;
29
-
30
- const {name} = path.node;
31
- const nextName = next.node.name;
32
-
33
- if (!name.endsWith('ya'))
34
- return;
35
-
36
- if (!/^(i|a|ya)/.test(nextName))
37
- return;
38
-
39
- push({
40
- path,
41
- next,
42
- name,
43
- nextName,
44
- });
45
- },
46
- });
File without changes
File without changes