Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MR414N-ID
GitHub Repository: MR414N-ID/botku2
Path: blob/master/node_modules/@bochilteam/scraper/lib/esm/texts/aksarajawa.js
1126 views
1
export function latinToAksara(str, options = { mode: 'ketik', space: true }) {
2
const aksara = new Aksara(str, options);
3
return aksara.toAksara();
4
}
5
export function aksaraToLatin(str, options = { HVokal: false }) {
6
const aksara = new Aksara(str, options);
7
return aksara.toLatin();
8
}
9
// https://bennylin.github.io/transliterasijawa/
10
// https://jv.wikipedia.org/w/index.php?title=Panganggo:Bennylin/trans.js&action=raw&ctype=text/javascript
11
const SuperTrim = (str) => str.replace(/^\s*|\s*$/g, '').replace(/\s+/g, ' '); // trim string, menemukan karakter di dalam string
12
const findstr = (str, find) => {
13
for (let i = 0; i < str.length; i++)
14
if (str[i] == find)
15
return true;
16
return false;
17
};
18
const isDigit = (a) => findstr('0123456789', a);
19
const isPunct = (a) => findstr(',.><?/+=-_}{[]*&^%$#@!~`"\\|:;()', a);
20
const isVowel = (a) => findstr('AaĂăEeÈèÉéIiOoUuÊêĚěĔĕṚṛXxôâāīūōåɔə', a);
21
const isConsonant = (a) => findstr('BCDfGHJKLMNPQRSTVWYZbcdfghjklmnpqrstvwyzḌḍṆṇṢṣṬṭŊŋÑñɲś', a); // Xx are vowels (pepet)
22
const isSpecial = (a) => findstr('GgHhRrYyñn', a); // untuk bikonsonan th, dh, ng (nga dan cecak), ny, -r- (cakra), -y- (pengkal), jñ/jnya (ꦘ)
23
const isHR = (a) => findstr('HhRrŊŋ', a); // untuk layar dan wignyan dan cecak ([[:en:w:Engma]])
24
const isLW = (a) => findstr('LlWw', a); // untuk panjingan ("ng" dapat diikuti "g", "r"/cakra, "y"/pengkal, dan "w" atau "l"/panjingan)
25
const isCJ = (a) => findstr('CcJj', a); // untuk anuswara -nj- dan -nc-
26
const GetSpecialSound = (str) => {
27
const specialsoundMap = {
28
f: 'ꦥ꦳꧀',
29
v: 'ꦮ꦳꧀',
30
z: 'ꦗ꦳꧀',
31
ś: 'ꦯ꧀',
32
Q: '꧀',
33
q: '꧀' /* pangkon */
34
};
35
if (specialsoundMap[str] !== undefined)
36
return specialsoundMap[str];
37
return null;
38
};
39
class Aksara {
40
constructor(str, opts = { mode: 'ketik', space: true, HVokal: true }) {
41
this.opts = opts;
42
this.str = '';
43
this.str2 = '';
44
this.spasi = '';
45
this.str = str.toString();
46
this.angkaFlag = opts.number;
47
this.cecakFlag = opts.cecak;
48
this.diftong = opts.diftong;
49
this.modeSpasi = opts.space;
50
this.murda = opts.murda;
51
this.mode = opts.mode;
52
this.isHVokal = opts.HVokal;
53
}
54
toAksara() {
55
let i = 0;
56
let ret = '';
57
let pi = 0; // ?offset
58
const angka = {
59
0: '꧐',
60
1: '꧑',
61
2: '꧒',
62
3: '꧓',
63
4: '꧔',
64
5: '꧕',
65
6: '꧖',
66
7: '꧗',
67
8: '꧘',
68
9: '꧙'
69
};
70
this.str = SuperTrim(this.str);
71
while (i < this.str.length) {
72
if (i > 0 && isVowel(this.str[i]) && isVowel(this.str[i - 1])) {
73
// deal with words that start with multiple vocals
74
if ((this.str[i - 1] == 'a' && this.str[i] == 'a') ||
75
(this.str[i - 1] == 'i' && this.str[i] == 'i') ||
76
(this.str[i - 1] == 'u' && this.str[i] == 'u') ||
77
(this.str[i - 1] == 'a' && this.str[i] == 'i') ||
78
(this.str[i - 1] == 'a' && this.str[i] == 'u')) {
79
// specials
80
if (i == 1 || (i > 1 && !isConsonant(this.str[i - 2]))) {
81
// for example if starts with 'ai-'
82
this.str =
83
this.str.substring(0, i) +
84
'h' +
85
this.str.substring(i, this.str.length);
86
}
87
else {
88
// var modeDiftong = document.getElementsByName("diftong");
89
// for (var rad in modeDiftong) {
90
// if (modeDiftong[rad].checked)
91
// diftong = modeDiftong[rad].value;
92
// }
93
if (this.diftong) {
94
// do nothing, look in matramap table if(diftong == "tidak")
95
}
96
else {
97
this.str =
98
this.str.substring(0, i) +
99
'h' +
100
this.str.substring(i, this.str.length);
101
}
102
}
103
}
104
else if ((this.str[i - 1] == 'e' ||
105
this.str[i - 1] == 'è' ||
106
this.str[i - 1] == 'é') &&
107
(this.str[i] == 'a' || this.str[i] == 'o')) {
108
// -y-
109
this.str =
110
this.str.substring(0, i) +
111
'y' +
112
this.str.substring(i, this.str.length);
113
}
114
else if (this.str[i - 1] == 'i' &&
115
(this.str[i] == 'a' ||
116
this.str[i] == 'e' ||
117
this.str[i] == 'è' ||
118
this.str[i] == 'é' ||
119
this.str[i] == 'o' ||
120
this.str[i] == 'u')) {
121
// -y-
122
this.str =
123
this.str.substring(0, i) +
124
'y' +
125
this.str.substring(i, this.str.length);
126
}
127
else if (this.str[i - 1] == 'o' &&
128
(this.str[i] == 'a' ||
129
this.str[i] == 'e' ||
130
this.str[i] == 'è' ||
131
this.str[i] == 'é')) {
132
// -w-
133
this.str =
134
this.str.substring(0, i) +
135
'w' +
136
this.str.substring(i, this.str.length);
137
}
138
else if (this.str[i - 1] == 'u' &&
139
(this.str[i] == 'a' ||
140
this.str[i] == 'e' ||
141
this.str[i] == 'è' ||
142
this.str[i] == 'é' ||
143
this.str[i] == 'i' ||
144
this.str[i] == 'o')) {
145
// -y-
146
this.str =
147
this.str.substring(0, i) +
148
'w' +
149
this.str.substring(i, this.str.length);
150
}
151
else {
152
this.str =
153
this.str.substring(0, i) +
154
'h' +
155
this.str.substring(i, this.str.length);
156
}
157
}
158
if ((isSpecial(this.str[i]) || isLW(this.str[i]) || isCJ(this.str[i])) &&
159
!this.vowelFlag) {
160
// i++;
161
}
162
else if ((this.str[i] == 'h' && this.vowelFlag) ||
163
(!isVowel(this.str[i]) && i > 0) ||
164
this.str[i] == ' ' ||
165
isPunct(this.str[i]) ||
166
isDigit(this.str[i]) ||
167
i - pi > 5) {
168
if (!isDigit(this.str[i]) && this.angkaFlag) {
169
// turn off the flag
170
ret += '꧇​'; // with zws
171
this.angkaFlag = false;
172
}
173
if (pi < i) {
174
if (this.cecakFlag &&
175
this.GetSound(this.str.substring(pi, i)) == 'ꦁ') {
176
this.cecakFlag = false;
177
ret += 'ꦔ꧀ꦔ';
178
}
179
else if (!this.cecakFlag &&
180
this.GetSound(this.str.substring(pi, i)) == 'ꦁ') {
181
this.cecakFlag = true;
182
ret += 'ꦁ​';
183
}
184
else {
185
this.cecakFlag = false;
186
ret += this.GetSound(this.str.substring(pi, i));
187
}
188
}
189
if (this.str[i] == ' ') {
190
// var spasi, modeSpasi;
191
// var pakaiSpasi = document.getElementsByName("spasi");
192
// for (var rad in pakaiSpasi) {
193
// if (pakaiSpasi[rad].checked)
194
// modeSpasi = pakaiSpasi[rad].value;
195
// }
196
if (this.modeSpasi) {
197
// if space preceeded by open vowel, or layar/wignyan (therefore, no pangkon/virama)
198
if (i > 0 &&
199
['a', 'e', 'i', 'o', 'u', 'r', 'h', 'ě'].indexOf(this.str[i - 1]) >= 0) {
200
this.spasi = '​'; // zero-width space
201
}
202
else {
203
this.spasi = '';
204
}
205
}
206
else {
207
// if(mode == "with")
208
this.spasi = '​'; // zero-width space
209
// spasi = ' '; }//hair space http://en.wikipedia.org/wiki/Space_(punctuation)#Spaces_in_Unicode
210
}
211
ret += this.spasi;
212
}
213
if (isPunct(this.str[i])) {
214
if (this.str[i] == '.') {
215
ret += '꧉​'; // titik+zero-width space
216
pi = i + 1;
217
}
218
else if (this.str[i] == ',') {
219
ret += '꧈​'; // koma+zero-width space
220
pi = i + 1;
221
}
222
else if (this.str[i] == ':') {
223
ret += '꧇​'; // titik dua+zero-width space
224
pi = i + 1;
225
}
226
else if (this.str[i] == '|') {
227
ret += '꧋';
228
pi = i + 1;
229
/* comment out, not really a good way to do brackets
230
} else if (str[i] == '(') {
231
ret += "꧌"; pi = i + 1;
232
} else if (str[i] == ')') {
233
ret += "꧍​"; pi = i + 1;// with zws
234
*/
235
}
236
else if (this.str[i] == '-') {
237
// tanda hubung
238
ret += '​';
239
pi = i + 1;
240
}
241
else if (this.str[i] == '?' ||
242
this.str[i] == '!' ||
243
this.str[i] == '"' ||
244
this.str[i] == "'") {
245
// tanda tanya/seru/petik
246
ret += '​'; // zero-width space
247
pi = i + 1;
248
}
249
else {
250
ret += this.str[i];
251
pi = i + 1;
252
}
253
}
254
else if (isDigit(this.str[i])) {
255
if (!this.angkaFlag)
256
ret += '꧇';
257
ret += angka[this.str[i]];
258
this.angkaFlag = true;
259
pi = i + 1;
260
}
261
else {
262
pi = i;
263
}
264
this.vowelFlag = false;
265
}
266
else if (isVowel(this.str[i]) && this.str[i] != 'h') {
267
if (!isDigit(this.str[i]) && this.angkaFlag) {
268
// turn off the flag
269
ret += '꧇​'; // with zws
270
this.angkaFlag = false;
271
}
272
this.vowelFlag = true;
273
}
274
if (pi > 0 && isVowel(this.str[pi - 1])) {
275
// <vowel>ngg
276
this.vowelPrev = true;
277
}
278
else
279
this.vowelPrev = false;
280
/* not working
281
if (pi > 0 && findstr(" ",str[pi-1])) {//<vowel>ngg
282
spacePrev = true;
283
}
284
else spacePrev = false; */
285
i++;
286
} // endwhile
287
if (pi < i) {
288
ret += this.GetSound(this.str.substring(pi, i));
289
}
290
return SuperTrim(ret).toString();
291
}
292
GetMatra(str) {
293
let i = 0;
294
if (str.length < 1) {
295
return '꧀';
296
}
297
while (str[i] == 'h') {
298
i++;
299
if (i >= str.length) {
300
break;
301
}
302
}
303
if (i < str.length) {
304
str = str.substring(i);
305
}
306
const matramap1 = { e: 'ꦺ', E: 'ꦌ' }; // mode ketik
307
const matramap2 = { e: 'ꦼ', E: 'ꦄꦼ' }; // mode kopas
308
const matramap3 = {
309
// both mode ketik and kopas
310
ā: 'ꦴ',
311
â: 'ꦴ',
312
aa: 'ꦴ',
313
è: 'ꦺ',
314
é: 'ꦺ',
315
i: 'ꦶ',
316
ī: 'ꦷ',
317
ii: 'ꦷ',
318
o: 'ꦺꦴ',
319
ō: 'ꦼꦴ',
320
u: 'ꦸ',
321
ū: 'ꦹ',
322
uu: 'ꦹ',
323
x: 'ꦼ',
324
ě: 'ꦼ',
325
ĕ: 'ꦼ',
326
ê: 'ꦼ',
327
ə: 'ꦼ',
328
ô: '',
329
ă: '',
330
å: '',
331
ɔ: '',
332
A: 'ꦄ',
333
Ă: 'ꦄ',
334
È: 'ꦌ',
335
É: 'ꦌ',
336
I: 'ꦆ',
337
O: 'ꦎ',
338
U: 'ꦈ',
339
X: 'ꦄꦼ',
340
Ě: 'ꦄꦼ',
341
Ĕ: 'ꦄꦼ',
342
Ê: 'ꦄꦼ',
343
: 'ꦽ',
344
: 'ꦽ',
345
ai: 'ꦻ',
346
au: 'ꦻꦴ'
347
};
348
// var matramap, mode;
349
// var modeTranslit = document.getElementsByName("mode");
350
// for (var rad in modeTranslit) {
351
// if (modeTranslit[rad].checked)
352
// mode = modeTranslit[rad].value;
353
// }
354
if (this.mode == 'kopas')
355
var matramap = { ...matramap2, ...matramap3 };
356
// if(mode == "ketik")
357
else
358
var matramap = { ...matramap1, ...matramap3 };
359
if (matramap[str] !== undefined) {
360
return matramap[str];
361
}
362
return '';
363
}
364
GetShift(str1) {
365
const str = str1.toLowerCase(); // case insensitive
366
// var modeMurda = document.getElementsByName("murda");
367
// for (var rad in modeMurda) {
368
// if (modeMurda[rad].checked)
369
// murda = modeMurda[rad].value;
370
// }
371
if (this.murda)
372
this.str2 = str1;
373
// case sensitive (particularly the 8 characters of ꦛ ꦜ ꦝ ꦞ ꦠ ꦡ ꦢ ꦣ),
374
// for combination of murda and cakra/pengkal/panjingan
375
// if(murda == "tidak")
376
else
377
this.str2 = str1.toLowerCase(); // case insensitive
378
// V.1. 2nd letter of the consonant cluster is 'h'
379
if (this.str2.indexOf('th') == 0) {
380
// suku kata diawali 'th'
381
if (this.str2.indexOf('thl') == 0) {
382
// thl-
383
return { CoreSound: 'ꦛ꧀ꦭ', len: 3 };
384
}
385
else if (this.str2.indexOf('thr') == 0) {
386
// thr-
387
return { CoreSound: 'ꦛꦿ', len: 3 };
388
}
389
else if (this.str2.indexOf('thw') == 0) {
390
// thw-
391
return { CoreSound: 'ꦛ꧀ꦮ', len: 3 };
392
}
393
else if (this.str2.indexOf('thy') == 0) {
394
// thy-
395
return { CoreSound: 'ꦛꦾ', len: 3 };
396
}
397
else {
398
return { CoreSound: 'ꦛ', len: 2 }; // tha
399
}
400
}
401
else if (this.str2.indexOf('dh') == 0) {
402
// suku kata diawali 'dh'
403
if (this.str2.indexOf('dhl') == 0) {
404
// dhl-
405
return { CoreSound: 'ꦝ꧀ꦭ', len: 3 };
406
}
407
else if (this.str2.indexOf('dhr') == 0) {
408
// dhr-
409
return { CoreSound: 'ꦝꦿ', len: 3 };
410
}
411
else if (this.str2.indexOf('dhw') == 0) {
412
// dhw-: dhwani
413
return { CoreSound: 'ꦝ꧀ꦮ', len: 3 };
414
}
415
else if (this.str2.indexOf('dhy') == 0) {
416
// dhy-: dhyaksa
417
return { CoreSound: 'ꦝꦾ', len: 3 };
418
}
419
else {
420
return { CoreSound: 'ꦝ', len: 2 }; // dha
421
}
422
}
423
else if (this.str2.indexOf('Th') == 0) {
424
// suku kata diawali 'Th'
425
if (this.str2.indexOf('Thl') == 0) {
426
// Thl-
427
return { CoreSound: 'ꦜ꧀ꦭ', len: 3 };
428
}
429
else if (this.str2.indexOf('Thr') == 0) {
430
// Thr-
431
return { CoreSound: 'ꦜꦿ', len: 3 };
432
}
433
else if (this.str2.indexOf('Thw') == 0) {
434
// Thw-
435
return { CoreSound: 'ꦜ꧀ꦮ', len: 3 };
436
}
437
else if (this.str2.indexOf('Thy') == 0) {
438
// Thy-
439
return { CoreSound: 'ꦜꦾ', len: 3 };
440
}
441
else {
442
return { CoreSound: 'ꦜ', len: 2 }; // Tha Mahaprana
443
}
444
}
445
else if (this.str2.indexOf('Dh') == 0) {
446
// suku kata diawali 'Dh'
447
if (this.str2.indexOf('Dhl') == 0) {
448
// Dhl-
449
return { CoreSound: 'ꦞ꧀ꦭ', len: 3 };
450
}
451
else if (this.str2.indexOf('Dhr') == 0) {
452
// Dhr-
453
return { CoreSound: 'ꦞꦿ', len: 3 };
454
}
455
else if (this.str2.indexOf('Dhw') == 0) {
456
// Dhw-: Dhwani
457
return { CoreSound: 'ꦞ꧀ꦮ', len: 3 };
458
}
459
else if (this.str2.indexOf('Dhy') == 0) {
460
// Dhy-: Dhyaksa
461
return { CoreSound: 'ꦞꦾ', len: 3 };
462
}
463
else {
464
return { CoreSound: 'ꦞ', len: 2 }; // Dha Mahaprana
465
}
466
/* murda block start */
467
}
468
else if (str.indexOf('ṭh') == 0) {
469
// ṭh (aksara murda: tha mahaprana)
470
if (str.indexOf('ṭhy') == 0) {
471
return { CoreSound: 'ꦜꦾ', len: 2 };
472
}
473
else if (str.indexOf('ṭhr') == 0) {
474
return { CoreSound: 'ꦜꦿ', len: 2 };
475
}
476
else
477
return { CoreSound: 'ꦜ', len: 2 };
478
}
479
else if (str.indexOf('ḍh') == 0) {
480
// ḍh (aksara murda: dha mahaprana)
481
if (str.indexOf('ḍhy') == 0) {
482
return { CoreSound: 'ꦞꦾ', len: 2 };
483
}
484
else if (str.indexOf('ḍhr') == 0) {
485
return { CoreSound: 'ꦞꦿ', len: 2 };
486
}
487
else
488
return { CoreSound: 'ꦞ', len: 2 };
489
}
490
else if (str.indexOf('kh') == 0) {
491
// kh (aksara murda: ka murda)
492
if (str.indexOf('khl') == 0) {
493
// ka murda + panjingan la
494
return { CoreSound: 'ꦑ꧀ꦭ', len: 3 };
495
}
496
else if (str.indexOf('khr') == 0) {
497
// ka murda + cakra
498
return { CoreSound: 'ꦑꦿ', len: 3 };
499
}
500
else if (str.indexOf('khw') == 0) {
501
// ka murda + panjingan wa
502
return { CoreSound: 'ꦑ꧀ꦮ', len: 3 };
503
}
504
else if (str.indexOf('khy') == 0) {
505
// ka murda + wignyan
506
return { CoreSound: 'ꦑꦾ', len: 3 };
507
}
508
else {
509
return { CoreSound: 'ꦑ', len: 2 };
510
}
511
}
512
else if (str.indexOf('gh') == 0) {
513
// gh (aksara murda: ga murda)
514
if (str.indexOf('ghl') == 0) {
515
// ga murda + panjingan la
516
return { CoreSound: 'ꦓ꧀ꦭ', len: 3 };
517
}
518
else if (str.indexOf('ghw') == 0) {
519
// ga murda + panjingan wa
520
return { CoreSound: 'ꦓ꧀ꦮ', len: 3 };
521
}
522
else if (str.indexOf('ghr') == 0) {
523
// ga murda + cakra
524
return { CoreSound: 'ꦓꦿ', len: 3 };
525
}
526
else if (str.indexOf('ghy') == 0) {
527
// ga murda + wignyan
528
return { CoreSound: 'ꦓꦾ', len: 3 };
529
}
530
else {
531
return { CoreSound: 'ꦓ', len: 2 };
532
}
533
}
534
else if (str.indexOf('ch') == 0) {
535
// ch (aksara murda: ca murda)
536
if (str.indexOf('chl') == 0) {
537
// ca murda + panjingan la
538
return { CoreSound: 'ꦖ꧀ꦭ', len: 3 };
539
}
540
else if (str.indexOf('chr') == 0) {
541
// ca murda + cakra
542
return { CoreSound: 'ꦖꦿ', len: 3 };
543
}
544
else if (str.indexOf('chw') == 0) {
545
// ca murda + panjingan wa
546
return { CoreSound: 'ꦖ꧀ꦮ', len: 3 };
547
}
548
else if (str.indexOf('chy') == 0) {
549
// ca murda + wignyan
550
return { CoreSound: 'ꦖꦾ', len: 3 };
551
}
552
else {
553
return { CoreSound: 'ꦖ', len: 2 };
554
}
555
}
556
else if (str.indexOf('jh') == 0) {
557
// jh (aksara murda: ja mahaprana)
558
if (str.indexOf('jhl') == 0) {
559
// ja mahaprana + panjingan la
560
return { CoreSound: 'ꦙ꧀​ꦭ', len: 3 }; // with zws, otherwise the panjingan is overlapped
561
}
562
else if (str.indexOf('jhr') == 0) {
563
// ja mahaprana + cakra
564
return { CoreSound: 'ꦙꦿ', len: 3 };
565
}
566
else if (str.indexOf('jhw') == 0) {
567
// ja mahaprana + panjingan wa
568
return { CoreSound: 'ꦙ꧀ꦮ', len: 3 };
569
}
570
else if (str.indexOf('jhy') == 0) {
571
// ja mahaprana + wignyan
572
return { CoreSound: 'ꦙꦾ', len: 3 };
573
}
574
else {
575
return { CoreSound: 'ꦙ', len: 2 };
576
}
577
}
578
else if (str.indexOf('ph') == 0) {
579
// ph (aksara murda: pa murda)
580
if (str.indexOf('phl') == 0) {
581
// pa murda + panjingan la
582
return { CoreSound: 'ꦦ꧀ꦭ', len: 3 };
583
}
584
else if (str.indexOf('phr') == 0) {
585
// pa murda + cakra
586
return { CoreSound: 'ꦦꦿ', len: 3 };
587
}
588
else if (str.indexOf('phw') == 0) {
589
// pa murda + panjingan wa
590
return { CoreSound: 'ꦦ꧀ꦮ', len: 3 };
591
}
592
else if (str.indexOf('phy') == 0) {
593
// pa murda + wignyan
594
return { CoreSound: 'ꦦꦾ', len: 3 };
595
}
596
else {
597
return { CoreSound: 'ꦦ', len: 2 };
598
}
599
}
600
else if (str.indexOf('bh') == 0) {
601
// bh (aksara murda: ba murda)
602
if (str.indexOf('bhl') == 0) {
603
// ba murda + panjingan la
604
return { CoreSound: 'ꦨ꧀ꦭ', len: 3 };
605
}
606
else if (str.indexOf('bhr') == 0) {
607
// ba murda + cakra
608
return { CoreSound: 'ꦨꦿ', len: 3 };
609
}
610
else if (str.indexOf('bhw') == 0) {
611
// ba murda + panjingan wa
612
return { CoreSound: 'ꦨ꧀ꦮ', len: 3 };
613
}
614
else if (str.indexOf('bhy') == 0) {
615
// ba murda + wignyan
616
return { CoreSound: 'ꦨꦾ', len: 3 };
617
}
618
else {
619
return { CoreSound: 'ꦨ', len: 2 };
620
}
621
}
622
else if (str.indexOf('sh') == 0) {
623
// sh (aksara murda: sa murda)
624
if (str.indexOf('shl') == 0) {
625
// sa murda + panjingan la
626
return { CoreSound: 'ꦯ꧀ꦭ', len: 3 };
627
}
628
else if (str.indexOf('shr') == 0) {
629
// sa murda + cakra
630
return { CoreSound: 'ꦯꦿ', len: 3 };
631
}
632
else if (str.indexOf('shw') == 0) {
633
// sa murda + panjingan wa
634
return { CoreSound: 'ꦯ꧀ꦮ', len: 3 };
635
}
636
else if (str.indexOf('shy') == 0) {
637
// sa murda + wignyan
638
return { CoreSound: 'ꦯꦾ', len: 3 };
639
}
640
else {
641
return { CoreSound: 'ꦯ', len: 2 };
642
}
643
/* murda block end */
644
// Uncatched exception: -h followed by hy, hr, hl, hw
645
}
646
else if (str.indexOf('hh') == 0) {
647
// wignyan + ha, e.g. root word ends with 'h' with suffix -i
648
return { CoreSound: 'ꦃꦲ', len: 2 };
649
// Uncatched exception: -r followed by hy, hr, hl, hw
650
}
651
else if (str.indexOf('rh') == 0) {
652
// layar + ha
653
return { CoreSound: 'ꦂꦲ', len: 2 };
654
}
655
else if (str.indexOf('h') == 1) {
656
// h (h di posisi karakter kedua)
657
return {
658
CoreSound: '' + this.GetCoreSound(this.str2[0]).CoreSound + '꧀ꦲ',
659
len: 2
660
};
661
}
662
// V.2. 2nd letter is 'g'
663
if (str.indexOf('ng') == 0) {
664
// suku kata diawali 'ng'
665
// Uncatched exception: -ng followed by ry, rw, rl
666
if (str.indexOf('ngr') == 0) {
667
// cakra (for cecak + ra, separate by a space)
668
return { CoreSound: '' + 'ꦔꦿ', len: 3 };
669
}
670
else if (str.indexOf('ngy') == 0) {
671
// pengkal (for cecak + ya, separate by a space)
672
return { CoreSound: '' + 'ꦔꦾ', len: 3 };
673
// Uncatched exception: -ng followed by hy, hr, hl
674
}
675
else if (str.indexOf('nghw') == 0) {
676
// tyonghwa
677
return { CoreSound: '' + 'ꦁꦲ꧀ꦮ​', len: 4 };
678
}
679
else if (str.indexOf('ngg') == 0) {
680
// cecak + ga
681
if (str.indexOf('nggr') == 0) {
682
// nggronjal
683
return { CoreSound: 'ꦔ꧀ꦒꦿ', len: 4 };
684
}
685
else if (str.indexOf('nggl') == 0) {
686
// nggl-
687
return { CoreSound: 'ꦔ꧀ꦒ꧀ꦭ', len: 4 };
688
}
689
else if (str.indexOf('nggw') == 0) {
690
// nggw-, munggwing
691
return { CoreSound: 'ꦔ꧀ꦒ꧀ꦮ', len: 4 };
692
}
693
else if (str.indexOf('nggy') == 0) {
694
// nggy-, anggyat
695
return { CoreSound: 'ꦔ꧀ꦒꦾ', len: 4 };
696
}
697
else {
698
return { CoreSound: 'ꦔ꧀ꦒ', len: 3 };
699
}
700
}
701
else if (str.indexOf('ngn') == 0) {
702
// cecak + na
703
// Uncatched exception: -ng followed by ngy, ngr, ngl, ngw
704
if (str.indexOf('ngng') == 0) {
705
// ngng
706
return { CoreSound: 'ꦁ​ꦔ', len: 4 };
707
}
708
else {
709
return { CoreSound: 'ꦁ​ꦤ', len: 3 };
710
}
711
}
712
else if (str.indexOf('ngh') == 0) {
713
// cecak + ha
714
return { CoreSound: 'ꦁ​ꦲ', len: 3 };
715
}
716
else if (str.indexOf('ngc') == 0) {
717
// cecak + ca
718
return { CoreSound: 'ꦁ​ꦕ', len: 3 };
719
}
720
else if (str.indexOf('ngj') == 0) {
721
// cecak + ja
722
return { CoreSound: 'ꦁ​ꦗ', len: 3 };
723
}
724
else if (str.indexOf('ngl') == 0) {
725
// ngl, e.g. ngluwari
726
return { CoreSound: 'ꦔ꧀ꦭ', len: 3 };
727
}
728
else if (str.indexOf('ngw') == 0) {
729
// ngw, e.g. ngwiru
730
return { CoreSound: 'ꦔ꧀ꦮ', len: 3 };
731
}
732
else {
733
return { CoreSound: 'ꦁ​', len: 2 }; // cecak, with zws
734
}
735
}
736
else if (str.indexOf('gg') == 0) {
737
// 'gg', e.g. root word ends with 'g' with suffix -i
738
return { CoreSound: 'ꦒ꧀ꦒ', len: 2 };
739
}
740
else if (str.indexOf('hg') == 0) {
741
// wignyan + ga, e.g. dahgene
742
return { CoreSound: 'ꦃꦒ', len: 2 };
743
}
744
else if (str.indexOf('rg') == 0) {
745
// layar + ga, e.g. amarga
746
return { CoreSound: 'ꦂꦒ', len: 2 };
747
}
748
else if (str.indexOf('g') == 1) {
749
// g (g di posisi karakter kedua)
750
return {
751
CoreSound: '' + this.GetCoreSound(this.str2[0]).CoreSound + '꧀ꦒ',
752
len: 2
753
};
754
}
755
// V.3. 2nd letter is 'y'
756
if (str.indexOf('ny') == 0) {
757
// suku kata diawali 'ny'
758
if (str.indexOf('nyr') == 0) {
759
// cakra
760
return { CoreSound: 'ꦚꦿ', len: 3 }; /*
761
} else if (str.indexOf("nyy") == 0) { //nyy, I don't think it's possible
762
return { "CoreSound": "ꦚꦾ", "len": 3 }; */
763
}
764
else if (str.indexOf('nyl') == 0) {
765
// nyl, e.g. nylonong
766
return { CoreSound: 'ꦚ꧀ꦭ', len: 3 };
767
}
768
else if (str.indexOf('nyw') == 0) {
769
// nyw
770
return { CoreSound: 'ꦚ꧀ꦮ', len: 3 }; /*
771
} else if (str2.indexOf("Ny") == 0) { //Na murda + pengkal, unlikely combination?
772
return { "CoreSound": "ꦟꦾ", "len": 2 }; */
773
}
774
else {
775
return { CoreSound: 'ꦚ', len: 2 };
776
}
777
}
778
else if (str.indexOf('hy') == 0) {
779
// wignyan + ya / ha + pengkal -- hyang
780
return { CoreSound: 'ꦲꦾ', len: 2 };
781
}
782
else if (this.str2.indexOf('ry') == 0) {
783
// layar + ya, e.g. Suryati, Wiryadi
784
if (str.indexOf('ryy') == 0) {
785
return { CoreSound: 'ꦂꦪꦾ', len: 3 }; // 'ryy', e.g. Duryyodhana (Jawa Kuno)
786
}
787
else {
788
return { CoreSound: 'ꦂꦪ', len: 2 };
789
} /*
790
} else if (str.indexOf("yy") == 0) { //'yy', I don't think it's possible
791
return { "CoreSound": "ꦪꦾ", "len": 2 }; */
792
}
793
else if (this.str2.indexOf('qy') == 0) {
794
// qy -- only pengkal
795
return { CoreSound: 'ꦾ', len: 1 };
796
}
797
else if (str.indexOf('y') == 1) {
798
// pengkal (y di posisi karakter kedua)
799
return {
800
CoreSound: '' + this.GetCoreSound(this.str2[0]).CoreSound + 'ꦾ',
801
len: 2
802
};
803
}
804
// V.4. 2nd letter is 'r'
805
// Uncatched exception: -h followed by ry, rw, rl
806
if (str.indexOf('hr') == 0) {
807
// wignyan + ra / ha + cakra
808
return { CoreSound: 'ꦲꦿ', len: 2 };
809
}
810
else if (str.indexOf('wr') == 0) {
811
// wr -- panjingan + cakra
812
return { CoreSound: '' + 'ꦮꦿ', len: 2 };
813
// Uncatched exception: -r followed by ry, rw, rl
814
}
815
else if (str.indexOf('rr') == 0) {
816
// layar + ra (no cakra)
817
return { CoreSound: 'ꦂꦫ', len: 2 };
818
}
819
else if (this.str2.indexOf('qr') == 0) {
820
// qr -- only pasangan ra
821
return { CoreSound: '꧀ꦫ', len: 1 };
822
}
823
else if (this.str2.indexOf('qR') == 0) {
824
// qR -- only cakra
825
return { CoreSound: 'ꦿ', len: 1 };
826
}
827
else if (str.indexOf('r') == 1) {
828
// cakra (r di posisi karakter kedua)
829
return {
830
CoreSound: '' + this.GetCoreSound(this.str2[0]).CoreSound + 'ꦿ',
831
len: 2
832
};
833
}
834
// V.5. 2nd letter is 'l' or 'w'
835
// panjingan -l
836
if (str.indexOf('hl') == 0) {
837
// wignyan + la
838
return { CoreSound: 'ꦃꦭ', len: 2 };
839
}
840
else if (str.indexOf('rl') == 0) {
841
// layar + la
842
return { CoreSound: 'ꦂꦭ', len: 2 };
843
}
844
else if (str.indexOf('ll') == 0) {
845
// ll
846
return { CoreSound: 'ꦭ꧀ꦭ', len: 2 };
847
}
848
else if (str.indexOf('ql') == 0) {
849
// only panjingan
850
return { CoreSound: '꧀ꦭ', len: 2 };
851
}
852
else if (str.indexOf('l') == 1) {
853
// (l di posisi karakter kedua)
854
return {
855
CoreSound: '' + this.GetCoreSound(this.str2[0]).CoreSound + '꧀ꦭ',
856
len: 2
857
};
858
}
859
// panjingan -w
860
if (str.indexOf('hw') == 0) {
861
// wignyan + ha
862
return { CoreSound: 'ꦃꦮ', len: 2 }; // ꦲ꧀ꦮ
863
}
864
else if (str.indexOf('rw') == 0) {
865
// layar + ha
866
return { CoreSound: 'ꦂꦮ', len: 2 }; // error untuk 'rwi', 'rwab'
867
}
868
else if (str.indexOf('ww') == 0) {
869
// ww (wwang, pûrwwa) - terima kasih Mas Revo
870
return { CoreSound: 'ꦮ꧀ꦮ', len: 2 };
871
}
872
else if (str.indexOf('qw') == 0) {
873
// only panjingan
874
return { CoreSound: '꧀ꦮ', len: 2 };
875
}
876
else if (str.indexOf('w') == 1) {
877
// (w di posisi karakter kedua)
878
return {
879
CoreSound: '' + this.GetCoreSound(this.str2[0]).CoreSound + '꧀ꦮ',
880
len: 2
881
};
882
}
883
// V.6. 2nd letter is 'c' or 'j'
884
if (str.indexOf('nc') == 0) {
885
// nc
886
if (str.indexOf('ncr') == 0) {
887
// ncr -- kencrung
888
return { CoreSound: 'ꦚ꧀ꦕꦿ', len: 3 };
889
}
890
else if (str.indexOf('ncl') == 0) {
891
// ncl -- kinclong
892
return { CoreSound: 'ꦚ꧀ꦕ꧀ꦭ', len: 3 };
893
}
894
else {
895
return { CoreSound: 'ꦚ꧀ꦕ', len: 2 };
896
}
897
}
898
else if (str.indexOf('hc') == 0) {
899
// wignyan + ca
900
return { CoreSound: 'ꦃꦕ', len: 2 };
901
}
902
else if (str.indexOf('rc') == 0) {
903
// layar + ca -- arca
904
return { CoreSound: 'ꦂꦕ', len: 2 };
905
}
906
else if (str.indexOf('cc') == 0) {
907
// cc -- impossible combination in real text
908
return { CoreSound: 'ꦕ꧀ꦕ', len: 2 };
909
}
910
else if (this.str2.indexOf('qc') == 0) {
911
// only pasangan ca
912
return { CoreSound: '꧀ꦕ', len: 2 };
913
}
914
else if (str.indexOf('c') == 1) {
915
// c
916
return {
917
CoreSound: '' + this.GetCoreSound(this.str2[0]).CoreSound + '꧀ꦕ',
918
len: 2
919
};
920
}
921
if (str.indexOf('nj') == 0) {
922
// nj
923
if (str.indexOf('njr') == 0) {
924
// njr -- anjrit
925
return { CoreSound: 'ꦚ꧀ꦗꦿ', len: 3 };
926
}
927
else if (str.indexOf('njl') == 0) {
928
// njl -- anjlog
929
return { CoreSound: 'ꦚ꧀ꦗ꧀ꦭ', len: 3 };
930
}
931
else {
932
return { CoreSound: 'ꦚ꧀ꦗ', len: 2 };
933
}
934
}
935
else if (str.indexOf('hj') == 0) {
936
// wignyan + ja
937
return { CoreSound: 'ꦃꦗ', len: 2 };
938
}
939
else if (str.indexOf('rj') == 0) {
940
// layar + ja
941
return { CoreSound: 'ꦂꦗ', len: 2 };
942
}
943
else if (str.indexOf('jj') == 0) {
944
// jj -- impossible combination in real text
945
return { CoreSound: 'ꦗ꧀ꦗ', len: 2 };
946
}
947
else if (this.str2.indexOf('qj') == 0) {
948
// only pasangan ja
949
return { CoreSound: '꧀ꦗ', len: 2 };
950
}
951
else if (str.indexOf('j') == 1) {
952
// j
953
return {
954
CoreSound: '' + this.GetCoreSound(this.str2[0]).CoreSound + '꧀ꦗ',
955
len: 2
956
};
957
}
958
// V.7. 2nd letter is 'ñ' or 'n'
959
if (str.indexOf('jñ') == 0) {
960
// suku kata diawali 'jñ'
961
if (str.indexOf('jñl') == 0) {
962
// suku kata diawali 'jñ' - nya murda
963
return { CoreSound: 'ꦘ꧀ꦭ', len: 3 };
964
}
965
else if (str.indexOf('jñr') == 0) {
966
// nya murda + cakra
967
return { CoreSound: 'ꦘꦿ', len: 3 };
968
}
969
else if (str.indexOf('jñw') == 0) {
970
// nya murda + panjingan wa
971
return { CoreSound: 'ꦘ꧀ꦮ', len: 3 };
972
}
973
else if (str.indexOf('jñy') == 0) {
974
// nya murda + wignyan
975
return { CoreSound: 'ꦘꦾ', len: 3 };
976
}
977
else {
978
return { CoreSound: 'ꦘ', len: 2 };
979
}
980
}
981
else if (str.indexOf('jn') == 0) {
982
// suku kata diawali 'jn'
983
if (str.indexOf('jny') == 0) {
984
// suku kata diawali 'jny' - nya murda
985
if (str.indexOf('jnyl') == 0) {
986
// suku kata diawali 'jny' - nya murda
987
return { CoreSound: 'ꦘ꧀ꦭ', len: 4 };
988
}
989
else if (str.indexOf('jnyr') == 0) {
990
// nya murda + cakra
991
return { CoreSound: 'ꦘꦿ', len: 4 };
992
}
993
else if (str.indexOf('jnyw') == 0) {
994
// nya murda + panjingan wa
995
return { CoreSound: 'ꦘ꧀ꦮ', len: 4 };
996
}
997
else if (str.indexOf('jnyy') == 0) {
998
// nya murda + wignyan
999
return { CoreSound: 'ꦘꦾ', len: 4 };
1000
}
1001
else {
1002
return { CoreSound: 'ꦘ', len: 3 };
1003
}
1004
}
1005
else {
1006
return { CoreSound: 'ꦗ꧀ꦤ', len: 2 };
1007
}
1008
// Uncatched exception: -h followed by ngy, ngr, ngl, ngw
1009
}
1010
else if (str.indexOf('hn') == 0) {
1011
// wignyan + na
1012
return { CoreSound: 'ꦃꦤ', len: 2 };
1013
// Uncatched exception: -r followed by ngy, ngr, ngl, ngw
1014
}
1015
else if (str.indexOf('rn') == 0) {
1016
// layar + na
1017
return { CoreSound: 'ꦂꦤ', len: 2 };
1018
}
1019
else if (str.indexOf('nn') == 0) {
1020
// nn, e.g. root word ends with 'n' with suffix -i
1021
if (str.indexOf('nng') == 0) {
1022
//
1023
return { CoreSound: 'ꦤ꧀ꦁ​', len: 3 };
1024
}
1025
else if (str.indexOf('nng') == 0) {
1026
//
1027
return { CoreSound: 'ꦤ꧀ꦚ꧀', len: 3 };
1028
}
1029
else {
1030
return { CoreSound: 'ꦤ꧀ꦤ', len: 2 };
1031
}
1032
}
1033
else if (this.str2.indexOf('qn') == 0) {
1034
// only pasangan na
1035
return { CoreSound: '꧀ꦤ', len: 2 };
1036
}
1037
else if (str.indexOf('ñ') == 1) {
1038
// huruf asing sih sebenarnya, kemungkinan kecil muncul
1039
return {
1040
CoreSound: '' + this.GetCoreSound(this.str2[0]).CoreSound + '꧀ꦚ',
1041
len: 2
1042
};
1043
}
1044
else if (str.indexOf('n') == 1) {
1045
//
1046
return {
1047
CoreSound: '' + this.GetCoreSound(this.str2[0]).CoreSound + '꧀ꦤ',
1048
len: 2
1049
};
1050
}
1051
// suku kata memiliki konsonan tersebut yang tidak di posisi kedua
1052
if (str.indexOf('h') > 1 ||
1053
str.indexOf('g') > 1 ||
1054
str.indexOf('y') > 1 ||
1055
str.indexOf('r') > 1 ||
1056
str.indexOf('l') > 1 ||
1057
str.indexOf('w') > 1 ||
1058
str.indexOf('c') > 1 ||
1059
str.indexOf('j') > 1 ||
1060
str.indexOf('n') > 1 ||
1061
str.indexOf('ñ') > 1) {
1062
let sound = '';
1063
let len = 0;
1064
let index = 0;
1065
for (index = 0; index < str.length; index++) {
1066
const c = str[index];
1067
if (!isVowel(c)) {
1068
sound += this.ResolveCharacterSound(c);
1069
len++;
1070
}
1071
else {
1072
break;
1073
}
1074
}
1075
return { CoreSound: sound, len: len };
1076
}
1077
return { CoreSound: null, len: 1 };
1078
}
1079
GetCoreSound(str) {
1080
const soundMap1 = {
1081
// 26 uppercase for non-Murda, largely mirror lowercase, except AEIOU, and HR
1082
A: 'ꦄ',
1083
B: 'ꦧ',
1084
C: 'ꦕ',
1085
D: 'ꦢ',
1086
E: 'ꦌ',
1087
F: 'ꦥ꦳',
1088
G: 'ꦒ',
1089
H: 'ꦲ',
1090
I: 'ꦆ',
1091
J: 'ꦗ',
1092
K: 'ꦏ',
1093
L: 'ꦭ',
1094
M: 'ꦩ',
1095
N: 'ꦤ',
1096
O: 'ꦎ',
1097
P: 'ꦥ',
1098
Q: '꧀',
1099
R: 'ꦫ',
1100
S: 'ꦱ',
1101
T: 'ꦠ',
1102
U: 'ꦈ',
1103
V: 'ꦮ꦳',
1104
W: 'ꦮ',
1105
X: 'ꦼ',
1106
Y: 'ꦪ',
1107
Z: 'ꦰ' // Sa Mahaprana
1108
// test: ABaCaDaEFaGaHaJaKaLaMaNaOPaRaSaTaUVaWaXYaZa
1109
};
1110
const soundMap2 = {
1111
// 26 uppercase for Murda (notice for J, Q, R, and Z)
1112
A: 'ꦄ',
1113
B: 'ꦨ',
1114
C: 'ꦖ',
1115
D: 'ꦣ',
1116
E: 'ꦌ',
1117
F: 'ꦦ꦳',
1118
G: 'ꦓ',
1119
H: 'ꦲ꦳',
1120
I: 'ꦆ',
1121
J: 'ꦙ',
1122
K: 'ꦑ',
1123
L: 'ꦭ',
1124
M: 'ꦩ',
1125
N: 'ꦟ',
1126
O: 'ꦎ',
1127
P: 'ꦦ',
1128
Q: 'ꦐ',
1129
R: 'ꦬ',
1130
S: 'ꦯ',
1131
T: 'ꦡ',
1132
U: 'ꦈ',
1133
V: 'ꦮ꦳',
1134
W: 'ꦮ',
1135
X: 'ꦼ',
1136
Y: 'ꦪ',
1137
Z: 'ꦰ' // Sa mahaprana
1138
// test: ABaCaDaEFaGaHaJaKaLaMaNaOPaQaRaSaTaUVaWaXaYaZa
1139
};
1140
const soundMap3 = {
1141
// 26 lowercase + 35 special, same for both Murda or non-Murda
1142
a: 'ꦲ',
1143
b: 'ꦧ',
1144
c: 'ꦕ',
1145
d: 'ꦢ',
1146
e: 'ꦲꦺ',
1147
f: 'ꦥ꦳',
1148
g: 'ꦒ',
1149
h: 'ꦃ',
1150
i: 'ꦲꦶ',
1151
j: 'ꦗ',
1152
k: 'ꦏ',
1153
l: 'ꦭ',
1154
m: 'ꦩ',
1155
n: 'ꦤ',
1156
o: 'ꦲꦺꦴ',
1157
p: 'ꦥ',
1158
q: '꧀',
1159
r: 'ꦂ',
1160
s: 'ꦱ',
1161
t: 'ꦠ',
1162
u: 'ꦲꦸ',
1163
v: 'ꦮ꦳',
1164
w: 'ꦮ',
1165
x: 'ꦲꦼ',
1166
y: 'ꦪ',
1167
z: 'ꦗ꦳',
1168
È: 'ꦌ',
1169
É: 'ꦌ',
1170
Ê: 'ꦄꦼ',
1171
Ě: 'ꦄꦼ',
1172
Ĕ: 'ꦄꦼ',
1173
è: 'ꦲꦺ',
1174
é: 'ꦲꦺ',
1175
ê: 'ꦲꦼ',
1176
ě: 'ꦲꦼ',
1177
ĕ: 'ꦲꦼ',
1178
ə: 'ꦲꦼ',
1179
ɔ: 'ꦲ',
1180
å: 'ꦲ',
1181
ô: 'ꦲ',
1182
â: 'ꦲꦴ',
1183
ā: 'ꦲꦴ',
1184
ī: 'ꦲꦷ',
1185
ū: 'ꦲꦹ',
1186
ō: 'ꦲꦼꦴ',
1187
Ñ: 'ꦚ',
1188
ñ: 'ꦚ',
1189
ɲ: 'ꦚ',
1190
Ŋ: 'ꦔ',
1191
ŋ: 'ꦔ',
1192
: 'ꦟ',
1193
: 'ꦟ',
1194
: 'ꦝ',
1195
: 'ꦝ',
1196
: 'ꦛ',
1197
: 'ꦛ',
1198
ś: 'ꦯ',
1199
: 'ꦰ',
1200
: 'ꦰ',
1201
: 'ꦽ',
1202
: 'ꦽ' // idem
1203
// test: Èè.Éé.Êê.Ěě.Ĕĕ.Ṛṛ.ôâāīūōåɔə
1204
// test: ḌaḍaṆaṇaṢaṣaṬaṭaŊaŋaÑañaɲaśa
1205
};
1206
let soundMap;
1207
// var modeMurda = document.getElementsByName("murda");
1208
// for (var rad in modeMurda) {
1209
// if (modeMurda[rad].checked)
1210
// murda = modeMurda[rad].value;
1211
// }
1212
if (this.murda)
1213
soundMap = { ...soundMap2, ...soundMap3 };
1214
// if(murda == "tidak")
1215
else
1216
soundMap = { ...soundMap1, ...soundMap3 };
1217
const h_shift = this.GetShift(str);
1218
let core = str;
1219
if (h_shift.CoreSound == null) {
1220
if (soundMap[str.charAt(0)])
1221
core = soundMap[str.charAt(0)];
1222
return {
1223
CoreSound: core,
1224
len: 1
1225
};
1226
}
1227
else {
1228
return h_shift;
1229
}
1230
}
1231
ResolveCharacterSound(c) {
1232
const str = c.toString();
1233
if (isDigit(c)) {
1234
return '' + ('꧇' + (parseInt(c) - 0));
1235
}
1236
else if (isHR(str[0])) {
1237
return '' + this.GetCoreSound(str).CoreSound; // layar dan wignyan
1238
}
1239
else if (isCJ(str[1])) {
1240
return '' + this.GetCoreSound(str).CoreSound + '꧀'; // anuswara
1241
}
1242
else if (isConsonant(str[0])) {
1243
return '' + this.GetCoreSound(str).CoreSound + '꧀';
1244
}
1245
else {
1246
// if (isVowel(str[0])) {
1247
return '' + this.GetCoreSound(str).CoreSound;
1248
}
1249
}
1250
GetSound(str) {
1251
str = SuperTrim(str);
1252
this.str2 = str.toLowerCase();
1253
if (str == null || str == '')
1254
return '';
1255
const SpecialSound = GetSpecialSound(str);
1256
if (SpecialSound != null && str.length == 1)
1257
return SpecialSound;
1258
if (str.length == 1)
1259
return this.ResolveCharacterSound(str[0]);
1260
else {
1261
const core_sound = this.GetCoreSound(str);
1262
// return "1"+core_sound.CoreSound+"2";
1263
let matra = '';
1264
let konsonan = '';
1265
if (core_sound.len >= 1) {
1266
matra = this.GetMatra(str.substring(core_sound.len)); // xeiou (pepet, taling, suku, taling tarung, wulu, dll.)
1267
/* if () {
1268
1269
} else {
1270
1271
} */
1272
}
1273
else {
1274
matra = '';
1275
} // a/å/ɔ
1276
/* rules for some cluster like ngg- that have different behaviour depending if it's the start of a word or not.
1277
TODO: find more elegant solution */
1278
if (this.str2.indexOf('nggr') == 0) {
1279
// nggr-
1280
if (this.vowelPrev)
1281
konsonan = 'ꦁ​ꦒꦿ';
1282
// <vowel>nggr-, e.g. panggrahita
1283
// else if (matra = "")
1284
else
1285
konsonan = 'ꦔ꧀ꦒꦿ'; // <nonvowel>nggr-, i.e. nggronjal
1286
}
1287
else if (this.str2.indexOf('nggl') == 0) {
1288
// nggl-, e.g. ngglantung
1289
konsonan = 'ꦔ꧀ꦒ꧀ꦭ';
1290
}
1291
else if (this.str2.indexOf('nggw') == 0) {
1292
// nggw-, e.g. munggwing
1293
konsonan = 'ꦔ꧀ꦒ꧀ꦮ';
1294
}
1295
else if (this.str2.indexOf('nggy') == 0) {
1296
// nggy-, e.g. anggyat
1297
konsonan = 'ꦔ꧀ꦒꦾ';
1298
}
1299
else if (this.str2.indexOf('ngg') == 0) {
1300
// ngg-
1301
if (this.vowelPrev)
1302
konsonan = 'ꦁ​ꦒ';
1303
// <vowel>ngg-, e.g. tunggal
1304
// else if (spacePrev) konsonan = "​ꦔ꧀";//<space>ngg-, e.g. ditinggal nggambar (it has a zws)
1305
else
1306
konsonan = 'ꦔ꧀ꦒ'; // <nonvowel>ngg-, i.e. nggambar
1307
// for cluster longer than 4 consonants, such as "ditinggalnggambar",
1308
// need to separate it by a space, "ditinggal nggambar" to be correct
1309
}
1310
else if (this.str2.indexOf('rlx') == 0) {
1311
// r lx, e.g. pasarlxgi
1312
konsonan = 'ꦂꦊ';
1313
matra = '';
1314
}
1315
else if (this.str2.indexOf('rrx') == 0) {
1316
// r rx
1317
konsonan = 'ꦂꦉ';
1318
matra = '';
1319
}
1320
else if (this.str2.indexOf('hlx') == 0) {
1321
// h lx
1322
if (this.vowelPrev) {
1323
konsonan = 'ꦃꦊ';
1324
matra = '';
1325
}
1326
else
1327
konsonan = 'ꦲ꧀ꦭꦼ';
1328
matra = '';
1329
}
1330
else if (this.str2.indexOf('hrx') == 0) {
1331
// h rx
1332
if (this.vowelPrev) {
1333
konsonan = 'ꦃꦉ';
1334
matra = '';
1335
}
1336
else
1337
konsonan = 'ꦲꦽ';
1338
matra = '';
1339
}
1340
else if (this.str2.indexOf('qlx') == 0) {
1341
// just pasangan la + pepet
1342
konsonan = '꧀ꦭꦼ';
1343
matra = '';
1344
}
1345
else if (this.str2.indexOf('qrx') == 0) {
1346
// just cakra keret
1347
konsonan = 'ꦽ';
1348
matra = '';
1349
}
1350
else if (core_sound.CoreSound == 'ꦂꦂꦮ') {
1351
// -rw-
1352
if (this.vowelPrev)
1353
konsonan = 'ꦂꦮ';
1354
// -rw- -- arwana
1355
else
1356
konsonan = 'ꦫ꧀ꦮ'; // rw- -- rwa/rwi/rwab
1357
}
1358
else if (core_sound.CoreSound == 'ꦃꦃꦭ') {
1359
// -hl-
1360
if (this.vowelPrev)
1361
konsonan = 'ꦃꦭ';
1362
// -hl-
1363
else
1364
konsonan = 'ꦲ꧀ꦭ'; // hlam
1365
}
1366
else if (core_sound.CoreSound == 'ꦃꦃꦮ') {
1367
// -hw-
1368
if (this.vowelPrev)
1369
konsonan = 'ꦃꦮ';
1370
// -hw-
1371
else
1372
konsonan = 'ꦲ꧀ꦮ'; // hwab,hwan
1373
}
1374
else if (core_sound.CoreSound == 'ꦃꦲꦾ') {
1375
// -hy-
1376
if (this.vowelPrev)
1377
konsonan = 'ꦃꦪ';
1378
// sembahyang
1379
else
1380
konsonan = 'ꦲꦾ'; // hyang
1381
/* rules for some characters that change depends on the matra/vowel (e.g. lx and rx, and -rx) */
1382
}
1383
else if (findstr(core_sound.CoreSound, 'ꦾ') && matra == '꧀') {
1384
// pengkal
1385
konsonan = core_sound.CoreSound;
1386
matra = ''; // -y-
1387
}
1388
else if (findstr(core_sound.CoreSound, 'ꦿ') && matra == '꧀') {
1389
// cakra
1390
konsonan = core_sound.CoreSound;
1391
matra = ''; // -r-
1392
}
1393
else if (findstr(core_sound.CoreSound, 'ꦿ') && matra == 'ꦼ') {
1394
// cakra keret
1395
if ((str[0] == 'n' && str[1] == 'y') ||
1396
((str[0] == 't' || str[0] == 'd') && str[1] == 'h')) {
1397
konsonan = this.GetCoreSound(str[0] + str[1]).CoreSound + 'ꦽ';
1398
matra = ''; // nyrê-, thrê-, dhrê-
1399
}
1400
else if (str[0] == 'n' && str[1] == 'g') {
1401
if (str[2] == 'g')
1402
konsonan = 'ꦔ꧀ꦒꦽ';
1403
else
1404
konsonan = 'ꦔꦽ';
1405
matra = ''; // nggrê-/ngrê-
1406
}
1407
else {
1408
konsonan = this.GetCoreSound(str[0]).CoreSound + 'ꦽ';
1409
matra = ''; // -rê-
1410
}
1411
}
1412
else if (findstr(core_sound.CoreSound, 'ꦭ') && matra == 'ꦼ') {
1413
// nga lelet
1414
if ((str[0] == 'n' && str[1] == 'y') ||
1415
((str[0] == 't' || str[0] == 'd') && str[1] == 'h')) {
1416
konsonan = this.GetCoreSound(str[0] + str[1]).CoreSound + '꧀ꦭꦼ';
1417
matra = ''; // nylê-, thlê-, dhlê-
1418
}
1419
else if (str[0] == 'n' && str[1] == 'g') {
1420
if (str[2] == 'g')
1421
konsonan = 'ꦔ꧀ꦒ꧀ꦭꦼ';
1422
else
1423
konsonan = 'ꦔ꧀ꦭꦼ';
1424
matra = ''; // ngglê-/nglê-
1425
}
1426
else if (str[0] == 'l') {
1427
konsonan = 'ꦊ';
1428
matra = ''; // -lê-
1429
}
1430
else {
1431
konsonan = this.GetCoreSound(str[0]).CoreSound + '꧀ꦭꦼ';
1432
matra = ''; // -lê-
1433
}
1434
}
1435
else if (core_sound.CoreSound == 'ꦃ' && matra == '꧀') {
1436
// wignyan - 12 April
1437
konsonan = 'ꦲ'; // ha
1438
}
1439
else if (core_sound.CoreSound == 'ꦃ' && matra != '꧀') {
1440
// wignyan
1441
konsonan = 'ꦲ'; // ha
1442
}
1443
else if (core_sound.CoreSound == 'ꦂ' && matra == 'ꦼ') {
1444
// pa cerek
1445
konsonan = 'ꦉ';
1446
matra = ''; // rê
1447
}
1448
else if (core_sound.CoreSound == 'ꦂ' && matra == '꧀') {
1449
// layar
1450
konsonan = 'ꦫ'; // ra
1451
}
1452
else if (core_sound.CoreSound == 'ꦂ' && matra != '꧀') {
1453
// layar
1454
konsonan = 'ꦫ'; // ra
1455
}
1456
else if (core_sound.CoreSound == 'ꦁ​' && matra == '꧀') {
1457
// cecak
1458
konsonan = 'ꦁ​';
1459
matra = ''; // cecak
1460
}
1461
else if (core_sound.CoreSound == 'ꦁ​' && matra != '꧀') {
1462
// cecak
1463
konsonan = 'ꦔ'; // nga
1464
}
1465
else {
1466
konsonan = core_sound.CoreSound;
1467
}
1468
return '' + konsonan + matra;
1469
}
1470
}
1471
toLatin() {
1472
// var agt = navigator.userAgent.toLowerCase();
1473
// if (agt.indexOf("msie")!=-1) { //IE
1474
// var range = document.selection.createRange()
1475
// txt = range.text;
1476
// if (txt == '') {
1477
// var str = window.document.formText.editSrc.value;
1478
// }else{
1479
// var str = range.text;
1480
// }
1481
// }
1482
// else {
1483
// str = window.document.formText.editSrc.value;
1484
// }
1485
const ganti = (index, character, str) => str.substr(0, index) + character;
1486
const ganti2 = (index, character, str) => str.substr(0, index - 1) + character;
1487
const ganti3 = (index, character, str) => str.substr(0, index - 2) + character;
1488
// const capitalize = (index: number, character: string, str: string) =>
1489
// str.charAt(0).toUpperCase() + str.slice(1)
1490
let trans = this.str;
1491
const regexp_file = this.aksara2Latin();
1492
for (let i = 0, j = 0; i < this.str.length; i++) {
1493
if (!regexp_file[this.str[i]]) {
1494
// not Aksara Jawa
1495
trans = ganti(j, this.str[i], trans);
1496
j++;
1497
}
1498
else {
1499
if (this.str[i] == 'ꦴ' ||
1500
this.str[i] == 'ꦶ' ||
1501
this.str[i] == 'ꦸ' ||
1502
this.str[i] == 'ꦺ' ||
1503
this.str[i] == 'ꦼ') {
1504
if (i > 2 && this.str[i - 1] == 'ꦲ' && this.str[i - 2] == 'ꦲ') {
1505
// -hah-
1506
if (this.str[i] == 'ꦴ')
1507
trans = ganti3(j, 'ā', trans);
1508
else if (this.str[i] == 'ꦶ')
1509
trans = ganti3(j, 'ai', trans);
1510
else if (this.str[i] == 'ꦸ')
1511
trans = ganti3(j, 'au', trans);
1512
else if (this.str[i] == 'ꦺ')
1513
trans = ganti3(j, 'ae', trans);
1514
else if (this.str[i] == 'ꦼ')
1515
trans = ganti3(j, 'aě', trans);
1516
// str[i] == "ꦶ" || str[i] == "ꦸ" || str[i] == "ꦺ" || str[i] == "ꦼ"
1517
}
1518
else if (i > 2 && this.str[i - 1] == 'ꦲ') {
1519
// -h-
1520
if (this.str[i] == 'ꦴ')
1521
trans = ganti2(j, 'ā', trans);
1522
else if (this.str[i] == 'ꦶ')
1523
trans = ganti2(j, 'i', trans);
1524
else if (this.str[i] == 'ꦸ')
1525
trans = ganti2(j, 'u', trans);
1526
else if (this.str[i] == 'ꦺ')
1527
trans = ganti2(j, 'e', trans);
1528
else if (this.str[i] == 'ꦼ')
1529
trans = ganti2(j, 'ě', trans);
1530
} /**/
1531
else if (i > 0 &&
1532
this.str[i] == 'ꦴ' &&
1533
this.str[i - 1] == 'ꦺ') {
1534
trans = ganti2(j, 'o', trans); // -o //2 aksara -> 1 huruf
1535
}
1536
else if (i > 0 && this.str[i] == 'ꦴ' && this.str[i - 1] == 'ꦻ') {
1537
trans = ganti3(j, 'au', trans); // -au //2 aksara -> 2 huruf
1538
}
1539
else if (this.str[i] == 'ꦴ') {
1540
trans = ganti(j, 'aa', trans); // -aa
1541
j++;
1542
}
1543
else if (i > 0 &&
1544
(this.str[i] == 'ꦶ' ||
1545
this.str[i] == 'ꦸ' ||
1546
this.str[i] == 'ꦺ' ||
1547
this.str[i] == 'ꦼ') &&
1548
(this.str[i - 1] == 'ꦄ' ||
1549
this.str[i - 1] == 'ꦌ' ||
1550
this.str[i - 1] == 'ꦆ' ||
1551
this.str[i - 1] == 'ꦎ' ||
1552
this.str[i - 1] == 'ꦈ')) {
1553
trans = ganti(j, regexp_file[this.str[i]], trans);
1554
j++;
1555
}
1556
else {
1557
trans = ganti2(j, regexp_file[this.str[i]], trans);
1558
}
1559
}
1560
else if (this.str[i] == 'ꦽ' ||
1561
this.str[i] == 'ꦾ' ||
1562
this.str[i] == 'ꦿ' ||
1563
this.str[i] == 'ꦷ' ||
1564
this.str[i] == 'ꦹ' ||
1565
this.str[i] == 'ꦻ' ||
1566
this.str[i] == 'ꦇ' ||
1567
this.str[i] == 'ꦍ') {
1568
// 1 aksara -> 2 huruf
1569
trans = ganti2(j, regexp_file[this.str[i]], trans);
1570
j++;
1571
}
1572
else if (this.str[i] == '꦳') {
1573
// 2 aksara -> 2 huruf
1574
if (i > 0 && this.str[i - 1] == 'ꦗ') {
1575
if (i > 1 && this.str[i - 2] == '꧊') {
1576
trans = ganti3(j, 'Za', trans);
1577
}
1578
else {
1579
trans = ganti3(j, 'za', trans);
1580
}
1581
}
1582
else if (i > 0 && this.str[i - 1] == 'ꦥ') {
1583
if (i > 1 && this.str[i - 2] == '꧊') {
1584
trans = ganti3(j, 'Fa', trans);
1585
}
1586
else {
1587
trans = ganti3(j, 'fa', trans);
1588
}
1589
}
1590
else if (i > 0 && this.str[i - 1] == 'ꦮ') {
1591
if (i > 1 && this.str[i - 2] == '꧊') {
1592
trans = ganti3(j, 'Va', trans);
1593
}
1594
else {
1595
trans = ganti3(j, 'va', trans);
1596
} // catatan, "va" biasanya ditulis sama dengan "fa" (dengan pa+cecak telu), variannya adalah wa+cecak telu.
1597
}
1598
else if (i > 0 && this.str[i - 1] == 'ꦲ') {
1599
if (i > 1 && this.str[i - 2] == '꧊') {
1600
trans = ganti3(j, 'Ḥa', trans);
1601
}
1602
else {
1603
trans = ganti3(j, 'ḥa', trans);
1604
}
1605
}
1606
else if (i > 0 && this.str[i - 1] == 'ꦏ') {
1607
if (i > 1 && this.str[i - 2] == '꧊') {
1608
trans = ganti3(j, 'Kha', trans);
1609
j++;
1610
}
1611
else {
1612
trans = ganti3(j, 'kha', trans);
1613
j++;
1614
}
1615
}
1616
else if (i > 0 && this.str[i - 1] == 'ꦢ') {
1617
if (i > 1 && this.str[i - 2] == '꧊') {
1618
trans = ganti3(j, 'Dza', trans);
1619
j++;
1620
}
1621
else {
1622
trans = ganti3(j, 'dza', trans);
1623
j++;
1624
}
1625
}
1626
else if (i > 0 && this.str[i - 1] == 'ꦱ') {
1627
if (i > 1 && this.str[i - 2] == '꧊') {
1628
trans = ganti3(j, 'Sya', trans);
1629
j++;
1630
}
1631
else {
1632
trans = ganti3(j, 'sya', trans);
1633
j++;
1634
}
1635
}
1636
else if (i > 0 && this.str[i - 1] == 'ꦒ') {
1637
if (i > 1 && this.str[i - 2] == '꧊') {
1638
trans = ganti3(j, 'Gha', trans);
1639
j++;
1640
}
1641
else {
1642
trans = ganti3(j, 'gha', trans);
1643
j++;
1644
}
1645
}
1646
else if (i > 0 && this.str[i - 1] == 'ꦔ') {
1647
trans = ganti3(j, "'a", trans);
1648
}
1649
else {
1650
trans = ganti2(j, regexp_file[this.str[i]], trans);
1651
}
1652
}
1653
else if (this.str[i] == '꧀') {
1654
trans = ganti2(j, regexp_file[this.str[i]], trans);
1655
}
1656
else if (this.str[i] == 'ꦏ' ||
1657
this.str[i] == 'ꦐ' ||
1658
this.str[i] == 'ꦒ' ||
1659
this.str[i] == 'ꦕ' ||
1660
this.str[i] == 'ꦗ' ||
1661
this.str[i] == 'ꦟ' ||
1662
this.str[i] == 'ꦠ' ||
1663
this.str[i] == 'ꦡ' ||
1664
this.str[i] == 'ꦢ' ||
1665
this.str[i] == 'ꦣ' ||
1666
this.str[i] == 'ꦤ' ||
1667
this.str[i] == 'ꦥ' ||
1668
this.str[i] == 'ꦧ' ||
1669
this.str[i] == 'ꦩ' ||
1670
this.str[i] == 'ꦪ' ||
1671
this.str[i] == 'ꦫ' ||
1672
this.str[i] == 'ꦬ' ||
1673
this.str[i] == 'ꦭ' ||
1674
this.str[i] == 'ꦮ' ||
1675
this.str[i] == 'ꦯ' ||
1676
this.str[i] == 'ꦰ' ||
1677
this.str[i] == 'ꦱ' ||
1678
this.str[i] == 'ꦉ' ||
1679
this.str[i] == 'ꦊ' ||
1680
this.str[i] == 'ꦁ' ||
1681
this.str[i] == 'ꦲ' ||
1682
this.str[i] == 'ꦑ' ||
1683
this.str[i] == 'ꦓ' ||
1684
this.str[i] == 'ꦖ' ||
1685
this.str[i] == 'ꦙ' ||
1686
this.str[i] == 'ꦡ' ||
1687
this.str[i] == 'ꦣ' ||
1688
this.str[i] == 'ꦦ' ||
1689
this.str[i] == 'ꦨ') {
1690
if (i > 0 && this.str[i - 1] == '꧊') {
1691
if (this.str[i] == 'ꦐ') {
1692
trans = ganti(j, 'Qa', trans);
1693
j += 2;
1694
}
1695
else if (this.str[i] == 'ꦧ' || this.str[i] == 'ꦨ') {
1696
trans = ganti(j, 'Ba', trans);
1697
j += 2;
1698
}
1699
else if (this.str[i] == 'ꦕ' || this.str[i] == 'ꦖ') {
1700
trans = ganti(j, 'Ca', trans);
1701
j += 2;
1702
}
1703
else if (this.str[i] == 'ꦢ' || this.str[i] == 'ꦣ') {
1704
trans = ganti(j, 'Da', trans);
1705
j += 2;
1706
}
1707
else if (this.str[i] == 'ꦒ' || this.str[i] == 'ꦓ') {
1708
trans = ganti(j, 'Ga', trans);
1709
j += 2;
1710
}
1711
else if (this.str[i] == 'ꦲ') {
1712
if (i > 0 &&
1713
(this.str[i - 1] == 'ꦼ' ||
1714
this.str[i - 1] == 'ꦺ' ||
1715
this.str[i - 1] == 'ꦶ' ||
1716
this.str[i - 1] == 'ꦴ' ||
1717
this.str[i - 1] == 'ꦸ' ||
1718
this.str[i - 1] == 'ꦄ' ||
1719
this.str[i - 1] == 'ꦌ' ||
1720
this.str[i - 1] == 'ꦆ' ||
1721
this.str[i - 1] == 'ꦎ' ||
1722
this.str[i - 1] == 'ꦈ' ||
1723
this.str[i - 1] == 'ꦿ' ||
1724
this.str[i - 1] == 'ꦾ' ||
1725
this.str[i - 1] == 'ꦽ')) {
1726
trans = ganti(j, 'h' + regexp_file[this.str[i]], trans);
1727
j += 2;
1728
}
1729
if (i > 0 && this.str[i - 1] == '꧊') {
1730
trans = ganti(j, 'H' + regexp_file[this.str[i]], trans);
1731
j += 2;
1732
}
1733
else {
1734
trans = ganti(j, '@' + regexp_file[this.str[i]], trans);
1735
j += 2;
1736
}
1737
// trans = ganti(j, "Ha", trans);j+=2;
1738
}
1739
else if (this.str[i] == 'ꦗ' || this.str[i] == 'ꦙ') {
1740
trans = ganti(j, 'Ja', trans);
1741
j += 2;
1742
}
1743
else if (this.str[i] == 'ꦏ' || this.str[i] == 'ꦑ') {
1744
trans = ganti(j, 'Ka', trans);
1745
j += 2;
1746
}
1747
else if (this.str[i] == 'ꦭ') {
1748
trans = ganti(j, 'La', trans);
1749
j += 2;
1750
}
1751
else if (this.str[i] == 'ꦩ') {
1752
trans = ganti(j, 'Ma', trans);
1753
j += 2;
1754
}
1755
else if (this.str[i] == 'ꦤ' || this.str[i] == 'ꦟ') {
1756
trans = ganti(j, 'Na', trans);
1757
j += 2;
1758
}
1759
else if (this.str[i] == 'ꦥ' || this.str[i] == 'ꦦ') {
1760
trans = ganti(j, 'Pa', trans);
1761
j += 2;
1762
}
1763
else if (this.str[i] == 'ꦫ' || this.str[i] == 'ꦬ') {
1764
trans = ganti(j, 'Ra', trans);
1765
j += 2;
1766
}
1767
else if (this.str[i] == 'ꦱ' || this.str[i] == 'ꦯ') {
1768
trans = ganti(j, 'Sa', trans);
1769
j += 2;
1770
}
1771
else if (this.str[i] == 'ꦠ' || this.str[i] == 'ꦡ') {
1772
trans = ganti(j, 'Ta', trans);
1773
j += 2;
1774
}
1775
else if (this.str[i] == 'ꦮ') {
1776
trans = ganti(j, 'Wa', trans);
1777
j += 2;
1778
}
1779
else if (this.str[i] == 'ꦪ') {
1780
trans = ganti(j, 'Ya', trans);
1781
j += 2;
1782
}
1783
else {
1784
ganti(j, regexp_file[this.str[i]], trans);
1785
j += 3;
1786
}
1787
}
1788
else if (i > 0 && this.str[i] == 'ꦲ' && this.str[i - 1] == 'ꦃ') {
1789
// double hh
1790
trans = ganti(j, 'a', trans);
1791
j++;
1792
}
1793
else if (i > 0 && this.str[i] == 'ꦫ' && this.str[i - 1] == 'ꦂ') {
1794
// double rr
1795
trans = ganti(j, 'a', trans);
1796
j++;
1797
}
1798
else if (i > 0 && this.str[i] == 'ꦔ' && this.str[i - 1] == 'ꦁ') {
1799
// double ngng
1800
trans = ganti(j, 'a', trans);
1801
j++;
1802
}
1803
else if (i > 1 &&
1804
this.str[i] == 'ꦕ' &&
1805
this.str[i - 1] == '꧀' &&
1806
this.str[i - 2] == 'ꦚ') {
1807
// nyj & nyc
1808
trans = ganti(j - 3, 'nca', trans);
1809
}
1810
else if (i > 1 &&
1811
this.str[i] == 'ꦗ' &&
1812
this.str[i - 1] == '꧀' &&
1813
this.str[i - 2] == 'ꦚ') {
1814
// nyj & nyc
1815
trans = ganti(j - 3, 'nja', trans);
1816
}
1817
else if (this.str[i] == 'ꦲ' &&
1818
(i == 0 ||
1819
[
1820
' ',
1821
'​',
1822
'꧀',
1823
'꦳',
1824
'ꦴ',
1825
'ꦶ',
1826
'ꦷ',
1827
'ꦸ',
1828
'ꦹ',
1829
'ꦺ',
1830
'ꦻ',
1831
'ꦼ',
1832
'ꦽ',
1833
'ꦾ',
1834
'ꦿ'
1835
].indexOf(this.str[i - 1]) >= 0)) {
1836
// ha, preceeded by space or zws or open vowel
1837
trans = ganti(j, '_a', trans);
1838
j += 2;
1839
}
1840
else if (this.str[i] == 'ꦑ' ||
1841
this.str[i] == 'ꦓ' ||
1842
this.str[i] == 'ꦖ' ||
1843
this.str[i] == 'ꦙ' ||
1844
this.str[i] == 'ꦡ' ||
1845
this.str[i] == 'ꦣ' ||
1846
this.str[i] == 'ꦦ' ||
1847
this.str[i] == 'ꦨ') {
1848
// bha, cha, dha, dll.
1849
trans = ganti(j, regexp_file[this.str[i]], trans);
1850
j += 3;
1851
}
1852
else {
1853
// ba, ca, da, dll.
1854
trans = ganti(j, regexp_file[this.str[i]], trans);
1855
j += 2;
1856
}
1857
}
1858
else if (this.str[i] == 'ꦔ' ||
1859
this.str[i] == 'ꦘ' ||
1860
this.str[i] == 'ꦚ' ||
1861
this.str[i] == 'ꦛ' ||
1862
this.str[i] == 'ꦜ' ||
1863
this.str[i] == 'ꦝ' ||
1864
this.str[i] == 'ꦞ' ||
1865
this.str[i] == 'ꦋ') {
1866
// nga, nya, tha, dha
1867
if (i > 0 && this.str[i - 1] == '꧊') {
1868
if (this.str[i] == 'ꦔ') {
1869
trans = ganti(j, 'Nga', trans);
1870
j += 3;
1871
}
1872
else if (this.str[i] == 'ꦚ' || this.str[i] == 'ꦘ') {
1873
trans = ganti(j, 'Nya', trans);
1874
j += 3;
1875
}
1876
else if (this.str[i] == 'ꦛ' || this.str[i] == 'ꦜ') {
1877
trans = ganti(j, 'Tha', trans);
1878
j += 3;
1879
}
1880
else if (this.str[i] == 'ꦝ' || this.str[i] == 'ꦞ') {
1881
trans = ganti(j, 'Dha', trans);
1882
j += 3;
1883
}
1884
else {
1885
ganti(j, regexp_file[this.str[i]], trans);
1886
j += 3;
1887
}
1888
}
1889
else if (i > 0 && this.str[i] == 'ꦘ') {
1890
trans = ganti(j, regexp_file[this.str[i]], trans);
1891
j += 4;
1892
}
1893
else {
1894
trans = ganti(j, regexp_file[this.str[i]], trans);
1895
j += 3;
1896
}
1897
}
1898
else if (this.str[i] == '꧊') {
1899
// penanda nama diri -- made up for Latin back-compat
1900
trans = ganti(j, '', trans);
1901
}
1902
else if ((this.str[i] == ' ', trans)) {
1903
if (i > 0 && this.str[i - 1] == '꧀') {
1904
// pangkon diikuti regular space = koma
1905
trans = ganti(j, ', ', trans);
1906
j += 2;
1907
}
1908
else {
1909
trans = ganti(j, ' ', trans);
1910
j++;
1911
}
1912
}
1913
else if ((this.str[i] == '꧈', trans)) {
1914
if (i > 0 && this.str[i - 1] == '꧀') {
1915
// pangkon diikuti pada lingsa = titik
1916
trans = ganti(j, '.', trans);
1917
j++;
1918
}
1919
else {
1920
// pada lingsa saja = koma
1921
trans = ganti(j, ',', trans);
1922
j++;
1923
}
1924
}
1925
else {
1926
trans = ganti(j, regexp_file[this.str[i]], trans);
1927
j++;
1928
}
1929
}
1930
}
1931
trans = trans
1932
.split(' ')
1933
.map((v) => v.startsWith('_') ? v.replace('_', this.isHVokal ? '' : 'h') : v)
1934
.join(' ');
1935
return trans.toString();
1936
}
1937
aksara2Latin() {
1938
return {
1939
: 'ka',
1940
: 'qa',
1941
: 'kʰa',
1942
: 'ga',
1943
: 'gʰa',
1944
: 'nga',
1945
: 'ca',
1946
: 'cʰa',
1947
: 'ja',
1948
: 'jnya',
1949
: 'jʰa',
1950
: 'nya',
1951
: 'tha',
1952
: 'ṭʰa',
1953
: 'dha',
1954
: 'ḍʰa',
1955
: 'ṇa',
1956
: 'ta',
1957
: 'ṭa',
1958
: 'da',
1959
: 'ḍa',
1960
: 'na',
1961
: 'pa',
1962
: 'pʰa',
1963
: 'ba',
1964
: 'bʰa',
1965
: 'ma',
1966
: 'ya',
1967
: 'ra',
1968
: 'ṛa',
1969
: 'la',
1970
: 'wa',
1971
: 'śa',
1972
: 'ṣa',
1973
: 'sa',
1974
: 'ha',
1975
'ꦁ': 'ng',
1976
'ꦂ': 'r',
1977
'ꦃ': 'h',
1978
: 'A',
1979
: 'I',
1980
: 'I',
1981
: 'Ii',
1982
: 'U',
1983
: 'rê',
1984
: 'lê',
1985
: 'lêu',
1986
: 'E',
1987
: 'Ai',
1988
: 'O',
1989
'ꦺꦴ': 'o',
1990
'ꦴ': 'a',
1991
'ꦶ': 'i',
1992
'ꦷ': 'ii',
1993
'ꦸ': 'u',
1994
'ꦹ': 'uu',
1995
'ꦺ': 'e',
1996
'ꦻ': 'ai',
1997
'ꦼ': 'ê',
1998
'ꦽ': 'rê',
1999
'ꦾ': 'ya',
2000
'ꦿ': 'ra',
2001
'ꦀ': '',
2002
'꦳': '​',
2003
'꧀': '​',
2004
'꧇': '​',
2005
'꧁': '—',
2006
'꧂': '—',
2007
'꧃': '–',
2008
'꧄': '–',
2009
'꧅': '–',
2010
'꧆': '',
2011
'꧈': ',',
2012
'꧉': '.',
2013
'꧊': 'qqq',
2014
'꧋': '–',
2015
'꧌': '–',
2016
'꧍': '–',
2017
: '²',
2018
'꧐': '0',
2019
'꧑': '1',
2020
'꧒': '2',
2021
'꧓': '3',
2022
'꧔': '4',
2023
'꧕': '5',
2024
'꧖': '6',
2025
'꧗': '7',
2026
'꧘': '8',
2027
'꧙': '9',
2028
'꧞': '—',
2029
'꧟': '—',
2030
// "​": '#',//zero-width joiner
2031
'​': ' ',
2032
' ': ' ' // regular space
2033
};
2034
}
2035
}
2036
//# sourceMappingURL=aksarajawa.js.map
2037