lyric-romanizer 0.1.1 → 0.2.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/README.md +39 -13
- package/dist/romanizer.d.ts.map +1 -1
- package/dist/romanizer.js +60 -32
- package/dist/romanizer.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +12 -11
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/lyric-romanizer)
|
|
4
4
|
[](https://github.com/thedavidweng/lyric-romanizer/blob/main/LICENSE)
|
|
5
5
|
|
|
6
|
-
Script detection and local romanization engine for lyrics. Supports
|
|
6
|
+
Script detection and local romanization engine for lyrics. Supports 12 scripts across Japanese, Chinese (Mandarin and Cantonese), Korean, Cyrillic, Indic, Tamil, and Thai — all running locally with zero API calls.
|
|
7
7
|
|
|
8
8
|
Extracted from [Spotify Karaoke](https://github.com/haroldalan/spotify-karaoke). Used by [OpenKara](https://github.com/thedavidweng/openkara).
|
|
9
9
|
|
|
@@ -63,14 +63,14 @@ type ScriptType =
|
|
|
63
63
|
| 'devanagari' | 'gujarati' | 'gurmukhi' | 'telugu'
|
|
64
64
|
| 'kannada' | 'odia' | 'tamil' | 'malayalam'
|
|
65
65
|
| 'bengali' | 'arabic' | 'hebrew' | 'thai'
|
|
66
|
-
| '
|
|
66
|
+
| 'other';
|
|
67
67
|
|
|
68
68
|
interface Romanizer {
|
|
69
69
|
romanizeLine(line: string, options?: RomanizeOptions): Promise<string>;
|
|
70
70
|
romanizeLines(lines: readonly string[], options?: RomanizeOptions): Promise<RomanizeResult>;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
type RomanizeOptions = { script?: ScriptType };
|
|
73
|
+
type RomanizeOptions = { script?: ScriptType; dialect?: 'mandarin' | 'cantonese' };
|
|
74
74
|
type RomanizeResult = { script: ScriptType; lines: string[] };
|
|
75
75
|
type RomanizerOptions = { japaneseDictPath?: string };
|
|
76
76
|
```
|
|
@@ -128,11 +128,16 @@ requiresExternalRomanization('malayalam'); // true
|
|
|
128
128
|
|
|
129
129
|
Romanizes a single line. If `script` is omitted, it is auto-detected via `detectScript`. Returns the original line unchanged for Latin text or non-letter content.
|
|
130
130
|
|
|
131
|
+
For Chinese text, the `dialect` option controls the romanization system: `'mandarin'` (default) uses Pinyin, `'cantonese'` uses [Jyutping](https://github.com/CanCLID/to-jyutping).
|
|
132
|
+
|
|
131
133
|
**Throws** `UnsupportedRomanizationError` for external scripts.
|
|
132
134
|
|
|
133
135
|
```ts
|
|
134
136
|
await romanizer.romanizeLine('你好世界');
|
|
135
|
-
// 'nǐ hǎo shì jiè'
|
|
137
|
+
// 'nǐ hǎo shì jiè' (default: Mandarin/Pinyin)
|
|
138
|
+
|
|
139
|
+
await romanizer.romanizeLine('你好', { dialect: 'cantonese' });
|
|
140
|
+
// 'nei5 hou2' (Jyutping)
|
|
136
141
|
|
|
137
142
|
await romanizer.romanizeLine('Привет мир');
|
|
138
143
|
// 'Privet mir'
|
|
@@ -177,28 +182,49 @@ try {
|
|
|
177
182
|
|
|
178
183
|
| Script | Engine | Example |
|
|
179
184
|
|--------|--------|---------|
|
|
185
|
+
| Universal *(fallback)* | [transliteration](https://github.com/nickclaw/transliteration) | `Привет` → `Privet` |
|
|
180
186
|
| Japanese | [kuroshiro](https://github.com/sglkc/kuroshiro-ts) + [kuromoji](https://github.com/takuyaa/kuromoji.js) | `こんにちは` → `konnichiha` |
|
|
181
|
-
|
|
|
187
|
+
| Mandarin | [pinyin-pro](https://github.com/zh-lx/pinyin-pro) | `你好` → `nǐ hǎo` |
|
|
188
|
+
| Cantonese | [to-jyutping](https://github.com/CanCLID/to-jyutping) | `佢冇` → `keoi5 mou5` |
|
|
182
189
|
| Korean | [@romanize/korean](https://github.com/kntng/romanize) | `안녕` → `annyeong` |
|
|
183
190
|
| Cyrillic | [cyrillic-to-translit-js](https://github.com/greybax/CyrillicToTranslitJS) | `Привет` → `Privet` |
|
|
184
|
-
| Devanagari | [sanscript](https://github.com/indic-transliteration/sanscript
|
|
185
|
-
| Gujarati | sanscript | `નમસ્તે` → `namaste` |
|
|
186
|
-
| Gurmukhi | sanscript | `ਨਮਸਤੇ` → `namaste` |
|
|
187
|
-
| Telugu | sanscript | `నమస్తే` → `namaste` |
|
|
188
|
-
| Kannada | sanscript |
|
|
189
|
-
| Odia | sanscript | `ନମସ୍ତେ` → `namaste` |
|
|
191
|
+
| Devanagari | [sanscript](https://github.com/indic-transliteration/sanscript) | `नमस्ते` → `namaste` |
|
|
192
|
+
| Gujarati | [sanscript](https://github.com/indic-transliteration/sanscript) | `નમસ્તે` → `namaste` |
|
|
193
|
+
| Gurmukhi | [sanscript](https://github.com/indic-transliteration/sanscript) | `ਨਮਸਤੇ` → `namaste` |
|
|
194
|
+
| Telugu | [sanscript](https://github.com/indic-transliteration/sanscript) | `నమస్తే` → `namaste` |
|
|
195
|
+
| Kannada | [sanscript](https://github.com/indic-transliteration/sanscript) | `నಮస్తె` → `namaste` |
|
|
196
|
+
| Odia | [sanscript](https://github.com/indic-transliteration/sanscript) | `ନମସ୍ତେ` → `namaste` |
|
|
190
197
|
| Tamil | [tamil-romanizer](https://github.com/haroldalan/tamil-romanizer) | `வணக்கம்` → `vanakkam` |
|
|
191
198
|
| Thai | [@dehoist/romanize-thai](https://github.com/Dehoist/Open-Source) | `สวัสดี` → `sawatdi` |
|
|
192
|
-
| Latin | *(no-op)* | `Hello` → `Hello` |
|
|
193
199
|
|
|
194
200
|
### External (requires API)
|
|
195
201
|
|
|
196
|
-
|
|
202
|
+
| Script | Method |
|
|
203
|
+
|--------|--------|
|
|
204
|
+
| Malayalam | Google Translate `dt=rm` |
|
|
205
|
+
| Bengali | Google Translate `dt=rm` |
|
|
206
|
+
| Arabic | Google Translate `dt=rm` |
|
|
207
|
+
| Hebrew | Google Translate `dt=rm` |
|
|
208
|
+
| Other | Google Translate `dt=rm` |
|
|
209
|
+
|
|
210
|
+
Use `requiresExternalRomanization()` to detect these and branch to your preferred API.
|
|
197
211
|
|
|
198
212
|
## Cyrillic Detection
|
|
199
213
|
|
|
200
214
|
Cyrillic auto-detects Ukrainian-specific characters (`і`, `ї`, `є`, `ґ`) and applies the Ukrainian transliteration preset. All other Cyrillic text defaults to Russian.
|
|
201
215
|
|
|
216
|
+
## Cantonese Support
|
|
217
|
+
|
|
218
|
+
Chinese text defaults to Mandarin (Pinyin). Pass `dialect: 'cantonese'` in `RomanizeOptions` to romanize Chinese text to [Jyutping](https://github.com/CanCLID/to-jyutping) instead.
|
|
219
|
+
|
|
220
|
+
```ts
|
|
221
|
+
const { lines } = await romanizer.romanizeLines(['你好世界', '食飯'], {
|
|
222
|
+
script: 'chinese',
|
|
223
|
+
dialect: 'cantonese',
|
|
224
|
+
});
|
|
225
|
+
// ['nei5 hou2 sai3 gaai3', 'sik6 faan6']
|
|
226
|
+
```
|
|
227
|
+
|
|
202
228
|
## License
|
|
203
229
|
|
|
204
230
|
MIT
|
package/dist/romanizer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"romanizer.d.ts","sourceRoot":"","sources":["../src/romanizer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"romanizer.d.ts","sourceRoot":"","sources":["../src/romanizer.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAGV,SAAS,EACT,gBAAgB,EAChB,UAAU,EACX,MAAM,YAAY,CAAC;AAwBpB,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAExE;AA+GD,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAErE"}
|
package/dist/romanizer.js
CHANGED
|
@@ -6,6 +6,7 @@ import Sanscript from '@indic-transliteration/sanscript';
|
|
|
6
6
|
import { romanize as romanizeKorean } from '@romanize/korean';
|
|
7
7
|
import romanizeThai from '@dehoist/romanize-thai';
|
|
8
8
|
import { romanize as romanizeTamil } from 'tamil-romanizer';
|
|
9
|
+
import { transliterate } from 'transliteration';
|
|
9
10
|
import { detectScript } from './detector.js';
|
|
10
11
|
import { UnsupportedRomanizationError } from './types.js';
|
|
11
12
|
const DEFAULT_JAPANESE_DICT_PATH = 'https://cdn.jsdelivr.net/npm/kuromoji/dict';
|
|
@@ -32,6 +33,7 @@ export function requiresExternalRomanization(script) {
|
|
|
32
33
|
class DefaultRomanizer {
|
|
33
34
|
japaneseDictPath;
|
|
34
35
|
kuroshiroReady = null;
|
|
36
|
+
jyutpingReady = null;
|
|
35
37
|
constructor(options) {
|
|
36
38
|
this.japaneseDictPath = options?.japaneseDictPath ?? DEFAULT_JAPANESE_DICT_PATH;
|
|
37
39
|
}
|
|
@@ -44,39 +46,56 @@ class DefaultRomanizer {
|
|
|
44
46
|
if (requiresExternalRomanization(script)) {
|
|
45
47
|
throw new UnsupportedRomanizationError(script);
|
|
46
48
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const scheme = SANSCRIPT_SCHEME[script];
|
|
67
|
-
if (!scheme)
|
|
68
|
-
throw new Error(`Missing Sanscript scheme mapping for '${script}'.`);
|
|
69
|
-
if (!Sanscript.schemes?.[scheme]) {
|
|
70
|
-
throw new Error(`Sanscript does not support scheme '${scheme}' for '${script}'.`);
|
|
49
|
+
try {
|
|
50
|
+
switch (script) {
|
|
51
|
+
case 'japanese': {
|
|
52
|
+
const k = await this.getKuroshiro();
|
|
53
|
+
return k.convert(line, { to: 'romaji', mode: 'spaced' });
|
|
54
|
+
}
|
|
55
|
+
case 'chinese': {
|
|
56
|
+
if (options?.dialect === 'cantonese') {
|
|
57
|
+
try {
|
|
58
|
+
const jyutping = await this.getJyutpingModule();
|
|
59
|
+
const result = jyutping.getJyutpingText(line);
|
|
60
|
+
if (result)
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
// fall through to pinyin
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return pinyin(line, { toneType: 'symbol', type: 'string' });
|
|
71
68
|
}
|
|
72
|
-
|
|
69
|
+
case 'korean':
|
|
70
|
+
return romanizeKorean(line);
|
|
71
|
+
case 'cyrillic':
|
|
72
|
+
return /[іїєґ]/i.test(line)
|
|
73
|
+
? cyrillicTranslitUk.transform(line)
|
|
74
|
+
: cyrillicTranslitRu.transform(line);
|
|
75
|
+
case 'devanagari':
|
|
76
|
+
case 'gujarati':
|
|
77
|
+
case 'gurmukhi':
|
|
78
|
+
case 'telugu':
|
|
79
|
+
case 'kannada':
|
|
80
|
+
case 'odia': {
|
|
81
|
+
const scheme = SANSCRIPT_SCHEME[script];
|
|
82
|
+
if (!scheme)
|
|
83
|
+
throw new Error(`Missing Sanscript scheme mapping for '${script}'.`);
|
|
84
|
+
if (!Sanscript.schemes?.[scheme]) {
|
|
85
|
+
throw new Error(`Sanscript does not support scheme '${scheme}' for '${script}'.`);
|
|
86
|
+
}
|
|
87
|
+
return Sanscript.t(line, scheme, 'iast');
|
|
88
|
+
}
|
|
89
|
+
case 'tamil':
|
|
90
|
+
return romanizeTamil(line);
|
|
91
|
+
case 'thai':
|
|
92
|
+
return romanizeThai(line);
|
|
93
|
+
default:
|
|
94
|
+
return transliterate(line);
|
|
73
95
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return romanizeThai(line);
|
|
78
|
-
default:
|
|
79
|
-
throw new UnsupportedRomanizationError(script);
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
return transliterate(line);
|
|
80
99
|
}
|
|
81
100
|
}
|
|
82
101
|
async romanizeLines(lines, options) {
|
|
@@ -87,7 +106,7 @@ class DefaultRomanizer {
|
|
|
87
106
|
if (script === 'latin') {
|
|
88
107
|
return { script, lines: [...lines] };
|
|
89
108
|
}
|
|
90
|
-
const romanized = await Promise.all(lines.map((line) => this.romanizeLine(line, { script })));
|
|
109
|
+
const romanized = await Promise.all(lines.map((line) => this.romanizeLine(line, { script, dialect: options?.dialect })));
|
|
91
110
|
return { script, lines: romanized };
|
|
92
111
|
}
|
|
93
112
|
async getKuroshiro() {
|
|
@@ -105,6 +124,15 @@ class DefaultRomanizer {
|
|
|
105
124
|
}
|
|
106
125
|
return this.kuroshiroReady;
|
|
107
126
|
}
|
|
127
|
+
async getJyutpingModule() {
|
|
128
|
+
if (!this.jyutpingReady) {
|
|
129
|
+
this.jyutpingReady = import('to-jyutping').catch((e) => {
|
|
130
|
+
this.jyutpingReady = null;
|
|
131
|
+
throw e;
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
return this.jyutpingReady;
|
|
135
|
+
}
|
|
108
136
|
}
|
|
109
137
|
export function createRomanizer(options) {
|
|
110
138
|
return new DefaultRomanizer(options);
|
package/dist/romanizer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"romanizer.js","sourceRoot":"","sources":["../src/romanizer.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,gBAAgB,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,OAAO,SAAS,MAAM,kCAAkC,CAAC;AACzD,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAA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-1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAClB,UAAU,GACV,SAAS,GACT,QAAQ,GACR,UAAU,GACV,YAAY,GACZ,UAAU,GACV,UAAU,GACV,QAAQ,GACR,SAAS,GACT,MAAM,GACN,OAAO,GACP,WAAW,GACX,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,OAAO,GACP,OAAO,CAAC;AAEZ,MAAM,MAAM,gBAAgB,GAAG;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,CAAC,EAAE,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAClB,UAAU,GACV,SAAS,GACT,QAAQ,GACR,UAAU,GACV,YAAY,GACZ,UAAU,GACV,UAAU,GACV,QAAQ,GACR,SAAS,GACT,MAAM,GACN,OAAO,GACP,WAAW,GACX,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,OAAO,GACP,OAAO,CAAC;AAEZ,MAAM,MAAM,gBAAgB,GAAG;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,OAAO,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,SAAS;IACxB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACvE,aAAa,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAC7F;AAED,qBAAa,4BAA6B,SAAQ,KAAK;IACrD,SAAgB,MAAM,EAAE,UAAU,CAAC;gBAEvB,MAAM,EAAE,UAAU;CAK/B"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAuCA,MAAM,OAAO,4BAA6B,SAAQ,KAAK;IACrC,MAAM,CAAa;IAEnC,YAAY,MAAkB;QAC5B,KAAK,CAAC,WAAW,MAAM,mCAAmC,CAAC,CAAC;QAC5D,IAAI,CAAC,IAAI,GAAG,8BAA8B,CAAC;QAC3C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lyric-romanizer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Script detection and local romanization engine for lyrics — supports Japanese, Chinese, Korean, Cyrillic, Indic scripts, Tamil, Thai, and more",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -25,13 +25,6 @@
|
|
|
25
25
|
"dist",
|
|
26
26
|
"README.md"
|
|
27
27
|
],
|
|
28
|
-
"scripts": {
|
|
29
|
-
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
30
|
-
"clean": "rm -rf dist",
|
|
31
|
-
"prepack": "npm run build",
|
|
32
|
-
"test": "vitest run",
|
|
33
|
-
"test:watch": "vitest"
|
|
34
|
-
},
|
|
35
28
|
"dependencies": {
|
|
36
29
|
"@dehoist/romanize-thai": "^1.0.0",
|
|
37
30
|
"@indic-transliteration/sanscript": "^1.3.3",
|
|
@@ -40,7 +33,9 @@
|
|
|
40
33
|
"@sglkc/kuroshiro-analyzer-kuromoji": "^1.0.1",
|
|
41
34
|
"cyrillic-to-translit-js": "^3.2.1",
|
|
42
35
|
"pinyin-pro": "^3.28.0",
|
|
43
|
-
"tamil-romanizer": "^1.0.2"
|
|
36
|
+
"tamil-romanizer": "^1.0.2",
|
|
37
|
+
"to-jyutping": "^3.1.1",
|
|
38
|
+
"transliteration": "^2.6.1"
|
|
44
39
|
},
|
|
45
40
|
"devDependencies": {
|
|
46
41
|
"typescript": "^5.7.3",
|
|
@@ -67,5 +62,11 @@
|
|
|
67
62
|
"bugs": {
|
|
68
63
|
"url": "https://github.com/thedavidweng/lyric-romanizer/issues"
|
|
69
64
|
},
|
|
70
|
-
"homepage": "https://github.com/thedavidweng/lyric-romanizer#readme"
|
|
71
|
-
|
|
65
|
+
"homepage": "https://github.com/thedavidweng/lyric-romanizer#readme",
|
|
66
|
+
"scripts": {
|
|
67
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
68
|
+
"clean": "rm -rf dist",
|
|
69
|
+
"test": "vitest run",
|
|
70
|
+
"test:watch": "vitest"
|
|
71
|
+
}
|
|
72
|
+
}
|