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