bindu 1.1.0 → 1.3.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,16 @@
1
+ 2025.12.08, v1.3.0
2
+
3
+ feature:
4
+ - e8cfd00 bindu: sindhi: apply-vriddhi: add
5
+
6
+ 2025.12.08, v1.2.0
7
+
8
+ fix:
9
+ - a95fbe5 bindu: apply-yarn: report: iko yaṇaci
10
+
11
+ feature:
12
+ - d51a2dd bindu: sandhi: apply-guna: add
13
+
1
14
  2025.12.07, v1.1.0
2
15
 
3
16
  feature:
package/README.md CHANGED
@@ -39,8 +39,10 @@ places[0].message;
39
39
 
40
40
  ## Rules
41
41
 
42
- - ✅[`sandhi/apply-dirgha`](https://putout.cloudcmd.io/#/gist/0ad8154614be489ae50931109618100a/5ce86f7344b37fd40afeb229e6cb1f668d4f92fd);
43
- - ✅[`sandhi/apply-yan`](https://putout.cloudcmd.io/#/gist/3091528d3d3eb095032fbec200599df0/c4dcefa2d29fd85f9d3d768b6eaf6934fd5a3fbb);
42
+ - ✅[`sandhi/apply-dirgha`](https://putout.cloudcmd.io/#/gist/0ad8154614be489ae50931109618100a/5ce86f7344b37fd40afeb229e6cb1f668d4f92fd): [अकः सवर्णे दीर्घः](https://www.learnsanskrit.org/vyakarana/sounds/ac-sandhi/?utm_source=chatgpt.com#:~: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);
43
+ - ✅[`sandhi/apply-yan`](https://putout.cloudcmd.io/#/gist/3091528d3d3eb095032fbec200599df0/c4dcefa2d29fd85f9d3d768b6eaf6934fd5a3fbb): [इको यणचि](https://www.learnsanskrit.org/vyakarana/sounds/vidhi-rules);
44
+ - ✅[`sandhi/apply-guna`](https://putout.cloudcmd.io/#/gist/c057229cbbedf356c1d317022141f8ca/dea60bda78c84f12aef77a9e08bc17274d66c65e): [आद्गुणः](https://www.learnsanskrit.org/panini/vowel/?utm_source=chatgpt.com#:~: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);
45
+ - ✅[`sandhi/apply-vriddhi`](https://putout.cloudcmd.io/#/gist/7cdc2383c74d7afeb8cfd93df7b5f868/79b1c979be725fc082cf81991b16fac527cfcd7b): [वृद्धिरेचि](https://www.learnsanskrit.org/panini/vowel/?utm_source=chatgpt.com#:~:text=and%20%C4%81.-,6.1.88,-%E0%A4%B5%E0%A5%83%E0%A4%A6%E0%A5%8D%E0%A4%A7%E0%A4%BF%E0%A4%B0%E0%A5%87%E0%A4%9A%E0%A4%BF);
44
46
 
45
47
  ## License
46
48
 
package/lib/bindu.js CHANGED
@@ -5,7 +5,8 @@ import * as sandhi from './sandhi/index.js';
5
5
  export const toSLP1 = (a) => Sanscript.t(a, 'devanagari', 'slp1');
6
6
  export const toDevanagari = (a) => Sanscript.t(a, 'slp1', 'devanagari');
7
7
 
8
- export const bindu = (text, {fix = true} = {}) => {
8
+ export const bindu = (text, overrides = {}) => {
9
+ const {fix = true, type} = overrides;
9
10
  const source = toSLP1(text)
10
11
  .replaceAll(' ', ',')
11
12
  .replaceAll('|', '_');
@@ -21,8 +22,18 @@ export const bindu = (text, {fix = true} = {}) => {
21
22
  .replaceAll(/[,;()]/g, '')
22
23
  .slice(0, -1);
23
24
 
25
+ if (type === 'slp1')
26
+ return {
27
+ code: convertDashToDanda(cleanText),
28
+ places,
29
+ };
30
+
24
31
  return {
25
- code: toDevanagari(cleanText).replaceAll('_', '|'),
32
+ code: convertDashToDanda(toDevanagari(cleanText)),
26
33
  places,
27
34
  };
28
35
  };
36
+
37
+ const convertDashToDanda = (a) => {
38
+ return a.replaceAll('_', '|');
39
+ };
@@ -0,0 +1,47 @@
1
+ import {operator} from 'putout';
2
+
3
+ const {remove} = operator;
4
+ const SANDHI = {
5
+ i: 'e',
6
+ u: 'o',
7
+ };
8
+
9
+ export const report = () => `ād‑guṇaḥ`;
10
+
11
+ export const fix = ({path, next, name, nextName, guna}) => {
12
+ path.node.name = `${name.slice(0, -1)}${guna}${nextName.slice(1)}`;
13
+ remove(next);
14
+ };
15
+
16
+ export const traverse = ({push}) => ({
17
+ Identifier(path) {
18
+ const next = path.getNextSibling();
19
+
20
+ if (!next.node)
21
+ return;
22
+
23
+ const {name} = path.node;
24
+ const nextName = next.node.name;
25
+
26
+ const last = name
27
+ .at(-1)
28
+ .toLowerCase();
29
+
30
+ const first = nextName
31
+ .at(0)
32
+ .toLowerCase();
33
+
34
+ if (last !== 'a' || !/[iu]/.test(first))
35
+ return;
36
+
37
+ const guna = SANDHI[first];
38
+
39
+ push({
40
+ path,
41
+ next,
42
+ guna,
43
+ name,
44
+ nextName,
45
+ });
46
+ },
47
+ });
@@ -0,0 +1,47 @@
1
+ import {operator} from 'putout';
2
+
3
+ const {remove} = operator;
4
+ const SANDHI = {
5
+ e: 'ai',
6
+ o: 'au',
7
+ };
8
+
9
+ export const report = () => `vṛddhireci`;
10
+
11
+ export const fix = ({path, next, name, nextName, vriddhi}) => {
12
+ path.node.name = `${name.slice(0, -1)}${vriddhi}${nextName.slice(1)}`;
13
+ remove(next);
14
+ };
15
+
16
+ export const traverse = ({push}) => ({
17
+ Identifier(path) {
18
+ const next = path.getNextSibling();
19
+
20
+ if (!next.node)
21
+ return;
22
+
23
+ const {name} = path.node;
24
+ const nextName = next.node.name;
25
+
26
+ const last = name
27
+ .at(-1)
28
+ .toLowerCase();
29
+
30
+ const first = nextName
31
+ .at(0)
32
+ .toLowerCase();
33
+
34
+ if (last !== 'a' || !/[eo]/.test(first))
35
+ return;
36
+
37
+ const vriddhi = SANDHI[first];
38
+
39
+ push({
40
+ path,
41
+ next,
42
+ vriddhi,
43
+ name,
44
+ nextName,
45
+ });
46
+ },
47
+ });
@@ -22,7 +22,7 @@ const SVARA = [
22
22
  'o',
23
23
  ];
24
24
 
25
- export const report = () => `acvaṅgā ya va ra la`;
25
+ export const report = () => `iko yaṇaci`;
26
26
 
27
27
  export const fix = ({path, next, name, nextName, yan}) => {
28
28
  path.node.name = `${name.slice(0, -1)}${yan}${nextName}`;
@@ -1,7 +1,11 @@
1
+ import * as applyVriddhi from './apply-vriddhi/index.js';
2
+ import * as applyGuna from './apply-guna/index.js';
1
3
  import * as applyYan from './apply-yan/index.js';
2
4
  import * as applyDirgha from './apply-dirgha/index.js';
3
5
 
4
6
  export const rules = {
5
7
  'apply-dirgha': applyDirgha,
6
8
  'apply-yan': applyYan,
9
+ 'apply-guna': applyGuna,
10
+ 'apply-vriddhi': applyVriddhi,
7
11
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bindu",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "Pāṇini Aṣṭādhyāyī",
5
5
  "main": "lib/bindu.js",
6
6
  "bin": {