hebrew-transliteration 2.1.2 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,659 +1,6 @@
1
- declare module 'hebrew-transliteration/hebCharsTrans' {
2
- import { Schema } from "hebrew-transliteration/schema";
3
- interface map {
4
- [k: string]: keyof Schema;
5
- }
6
- export const transliterateMap: map;
7
- export {};
8
-
9
- }
10
- declare module 'hebrew-transliteration/index' {
11
- import { Text } from "havarotjs";
12
- import { transliterate } from "hebrew-transliteration/transliterate";
13
- import { sequence } from "hebrew-transliteration/sequence";
14
- import { remove } from "hebrew-transliteration/remove";
15
- import { Schema } from "hebrew-transliteration/schema";
16
- export { remove, Schema, sequence, Text, transliterate };
17
-
18
- }
19
- declare module 'hebrew-transliteration/mapChars' {
20
- import { Schema } from "hebrew-transliteration/schema";
21
- /**
22
- * maps single Hebrew characters to transliteration characters according to the schema
23
- *
24
- * @param text - a single character
25
- * @param schema - a {@link Schema} for transliterating the text
26
- * @returns transliteration of single characters according to the schema
27
- *
28
- */
29
- export const mapChars: (text: string, schema: Schema) => string;
30
-
31
- }
32
- declare module 'hebrew-transliteration/remove' {
33
- /**
34
- * Options for the `remove()` function
35
- */
36
- interface RemoveOptions {
37
- /**
38
- * an option to remove vowels
39
- *
40
- * @example
41
- * ```ts
42
- * heb.remove("שָׂרַ֣י אִשְׁתְּךָ֔", { removeVowels: true });
43
- * // "שׂרי אשׁתך";
44
- * ```
45
- */
46
- removeVowels?: boolean;
47
- /**
48
- * an option to remove the shin dot (U+05C1)
49
- *
50
- * @example
51
- * ```ts
52
- * heb.remove("שָׂרַ֣י אִשְׁתְּךָ֔", { removeVowels: true, removeShinDot: true, removeSinDot: true });
53
- * // "שרי אשתך";
54
- * ```
55
- */
56
- removeShinDot?: boolean;
57
- /**
58
- * an option to remove the sin dot (U+05C2)
59
- *
60
- * @example
61
- * ```ts
62
- * heb.remove("שָׂרַ֣י אִשְׁתְּךָ֔", { removeVowels: true, removeShinDot: true, removeSinDot: true });
63
- * // "שרי אשתך";
64
- * ```
65
- */
66
- removeSinDot?: boolean;
67
- }
68
- /**
69
- * removes taamim and optionally removes certain niqqudim
70
- *
71
- * @param text - a string of Hebrew characters
72
- * @param RemoveOptions - {@link RemoveOptions}
73
- * @returns Hebrew characters with taamim and niqqud optionally removed
74
- *
75
- * @example Default
76
- *
77
- * ```ts
78
- * heb.remove("שָׂרַ֣י אִשְׁתְּךָ֔");
79
- * // "שָׂרַי אִשְׁתְּךָ";
80
- * ```
81
- *
82
- * @example Remove vowels
83
- *
84
- * ```ts
85
- * heb.remove("שָׂרַ֣י אִשְׁתְּךָ֔", { removeVowels: true });
86
- * // "שׂרי אשׁתך";
87
- * ```
88
- *
89
- * @example Remove all
90
- *
91
- * ```ts
92
- * heb.remove("שָׂרַ֣י אִשְׁתְּךָ֔", { removeVowels: true, removeShinDot: true, removeSinDot: true });
93
- * // "שרי אשתך";
94
- * ```
95
- */
96
- export const remove: (text: string, { removeVowels, removeShinDot, removeSinDot }?: RemoveOptions) => string;
97
- export {};
98
-
99
- }
100
- declare module 'hebrew-transliteration/rules' {
101
- import { Syllable } from "havarotjs/dist/syllable";
102
- import { Word } from "havarotjs/dist/word";
103
- import { Schema } from "hebrew-transliteration/schema";
104
- export const sylRules: (syl: Syllable, schema: Schema) => string;
105
- export const wordRules: (word: Word, schema: Schema) => string | Word;
106
-
107
- }
108
- declare module 'hebrew-transliteration/schema' {
109
- import { SylOpts } from "havarotjs/dist/text";
110
- /**
111
- * class for defining a schema for transliteration
112
- */
113
- export class Schema implements SylOpts {
114
- /**
115
- * HEBREW POINT SHEVA (U+05B0) ְ◌
116
- * @example
117
- * 'ǝ'
118
- */
119
- VOCAL_SHEVA: string;
120
- /**
121
- * HEBREW POINT HATAF SEGOL (U+05B1) ֱ◌
122
- * @example
123
- * 'ĕ'
124
- */
125
- HATAF_SEGOL: string;
126
- /**
127
- * HEBREW POINT HATAF PATAH (U+05B2) ֲ◌
128
- * @example
129
- * 'ă'
130
- */
131
- HATAF_PATAH: string;
132
- /**
133
- * HEBREW POINT HATAF QAMATS (U+05B3) ֳ◌
134
- * @example
135
- * 'ŏ'
136
- */
137
- HATAF_QAMATS: string;
138
- /**
139
- * HEBREW POINT HIRIQ (U+05B4) ִ◌
140
- * @example
141
- * 'i'
142
- */
143
- HIRIQ: string;
144
- /**
145
- * HEBREW POINT TSERE (U+05B5) ֵ◌
146
- * @example
147
- * 'ē'
148
- */
149
- TSERE: string;
150
- /**
151
- * HEBREW POINT SEGOL (U+05B6) ֶ◌
152
- * @example
153
- * 'e'
154
- */
155
- SEGOL: string;
156
- /**
157
- * HEBREW POINT PATAH (U+05B7) ַ◌
158
- * @example
159
- * 'a'
160
- */
161
- PATAH: string;
162
- /**
163
- * HEBREW POINT QAMATS (U+05B8) ָ◌
164
- * @example
165
- * 'ā'
166
- */
167
- QAMATS: string;
168
- /**
169
- * HEBREW POINT HOLAM (U+05B9) ֹ◌
170
- * @example
171
- * 'ō'
172
- */
173
- HOLAM: string;
174
- /**
175
- * HEBREW POINT QUBUTS (U+05BB) ֻ◌
176
- * @example
177
- * 'u'
178
- */
179
- QUBUTS: string;
180
- /**
181
- * HEBREW POINT DAGESH OR MAPIQ (U+05BC) ּ◌
182
- * @description typically, this will be a blank string
183
- * @example
184
- * ''
185
- */
186
- DAGESH: string;
187
- /**
188
- * HEBREW POINT DAGESH OR MAPIQ (U+05BC) ּ◌
189
- * @description if true, repeats the consonant with the dagesh
190
- * @example
191
- * ```js
192
- * transliterate('שַׁבָּת', { DAGESH_CHAZAQ: true });
193
- * // 'shabbat'
194
- * ```
195
- */
196
- DAGESH_CHAZAQ: boolean;
197
- /**
198
- * HEBREW PUNCTUATION MAQAF (U+05BE) ־◌
199
- * @example
200
- * '-'
201
- */
202
- MAQAF: string;
203
- /**
204
- * HEBREW PUNCTUATION PASEQ (U+05C0) ׀ ◌
205
- * @description if a blank string, two spaces will occur between words
206
- * @example
207
- * '|' or ''
208
- * @example
209
- * ```js
210
- * transliterate('כְּשֶׁ֣בֶת ׀ הַמֶּ֣לֶךְ', { PASEQ: '' });
211
- * // 'kǝšebet hammelek'
212
- * ```
213
- */
214
- PASEQ: string;
215
- /**
216
- * HEBREW PUNCTUATION SOF PASUQ (U+05C3) ׃◌
217
- * @example
218
- * '' or '.'
219
- */
220
- SOF_PASUQ: string;
221
- /**
222
- * HEBREW POINT QAMATS QATAN (U+05C7) ׇ◌
223
- * @example
224
- * 'o'
225
- */
226
- QAMATS_QATAN: string;
227
- /**
228
- * HEBREW POINT PATAH (U+05B7) ◌ַ
229
- * @example
230
- * 'a'
231
- */
232
- FURTIVE_PATAH: string;
233
- /**
234
- * HEBREW POINT HIRIQ (U+05B4) and YOD (U+05D9) י◌ִ
235
- * @example
236
- * 'î'
237
- */
238
- HIRIQ_YOD: string;
239
- /**
240
- * HEBREW POINT TSERE (U+05B5) and YOD (U+05D9) י◌ֵ
241
- * @example
242
- * 'ê'
243
- */
244
- TSERE_YOD: string;
245
- /**
246
- * HEBREW POINT SEGOL (U+05B6) and YOD (U+05D9) י◌ֶ
247
- * @example
248
- * 'ê'
249
- */
250
- SEGOL_YOD: string;
251
- /**
252
- * HEBREW LETTER VAV (U+05D5) and DAGESH (U+05BC) וּ
253
- * @example
254
- * 'û'
255
- */
256
- SHUREQ: string;
257
- /**
258
- * HEBREW LETTER HOLAM (U+05B9) and VAV (U+05D5) ֹו◌
259
- * @example
260
- * 'ô'
261
- */
262
- HOLAM_VAV: string;
263
- /**
264
- * HEBREW POINT QAMATS (U+05B8) and HE (U+05D4) ה◌ָ
265
- * @example
266
- * 'â'
267
- */
268
- QAMATS_HE: string;
269
- /**
270
- * HEBREW POINT SEGOL (U+05B6) and HE (U+05D4) ה◌ֶ
271
- * @example
272
- * 'ê'
273
- */
274
- SEGOL_HE: string;
275
- /**
276
- * HEBREW POINT TSERE (U+05B5) and HE (U+05D4) ה◌ֵ
277
- * @example
278
- * 'ê'
279
- */
280
- TSERE_HE: string;
281
- /**
282
- * HEBREW LETTER QAMATS (U+05B8) and YOD (U+05D9) and VAV (U+05D5) יו◌ָ
283
- * @example
284
- * 'āyw'
285
- */
286
- MS_SUFX: string;
287
- /**
288
- * HEBREW LETTER ALEF (U+05D0) א
289
- * @example
290
- * 'ʾ'
291
- */
292
- ALEF: string;
293
- /**
294
- * HEBREW LETTER BET (U+05D1) ב
295
- * @example
296
- * 'b' or 'v'
297
- */
298
- BET: string;
299
- /**
300
- * HEBREW LETTER BET (U+05D1) and DAGESH (U+05BC) ּב
301
- * @description
302
- * the letter bet with a dagesh kal
303
- * @description
304
- * use when need to distinguish between spirantized forms
305
- * @example
306
- * 'b'
307
- */
308
- BET_DAGESH?: string;
309
- /**
310
- * HEBREW LETTER GIMEL (U+05D2) ג
311
- * @example
312
- * 'g'
313
- */
314
- GIMEL: string;
315
- /**
316
- * HEBREW LETTER GIMEL (U+05D2) and DAGESH (U+05BC) גּ
317
- * @description
318
- * the letter gimel with a dagesh kal
319
- * @description
320
- * use when need to distinguish between spirantized forms
321
- * @example
322
- * 'g'
323
- */
324
- GIMEL_DAGESH?: string;
325
- /**
326
- * HEBREW LETTER DALET (U+05D3) ד
327
- * @example
328
- * 'd'
329
- */
330
- DALET: string;
331
- /**
332
- * HEBREW LETTER DALET (U+05D3) and DAGESH (U+05BC) דּ
333
- * @description
334
- * the letter dalet with a dagesh kal
335
- * @description
336
- * use when need to distinguish between spirantized forms
337
- * @example
338
- * 'd'
339
- */
340
- DALET_DAGESH?: string;
341
- /**
342
- * HEBREW LETTER HE (U+05D4) ה
343
- * @example
344
- * 'h'
345
- */
346
- HE: string;
347
- /**
348
- * HEBREW LETTER VAV (U+05D5) ו
349
- * @example
350
- * 'w'
351
- */
352
- VAV: string;
353
- /**
354
- * HEBREW LETTER ZAYIN (U+05D6) ז
355
- * @example
356
- * 'z'
357
- */
358
- ZAYIN: string;
359
- /**
360
- * HEBREW LETTER HET (U+05D7) ח
361
- * @example
362
- * 'ḥ'
363
- */
364
- HET: string;
365
- /**
366
- * HEBREW LETTER TET (U+05D8) ט
367
- * @example
368
- * 'ṭ'
369
- */
370
- TET: string;
371
- /**
372
- * HEBREW LETTER YOD (U+05D9) י
373
- * @example
374
- * 'y'
375
- */
376
- YOD: string;
377
- /**
378
- * HEBREW LETTER FINAL KAF (U+05DA) ך
379
- * @example
380
- * 'k' or 'kh'
381
- */
382
- FINAL_KAF: string;
383
- /**
384
- * HEBREW LETTER KAF (U+05DB) כ
385
- * @example
386
- * 'k' or 'kh'
387
- */
388
- KAF: string;
389
- /**
390
- * HEBREW LETTER KAF (U+05DB) and DAGESH (U+05BC) כּ
391
- * @description
392
- * the letter kaf with a dagesh kal
393
- * @description
394
- * use when need to distinguish between spirantized forms
395
- * @example
396
- * 'k'
397
- */
398
- KAF_DAGESH?: string;
399
- /**
400
- * HEBREW LETTER LAMED (U+05DC) ל
401
- * @example
402
- * 'l'
403
- */
404
- LAMED: string;
405
- /**
406
- * HEBREW LETTER FINAL MEM (U+05DD) ם
407
- * @example
408
- * 'm'
409
- */
410
- FINAL_MEM: string;
411
- /**
412
- * HEBREW LETTER MEM (U+05DE) מ
413
- * @example
414
- * 'm'
415
- */
416
- MEM: string;
417
- /**
418
- * HEBREW LETTER FINAL NUN (U+05DF) ן
419
- * @example
420
- * 'n'
421
- */
422
- FINAL_NUN: string;
423
- /**
424
- * HEBREW LETTER NUN (U+05E0) נ
425
- * @example
426
- * 'n'
427
- */
428
- NUN: string;
429
- /**
430
- * HEBREW LETTER SAMEKH (U+05E1) ס
431
- * @example
432
- * 's'
433
- */
434
- SAMEKH: string;
435
- /**
436
- * HEBREW LETTER AYIN (U+05E2) ע
437
- * @example
438
- * 'ʿ'
439
- */
440
- AYIN: string;
441
- /**
442
- * HEBREW LETTER FINAL PE (U+05E3) ף
443
- * @example
444
- * 'p' or 'f'
445
- */
446
- FINAL_PE: string;
447
- /**
448
- * HEBREW LETTER PE (U+05E4) פ
449
- * @example
450
- * 'p' or 'f'
451
- */
452
- PE: string;
453
- /**
454
- * HEBREW LETTER PE (U+05E4) and DAGESH (U+05BC) פּ
455
- * @description
456
- * the letter pe with a dagesh kal
457
- * @description
458
- * use when need to distinguish between spirantized forms
459
- * @example
460
- * 'p'
461
- */
462
- PE_DAGESH?: string;
463
- /**
464
- * HEBREW LETTER FINAL TSADI (U+05E5) ץ
465
- * @example
466
- * 'ṣ'
467
- */
468
- FINAL_TSADI: string;
469
- /**
470
- * HEBREW LETTER TSADI (U+05E6) צ
471
- * @example
472
- * 'ṣ'
473
- */
474
- TSADI: string;
475
- /**
476
- * HEBREW LETTER QOF (U+05E7) ק
477
- * @example
478
- * 'q'
479
- */
480
- QOF: string;
481
- /**
482
- * HEBREW LETTER RESH (U+05E8) ר
483
- * @example
484
- * 'r'
485
- */
486
- RESH: string;
487
- /**
488
- * HEBREW LETTER SHIN (U+05E9) and SHIN DOT (U+05C1) שׁ
489
- * @example
490
- * 'š'
491
- */
492
- SHIN: string;
493
- /**
494
- * HEBREW LETTER SHIN (U+05E9) and SIN DOT (U+05C2) שׁ
495
- * @example
496
- * 'ś'
497
- */
498
- SIN: string;
499
- /**
500
- * HEBREW LETTER TAV (U+05EA) ת
501
- * @example
502
- * 't' or 'th'
503
- */
504
- TAV: string;
505
- /**
506
- * HEBREW LETTER TAV (U+05EA) and DAGESH (U+05BC) תּ
507
- * @description
508
- * the letter tav with a dagesh kal
509
- * @description
510
- * use when need to distinguish between spirantized forms
511
- * @example
512
- * 't'
513
- */
514
- TAV_DAGESH?: string;
515
- /**
516
- * define additional sequences of characters
517
- *
518
- * ⚠️ there may be unpredictable results
519
- *
520
- * @example
521
- * [{
522
- * FEATURE: 'cluster',
523
- * HEBREW: 'זּ',
524
- * TRANSLITERATION: 'tz'
525
- * }]
526
- */
527
- ADDITIONAL_FEATURES?: {
528
- /**
529
- * additional orthographic feature
530
- *
531
- * - `"cluster"` is any combination of a single character and optionally a _dagesh_ and vowel.
532
- * - `"syllable"` is any combination of a multiple characters and a single vowel and optionally a _dagesh_
533
- * - `"word"` covers everything else
534
- */
535
- FEATURE: "word" | "syllable" | "cluster";
536
- /** use consonants and vowels; do not use taamim */
537
- HEBREW: string;
538
- TRANSLITERATION: string;
539
- }[];
540
- /**
541
- * the full form of the divine name - יהוה
542
- * @example
543
- * 'yhwh'
544
- */
545
- DIVINE_NAME: string;
546
- /**
547
- * a syllable separator, usually an empty string
548
- * @example
549
- * '' or '-'
550
- * @example
551
- * ```js
552
- * transliterate('הָאָֽרֶץ', { SYLLABLE_SEPARATOR: '-' });
553
- * // 'hā-ʾā-reṣ'
554
- * ```
555
- */
556
- SYLLABLE_SEPARATOR?: string;
557
- /**
558
- * a mark for indentifying the stressed syllable
559
- *
560
- * @description
561
- * taamim are needed in the Hebrew text to correctly identify stress
562
- * @example
563
- * 'ˈ' or '\u0341'
564
- * @example
565
- * ```js
566
- * transliterate('מֶ֣לֶךְ', { STRESS_MARKER: { location: 'after-vowel', mark: '\u0301' } });
567
- * // 'mélek'
568
- * ```
569
- */
570
- STRESS_MARKER?: {
571
- location: "before-syllable" | "after-syllable" | "before-vowel" | "after-vowel";
572
- mark: string;
573
- };
574
- longVowels: SylOpts["longVowels"];
575
- qametsQatan: SylOpts["qametsQatan"];
576
- sqnmlvy: SylOpts["sqnmlvy"];
577
- wawShureq: SylOpts["wawShureq"];
578
- article: SylOpts["article"];
579
- allowNoNiqqud: SylOpts["allowNoNiqqud"];
580
- constructor(schema: Schema);
581
- }
582
- export class SBL extends Schema {
583
- constructor(schema: Partial<Schema>);
584
- }
585
-
586
- }
587
- declare module 'hebrew-transliteration/sequence' {
588
- export const vowels: RegExp;
589
- /**
590
- * sequences Hebrew charactes according to the [SBL Hebrew Font Manual](https://www.sbl-site.org/Fonts/SBLHebrewUserManual1.5x.pdf)
591
- *
592
- * @param text - a string of Hebrew character
593
- * @param qametsQatan - option to convert regular qamets characters to qamets qatan
594
- * @returns a sequenced string of text
595
- * @remarks
596
- * seqeuncing follows the pattern of: consonant - dagesh - vowel - ta'am as defined in the {@link https://www.sbl-site.org/Fonts/SBLHebrewUserManual1.5x.pdf | SBL Hebrew Font Manual}
597
- *
598
- * @example
599
- *
600
- * ```ts
601
- * heb.sequence("\u{5D1}\u{5B0}\u{5BC}\u{5E8}\u{5B5}\u{5D0}\u{5E9}\u{5B4}\u{5C1}\u{596}\u{5D9}\u{5EA}");
602
- * "\u{5D1}\u{5BC}\u{5B0}\u{5E8}\u{5B5}\u{5D0}\u{5E9}\u{5C1}\u{5B4}\u{596}\u{5D9}\u{5EA}";
603
- * ```
604
- */
605
- export const sequence: (text: string, qametsQatan?: boolean) => string;
606
-
607
- }
608
- declare module 'hebrew-transliteration/transliterate' {
609
- import { Schema } from "hebrew-transliteration/schema";
610
- import { Text } from "havarotjs";
611
- /**
612
- * transliterates Hebrew text
613
- *
614
- * @param text - a string or {@link https://charlesloder.github.io/havarot/classes/text.Text.html | Text} of Hebrew characters
615
- * @param schema - a {@link Schema} for transliterating the text
616
- * @returns a transliterated text
617
- *
618
- * @example Default
619
- * ```ts
620
- * import { transliterate } from "hebrew-transliteration";
621
- *
622
- * transliterate("אֱלֹהִים");
623
- * // "ʾĕlōhîm";
624
- * ```
625
- *
626
- * ---
627
- *
628
- * @remarks
629
- *
630
- * If no {@link Schema} is passed, then the package defaults to SBL's academic style
631
- *
632
- * You can pass in a partial schema that will modify SBL's academic style:
633
- *
634
- * ```ts
635
- * transliterate("שָׁלוֹם", { SHIN: "sh" })
636
- * // shālôm
637
- * ```
638
- *
639
- * ---
640
- *
641
- * If you need a fully custom schema, it is best to use the {@link Schema} constructor:
642
- *
643
- * ```ts
644
- * import { transliterate, Schema } from "hebrew-transliteration";
645
- *
646
- * const schema = new Schema({ ALEF: "'", BET: "B", ... QAMETS: "A", ... }) // truncated for brevity
647
- *
648
- * transliterate("אָ֣ב", schema)
649
- * // 'AB
650
- * ```
651
- *
652
- */
653
- export const transliterate: (text: string | Text, schema?: Partial<Schema> | Schema) => string;
654
-
655
- }
656
- declare module 'hebrew-transliteration' {
657
- import main = require('hebrew-transliteration/index');
658
- export = main;
659
- }
1
+ import { Text } from "havarotjs";
2
+ import { transliterate } from "./transliterate";
3
+ import { sequence } from "./sequence";
4
+ import { remove } from "./remove";
5
+ import { Schema } from "./schema";
6
+ export { remove, Schema, sequence, Text, transliterate };