uchcharan 0.1.0 → 0.1.1

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.
Files changed (3) hide show
  1. package/README.md +13 -0
  2. package/package.json +28 -6
  3. package/src/rules.js +1 -1
package/README.md CHANGED
@@ -90,3 +90,16 @@ Contributions are welcome, especially from native speakers checking number words
90
90
  ## License
91
91
 
92
92
  MIT
93
+
94
+ ## Self-host the API
95
+
96
+ ```bash
97
+ npm start # http://localhost:7860
98
+ curl -X POST localhost:7860/v1/normalize -H "content-type: application/json" \
99
+ -d '{"text":"₹2.5 crore, PNR 4521879630","lang":"hi"}'
100
+ ```
101
+
102
+ - `POST /v1/normalize` takes `{ text, lang?, explain?, spellAcronyms? }`
103
+ - `POST /v1/normalize/batch` takes `{ items: string[], lang? }`, up to 100 items
104
+ - Free tier: 500 requests per IP per day (`FREE_DAILY_LIMIT`). Paid keys go in `API_KEYS` (comma-separated) and are sent as `x-api-key`.
105
+ - To deploy on Vercel, import this repo. `vercel.json` is already set up.
package/package.json CHANGED
@@ -1,17 +1,39 @@
1
1
  {
2
2
  "name": "uchcharan",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Make any TTS speak Indian text correctly. Normalizes ₹ amounts, lakh/crore, dates, times, phone numbers, PNR/OTP, %, units and acronyms into spoken Hindi and Marathi.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
7
7
  "exports": "./src/index.js",
8
- "bin": { "uchcharan": "bin/uchcharan.js" },
9
- "files": ["src", "bin", "README.md", "LICENSE"],
8
+ "bin": {
9
+ "uchcharan": "bin/uchcharan.js"
10
+ },
11
+ "files": [
12
+ "src",
13
+ "bin",
14
+ "README.md",
15
+ "LICENSE"
16
+ ],
10
17
  "scripts": {
11
18
  "test": "node --test",
12
- "demo": "node examples/demo.js"
19
+ "demo": "node examples/demo.js",
20
+ "start": "node server/server.js",
21
+ "build:web": "node scripts/build-web.js"
22
+ },
23
+ "engines": {
24
+ "node": ">=18"
13
25
  },
14
- "engines": { "node": ">=18" },
15
- "keywords": ["tts", "text-normalization", "hindi", "marathi", "indic", "voice-ai", "speech", "elevenlabs", "sarvam", "ivr"],
26
+ "keywords": [
27
+ "tts",
28
+ "text-normalization",
29
+ "hindi",
30
+ "marathi",
31
+ "indic",
32
+ "voice-ai",
33
+ "speech",
34
+ "elevenlabs",
35
+ "sarvam",
36
+ "ivr"
37
+ ],
16
38
  "license": "MIT"
17
39
  }
package/src/rules.js CHANGED
@@ -4,7 +4,7 @@ import { intToWords, digitsToWords, numberStringToWords, yearToWords, amountWord
4
4
 
5
5
  // Number with Western (1,500,000) or Indian (15,00,000) commas, optional decimals.
6
6
  const NUM = String.raw`(?:\d{1,3}(?:,\d{3})+(?!\d)|\d{1,2}(?:,\d{2})+,\d{3}(?!\d)|\d+)(?:\.\d+)?`;
7
- const DEV = String.raw`ऀ-ॿ`;
7
+ const DEV = String.raw`\u0900-\u097F`;
8
8
  const MONTHS = String.raw`Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:t(?:ember)?)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?`;
9
9
  const MONTH_KEYS = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
10
10