hebrew-transliteration 2.6.0 → 2.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/dist/cjs/hebCharsTrans.js +73 -0
  2. package/dist/cjs/hebCharsTrans.js.map +7 -0
  3. package/dist/cjs/index.js +40 -0
  4. package/dist/cjs/index.js.map +7 -0
  5. package/dist/cjs/package.json +3 -0
  6. package/dist/cjs/remove.js +195 -0
  7. package/dist/cjs/remove.js.map +7 -0
  8. package/dist/cjs/rules.js +367 -0
  9. package/dist/cjs/rules.js.map +7 -0
  10. package/dist/cjs/schema.js +200 -0
  11. package/dist/cjs/schema.js.map +7 -0
  12. package/dist/cjs/schemas/brillAcademic.js +102 -0
  13. package/dist/cjs/schemas/brillAcademic.js.map +7 -0
  14. package/dist/cjs/schemas/brillSimple.js +101 -0
  15. package/dist/cjs/schemas/brillSimple.js.map +7 -0
  16. package/dist/cjs/schemas/index.js +49 -0
  17. package/dist/cjs/schemas/index.js.map +7 -0
  18. package/dist/cjs/schemas/jss.js +115 -0
  19. package/dist/cjs/schemas/jss.js.map +7 -0
  20. package/dist/cjs/schemas/michiganClaremont.js +95 -0
  21. package/dist/cjs/schemas/michiganClaremont.js.map +7 -0
  22. package/dist/cjs/schemas/romaniote.js +186 -0
  23. package/dist/cjs/schemas/romaniote.js.map +7 -0
  24. package/dist/cjs/schemas/sblAcademicSpirantization.js +101 -0
  25. package/dist/cjs/schemas/sblAcademicSpirantization.js.map +7 -0
  26. package/dist/cjs/schemas/sblSimple.js +110 -0
  27. package/dist/cjs/schemas/sblSimple.js.map +7 -0
  28. package/dist/cjs/schemas/tiberian.js +467 -0
  29. package/dist/cjs/schemas/tiberian.js.map +7 -0
  30. package/dist/cjs/sequence.js +34 -0
  31. package/dist/cjs/sequence.js.map +7 -0
  32. package/dist/cjs/transliterate.js +63 -0
  33. package/dist/cjs/transliterate.js.map +7 -0
  34. package/dist/{hebCharsTrans.js → esm/hebCharsTrans.js} +1 -4
  35. package/dist/esm/hebCharsTrans.js.map +1 -0
  36. package/dist/esm/index.js +11 -0
  37. package/dist/esm/index.js.map +1 -0
  38. package/dist/esm/package.json +3 -0
  39. package/dist/{remove.js → esm/remove.js} +15 -15
  40. package/dist/esm/remove.js.map +1 -0
  41. package/dist/{rules.js → esm/rules.js} +40 -52
  42. package/dist/esm/rules.js.map +1 -0
  43. package/dist/esm/schema.js +659 -0
  44. package/dist/esm/schema.js.map +1 -0
  45. package/dist/{schemas → esm/schemas}/brillAcademic.js +1 -4
  46. package/dist/esm/schemas/brillAcademic.js.map +1 -0
  47. package/dist/{schemas → esm/schemas}/brillSimple.js +1 -4
  48. package/dist/esm/schemas/brillSimple.js.map +1 -0
  49. package/dist/esm/schemas/index.js +10 -0
  50. package/dist/esm/schemas/index.js.map +1 -0
  51. package/dist/{schemas → esm/schemas}/jss.js +2 -6
  52. package/dist/esm/schemas/jss.js.map +1 -0
  53. package/dist/{schemas → esm/schemas}/michiganClaremont.js +1 -4
  54. package/dist/esm/schemas/michiganClaremont.js.map +1 -0
  55. package/dist/{schemas → esm/schemas}/romaniote.js +4 -7
  56. package/dist/esm/schemas/romaniote.js.map +1 -0
  57. package/dist/{schemas → esm/schemas}/sblAcademicSpirantization.js +1 -4
  58. package/dist/esm/schemas/sblAcademicSpirantization.js.map +1 -0
  59. package/dist/{schemas → esm/schemas}/sblSimple.js +1 -4
  60. package/dist/esm/schemas/sblSimple.js.map +1 -0
  61. package/dist/{schemas → esm/schemas}/tiberian.js +34 -51
  62. package/dist/esm/schemas/tiberian.js.map +1 -0
  63. package/dist/{sequence.js → esm/sequence.js} +4 -8
  64. package/dist/esm/sequence.js.map +1 -0
  65. package/dist/{transliterate.js → esm/transliterate.js} +12 -17
  66. package/dist/esm/transliterate.js.map +1 -0
  67. package/package.json +26 -22
  68. package/dist/hebCharsTrans.js.map +0 -1
  69. package/dist/index.js +0 -14
  70. package/dist/index.js.map +0 -1
  71. package/dist/remove.js.map +0 -1
  72. package/dist/rules.js.map +0 -1
  73. package/dist/schema.js +0 -174
  74. package/dist/schema.js.map +0 -1
  75. package/dist/schemas/brillAcademic.js.map +0 -1
  76. package/dist/schemas/brillSimple.js.map +0 -1
  77. package/dist/schemas/index.js +0 -20
  78. package/dist/schemas/index.js.map +0 -1
  79. package/dist/schemas/jss.js.map +0 -1
  80. package/dist/schemas/michiganClaremont.js.map +0 -1
  81. package/dist/schemas/romaniote.js.map +0 -1
  82. package/dist/schemas/sblAcademicSpirantization.js.map +0 -1
  83. package/dist/schemas/sblSimple.js.map +0 -1
  84. package/dist/schemas/tiberian.js.map +0 -1
  85. package/dist/sequence.js.map +0 -1
  86. package/dist/transliterate.js.map +0 -1
  87. /package/dist/{hebCharsTrans.d.ts → types/hebCharsTrans.d.ts} +0 -0
  88. /package/dist/{index.d.ts → types/index.d.ts} +0 -0
  89. /package/dist/{remove.d.ts → types/remove.d.ts} +0 -0
  90. /package/dist/{rules.d.ts → types/rules.d.ts} +0 -0
  91. /package/dist/{schema.d.ts → types/schema.d.ts} +0 -0
  92. /package/dist/{schemas → types/schemas}/brillAcademic.d.ts +0 -0
  93. /package/dist/{schemas → types/schemas}/brillSimple.d.ts +0 -0
  94. /package/dist/{schemas → types/schemas}/index.d.ts +0 -0
  95. /package/dist/{schemas → types/schemas}/jss.d.ts +0 -0
  96. /package/dist/{schemas → types/schemas}/michiganClaremont.d.ts +0 -0
  97. /package/dist/{schemas → types/schemas}/romaniote.d.ts +0 -0
  98. /package/dist/{schemas → types/schemas}/sblAcademicSpirantization.d.ts +0 -0
  99. /package/dist/{schemas → types/schemas}/sblSimple.d.ts +0 -0
  100. /package/dist/{schemas → types/schemas}/tiberian.d.ts +0 -0
  101. /package/dist/{sequence.d.ts → types/sequence.d.ts} +0 -0
  102. /package/dist/{transliterate.d.ts → types/transliterate.d.ts} +0 -0
@@ -0,0 +1,467 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var tiberian_exports = {};
19
+ __export(tiberian_exports, {
20
+ tiberian: () => tiberian
21
+ });
22
+ module.exports = __toCommonJS(tiberian_exports);
23
+ const tiberian = {
24
+ VOCAL_SHEVA: "a",
25
+ HATAF_SEGOL: "\u025B",
26
+ HATAF_PATAH: "a",
27
+ HATAF_QAMATS: "\u0254",
28
+ HIRIQ: "i",
29
+ TSERE: "e",
30
+ SEGOL: "\u025B",
31
+ PATAH: "a",
32
+ QAMATS: "\u0254",
33
+ HOLAM: "o",
34
+ HOLAM_HASER: "o",
35
+ QUBUTS: "u",
36
+ DAGESH: "",
37
+ DAGESH_CHAZAQ: true,
38
+ MAQAF: "-",
39
+ PASEQ: "",
40
+ SOF_PASUQ: "",
41
+ QAMATS_QATAN: "\u0254",
42
+ FURTIVE_PATAH: "a",
43
+ HIRIQ_YOD: "i\u02D0",
44
+ TSERE_YOD: "e\u02D0",
45
+ SEGOL_YOD: "\u025B\u02D0",
46
+ SHUREQ: "u\u02D0",
47
+ HOLAM_VAV: "o\u02D0",
48
+ QAMATS_HE: "\u0254\u02D0",
49
+ SEGOL_HE: "\u025B\u02D0",
50
+ TSERE_HE: "e\u02D0",
51
+ MS_SUFX: "\u0254w",
52
+ ALEF: "\u0294",
53
+ BET: "v",
54
+ BET_DAGESH: "b",
55
+ GIMEL: "\u0281",
56
+ GIMEL_DAGESH: "g",
57
+ DALET: "\xF0",
58
+ DALET_DAGESH: "d",
59
+ HE: "h",
60
+ VAV: "v",
61
+ ZAYIN: "z",
62
+ HET: "\u0127",
63
+ TET: "t\u02C1",
64
+ YOD: "j",
65
+ FINAL_KAF: "\u03C7",
66
+ KAF: "\u03C7",
67
+ KAF_DAGESH: "k\u02B0",
68
+ LAMED: "l",
69
+ FINAL_MEM: "m",
70
+ MEM: "m",
71
+ FINAL_NUN: "n",
72
+ NUN: "n",
73
+ SAMEKH: "s",
74
+ AYIN: "\u0295",
75
+ FINAL_PE: "f",
76
+ PE: "f",
77
+ PE_DAGESH: "p\u02B0",
78
+ FINAL_TSADI: "s\u02C1",
79
+ TSADI: "s\u02C1",
80
+ QOF: "q\u031F",
81
+ RESH: "\u0280\u031F",
82
+ SHIN: "\u0283",
83
+ SIN: "s",
84
+ TAV: "\u03B8",
85
+ TAV_DAGESH: "t\u02B0",
86
+ DIVINE_NAME: "\u0294a\xF0o\u02D0\u02C8n\u0254\u02D0\u0254j",
87
+ DIVINE_NAME_ELOHIM: "\u0294\u025Blo\u02D0\u02C8hi\u02D0im",
88
+ STRESS_MARKER: { location: "before-syllable", mark: "\u02C8" },
89
+ ADDITIONAL_FEATURES: [
90
+ {
91
+ FEATURE: "cluster",
92
+ HEBREW: "\u05D9\u05BC",
93
+ TRANSLITERATION: (cluster, hebrew) => {
94
+ return cluster.text.replace(hebrew, "\u025F\u025F");
95
+ }
96
+ },
97
+ {
98
+ FEATURE: "cluster",
99
+ HEBREW: /תּ(?!\u{05B0})/u,
100
+ TRANSLITERATION: (cluster, _, schema) => {
101
+ var _a, _b, _c, _d, _e, _f;
102
+ if (!cluster.prev || ((_a = cluster.prev.value) == null ? void 0 : _a.isNotHebrew)) {
103
+ return cluster.text;
104
+ }
105
+ const prevCoda = (_d = (_c = (_b = cluster.syllable) == null ? void 0 : _b.prev) == null ? void 0 : _c.value) == null ? void 0 : _d.codaWithGemination;
106
+ if (!(prevCoda == null ? void 0 : prevCoda.includes("\u05EA"))) {
107
+ return cluster.text;
108
+ }
109
+ const noAspiration = (_f = (_e = schema["TAV_DAGESH"]) == null ? void 0 : _e.replace("\u02B0", "")) != null ? _f : "";
110
+ return cluster.text.replace("\u05EA\u05BC", `${noAspiration + schema["TAV_DAGESH"]}`);
111
+ }
112
+ },
113
+ {
114
+ FEATURE: "cluster",
115
+ HEBREW: /פ(?!\u{05b0})/u,
116
+ TRANSLITERATION: (cluster, _, schema) => {
117
+ var _a, _b, _c, _d, _e, _f;
118
+ if (!cluster.prev || ((_a = cluster.prev.value) == null ? void 0 : _a.isNotHebrew)) {
119
+ return cluster.text;
120
+ }
121
+ const prevCoda = (_d = (_c = (_b = cluster.syllable) == null ? void 0 : _b.prev) == null ? void 0 : _c.value) == null ? void 0 : _d.codaWithGemination;
122
+ if (!(prevCoda == null ? void 0 : prevCoda.includes("\u05E4"))) {
123
+ return cluster.text;
124
+ }
125
+ const noAspiration = (_f = (_e = schema["PE_DAGESH"]) == null ? void 0 : _e.replace("\u02B0", "")) != null ? _f : "";
126
+ return cluster.text.replace("\u05E4\u05BC", `${noAspiration + schema["PE_DAGESH"]}`);
127
+ }
128
+ },
129
+ {
130
+ FEATURE: "cluster",
131
+ HEBREW: /טּ(?!\u{05b0})/u,
132
+ TRANSLITERATION: (cluster, _, schema) => {
133
+ var _a, _b, _c, _d, _e, _f;
134
+ if (!cluster.prev || ((_a = cluster.prev.value) == null ? void 0 : _a.isNotHebrew)) {
135
+ return cluster.text;
136
+ }
137
+ const prevCoda = (_d = (_c = (_b = cluster.syllable) == null ? void 0 : _b.prev) == null ? void 0 : _c.value) == null ? void 0 : _d.codaWithGemination;
138
+ if (!(prevCoda == null ? void 0 : prevCoda.includes("\u05D8"))) {
139
+ return cluster.text;
140
+ }
141
+ const noPharyngealization = (_f = (_e = schema["TET"]) == null ? void 0 : _e.replace("\u02C1", "")) != null ? _f : "";
142
+ return cluster.text.replace("\u05D8", `${noPharyngealization + schema["TET"]}`);
143
+ }
144
+ },
145
+ {
146
+ FEATURE: "cluster",
147
+ HEBREW: /צּ(?!\u{05b0})/u,
148
+ TRANSLITERATION: (cluster, _, schema) => {
149
+ var _a, _b, _c, _d, _e, _f;
150
+ if (!cluster.prev || ((_a = cluster.prev.value) == null ? void 0 : _a.isNotHebrew)) {
151
+ return cluster.text;
152
+ }
153
+ const prevCoda = (_d = (_c = (_b = cluster.syllable) == null ? void 0 : _b.prev) == null ? void 0 : _c.value) == null ? void 0 : _d.codaWithGemination;
154
+ if (!(prevCoda == null ? void 0 : prevCoda.includes("\u05E6"))) {
155
+ return cluster.text;
156
+ }
157
+ const noPharyngealization = (_f = (_e = schema["TSADI"]) == null ? void 0 : _e.replace("\u02C1", "")) != null ? _f : "";
158
+ return cluster.text.replace("\u05E6", `${noPharyngealization + schema["TSADI"]}`);
159
+ }
160
+ },
161
+ {
162
+ FEATURE: "cluster",
163
+ HEBREW: /(כּ|ךּ)(?!\u{05b0})/u,
164
+ TRANSLITERATION: (cluster, _, schema) => {
165
+ var _a, _b, _c, _d, _e, _f;
166
+ if (!cluster.prev || ((_a = cluster.prev.value) == null ? void 0 : _a.isNotHebrew)) {
167
+ return cluster.text;
168
+ }
169
+ const prevCoda = (_d = (_c = (_b = cluster.syllable) == null ? void 0 : _b.prev) == null ? void 0 : _c.value) == null ? void 0 : _d.codaWithGemination;
170
+ if (!(prevCoda == null ? void 0 : prevCoda.includes("\u05DB")) && !(prevCoda == null ? void 0 : prevCoda.includes("\u05DA"))) {
171
+ return cluster.text;
172
+ }
173
+ const noAspiration = (_f = (_e = schema["KAF_DAGESH"]) == null ? void 0 : _e.replace("\u02B0", "")) != null ? _f : "";
174
+ return cluster.text.replace(/כּ|ךּ/u, `${noAspiration + schema["KAF_DAGESH"]}`);
175
+ }
176
+ },
177
+ {
178
+ FEATURE: "cluster",
179
+ HEBREW: "\u05D0(?![\u05B1-\u05BB\u05C7])",
180
+ TRANSLITERATION: (cluster) => {
181
+ var _a;
182
+ const next = (_a = cluster.next) == null ? void 0 : _a.value;
183
+ if (next && next.isShureq) {
184
+ return cluster.text;
185
+ }
186
+ return "";
187
+ }
188
+ },
189
+ {
190
+ FEATURE: "cluster",
191
+ HEBREW: "\u05D0\u05BC",
192
+ TRANSLITERATION: (cluster) => {
193
+ return cluster.text.replace("\u05BC", "");
194
+ }
195
+ },
196
+ {
197
+ FEATURE: "syllable",
198
+ HEBREW: /ר/u,
199
+ TRANSLITERATION: (syllable) => {
200
+ var _a, _b;
201
+ const alveolars = /[דזצתטסלנ]|שׂ/;
202
+ const cluster = syllable.clusters.filter((c) => c.text.includes("\u05E8"))[0];
203
+ const prevCluster = (_a = cluster.prev) == null ? void 0 : _a.value;
204
+ const currentSyllable = cluster == null ? void 0 : cluster.syllable;
205
+ const [onset, _, coda] = currentSyllable ? currentSyllable.structure(true) : ["", "", ""];
206
+ if (prevCluster && alveolars.test(prevCluster.text)) {
207
+ if (onset.includes("\u05E8") && !prevCluster.hasVowel) {
208
+ return syllable.text.replace("\u05E8", "r\u02C1");
209
+ }
210
+ if (coda.includes("\u05E8") && prevCluster.hasVowel) {
211
+ return syllable.text.replace("\u05E8", "r\u02C1");
212
+ }
213
+ }
214
+ const nextCluster = (_b = cluster.next) == null ? void 0 : _b.value;
215
+ const lamedAndNun = /[לנן]/;
216
+ if (nextCluster && lamedAndNun.test(nextCluster.text)) {
217
+ if (onset.includes("\u05E8") && !cluster.hasVowel) {
218
+ return syllable.text.replace("\u05E8", "r\u02C1");
219
+ }
220
+ if (coda.includes("\u05E8") && cluster.hasSheva) {
221
+ return syllable.text.replace("\u05E8", "r\u02C1");
222
+ }
223
+ }
224
+ return syllable.text;
225
+ }
226
+ },
227
+ {
228
+ FEATURE: "syllable",
229
+ HEBREW: "\u05D7\u05B7\u05C3?$",
230
+ PASS_THROUGH: true,
231
+ TRANSLITERATION: (syllable, _hebrew, schema) => {
232
+ var _a, _b;
233
+ const prevText = ((_b = (_a = syllable.prev) == null ? void 0 : _a.value) == null ? void 0 : _b.text) || "";
234
+ if (syllable.isFinal && prevText) {
235
+ if (/[יו]/.test(prevText)) {
236
+ const glide = /ו/.test(prevText) ? "w" : "j";
237
+ return glide + schema["PATAH"] + schema["HET"];
238
+ }
239
+ return schema["PATAH"] + schema["HET"];
240
+ }
241
+ return syllable.text;
242
+ }
243
+ },
244
+ {
245
+ FEATURE: "syllable",
246
+ HEBREW: "\u05E2\u05B7\u05C3?$",
247
+ PASS_THROUGH: true,
248
+ TRANSLITERATION: (syllable, _hebrew, schema) => {
249
+ var _a, _b;
250
+ const prevText = (_b = (_a = syllable.prev) == null ? void 0 : _a.value) == null ? void 0 : _b.text;
251
+ if (syllable.isFinal && prevText) {
252
+ if (/[יו]/.test(prevText)) {
253
+ const glide = /ו/.test(prevText) ? "w" : "j";
254
+ return glide + schema["PATAH"] + schema["AYIN"];
255
+ }
256
+ return schema["PATAH"] + schema["AYIN"];
257
+ }
258
+ return syllable.text;
259
+ }
260
+ },
261
+ {
262
+ FEATURE: "syllable",
263
+ HEBREW: "\u05D4\u05BC\u05B7\u05C3?$",
264
+ PASS_THROUGH: true,
265
+ TRANSLITERATION: (syllable, _hebrew, schema) => {
266
+ var _a, _b;
267
+ const prevText = (_b = (_a = syllable.prev) == null ? void 0 : _a.value) == null ? void 0 : _b.text;
268
+ if (syllable.isFinal && prevText) {
269
+ if (/[יו]/.test(prevText)) {
270
+ const glide = /ו/.test(prevText) ? "w" : "j";
271
+ return glide + schema["PATAH"] + schema["HE"];
272
+ }
273
+ return schema["PATAH"] + schema["HE"];
274
+ }
275
+ return syllable.text;
276
+ }
277
+ },
278
+ {
279
+ FEATURE: "syllable",
280
+ HEBREW: /וּ(?![\u{05B4}-\u{05BB}])/u,
281
+ TRANSLITERATION: (syllable, _, schema) => {
282
+ if (!syllable.prev && syllable.clusters[0].isShureq) {
283
+ const text = syllable.text;
284
+ const hasMeteg = syllable.clusters.map((c) => c.hasMeteg).includes(true);
285
+ const secondaryAccent = hasMeteg ? "\u02CC" : "";
286
+ const halfLengthMarker = hasMeteg ? "\u02D1" : "";
287
+ return text.replace("\u05D5\u05BC", `${secondaryAccent}wu${halfLengthMarker}`);
288
+ }
289
+ if (syllable.isAccented && syllable.isClosed) {
290
+ const noLength = schema["SHUREQ"].replace("\u02D0", "");
291
+ return syllable.text.replace("\u05D5\u05BC", schema["SHUREQ"] + noLength);
292
+ }
293
+ return syllable.text;
294
+ }
295
+ },
296
+ {
297
+ FEATURE: "syllable",
298
+ HEBREW: /[\u{05B4}-\u{05BB}\u{05C7}]/u,
299
+ TRANSLITERATION: (syllable, _, schema) => {
300
+ const vowelName = syllable.vowelName;
301
+ const vowel = syllable.vowel;
302
+ if (!vowel || !vowelName) {
303
+ return syllable.text;
304
+ }
305
+ if (vowelName === "SHEVA") {
306
+ throw new Error(`Syllable ${syllable.text} has a sheva as vowel, should not have matched`);
307
+ }
308
+ const hasHalfVowel = syllable.clusters.map((c) => c.hasHalfVowel).includes(true);
309
+ if (hasHalfVowel) {
310
+ throw new Error(`Syllable ${syllable.text} has a hataf as vowel, should not have matched`);
311
+ }
312
+ const [onset, _nuclues, coda] = syllable.structure(true);
313
+ function determinePatachRealization(vowelChar) {
314
+ var _a;
315
+ if (vowelName !== "PATAH" && vowelName !== "HATAF_PATAH") {
316
+ return vowelChar;
317
+ }
318
+ const pharyngealized = /rˁ|ט|צ|ץ/;
319
+ if (pharyngealized.test(onset) || pharyngealized.test(coda)) {
320
+ return "\u0251";
321
+ }
322
+ const nextSyllable = (_a = syllable.next) == null ? void 0 : _a.value;
323
+ const nextOnset = nextSyllable == null ? void 0 : nextSyllable.onset;
324
+ const alveolars = /[דזצתטסלנ]|שׂ/;
325
+ if (nextOnset === "\u05E8" && alveolars.test(coda)) {
326
+ return "\u0251";
327
+ }
328
+ return vowelChar;
329
+ }
330
+ const noMaterText = syllable.clusters.filter((c) => !c.isMater).map((c) => c.text).join("").replace(/(\u{05B9}.{1})\u{05D4}(?!\u{05BC})/u, "$1");
331
+ const hasMaters = syllable.clusters.map((c) => c.isMater).includes(true);
332
+ const lengthMarker = "\u02D0";
333
+ const halfLengthMarker = "\u02D1";
334
+ const hasMeteg = syllable.clusters.map((c) => c.hasMeteg).includes(true);
335
+ if (hasMeteg) {
336
+ const hasLongVowel = syllable.clusters.map((c) => c.hasLongVowel).includes(true);
337
+ const firstConsonant = noMaterText[0];
338
+ return noMaterText.replace(firstConsonant, `\u02CC${firstConsonant}`).replace(vowel, `${determinePatachRealization(vowel)}${hasLongVowel ? lengthMarker : halfLengthMarker}`);
339
+ }
340
+ const isClosed = syllable.isClosed;
341
+ const isAccented = syllable.isAccented;
342
+ if (isAccented && isClosed) {
343
+ const syllableSeparator = schema["SYLLABLE_SEPARATOR"] || "";
344
+ const vowelRealization = determinePatachRealization(vowel);
345
+ return noMaterText.replace(vowel, `${vowelRealization + lengthMarker + syllableSeparator + vowelRealization}`);
346
+ }
347
+ const longerVowels = ["HOLAM", "TSERE", "QAMATS"];
348
+ if (!isAccented && isClosed && !syllable.isFinal && longerVowels.includes(vowelName)) {
349
+ const syllableSeparator = schema["SYLLABLE_SEPARATOR"] || "";
350
+ const vowelRealization = determinePatachRealization(vowel);
351
+ return noMaterText.replace(vowel, `${vowelRealization + lengthMarker + syllableSeparator + vowelRealization}`);
352
+ }
353
+ if (isAccented || !isAccented && !isClosed) {
354
+ return noMaterText.replace(vowel, `${determinePatachRealization(vowel) + lengthMarker}`);
355
+ }
356
+ if (!hasMaters && !isClosed && !isAccented) {
357
+ return noMaterText.replace(vowel, `${determinePatachRealization(vowel)}`);
358
+ }
359
+ return syllable.text.replace(vowel, `${determinePatachRealization(vowel)}`);
360
+ }
361
+ },
362
+ {
363
+ FEATURE: "syllable",
364
+ HEBREW: /[\u{05B1}-\u{05B3}]/u,
365
+ TRANSLITERATION: (syllable) => {
366
+ const vowelName = syllable.vowelName;
367
+ const vowel = syllable.vowel;
368
+ if (!vowel || !vowelName) {
369
+ return syllable.text;
370
+ }
371
+ if (vowelName === "SHEVA") {
372
+ throw new Error(`Syllable ${syllable.text} has a sheva as vowel, should not have matched`);
373
+ }
374
+ const hasNonHalfVowels = syllable.clusters.map((c) => c.hasShortVowel || c.hasLongVowel).includes(true);
375
+ if (hasNonHalfVowels) {
376
+ throw new Error(`Syllable ${syllable.text} does not have a hataf vowel, should not have matched`);
377
+ }
378
+ const [onset, _nuclues, coda] = syllable.structure(true);
379
+ function determinePatachRealization(vowelChar) {
380
+ var _a;
381
+ if (vowelName !== "HATAF_PATAH") {
382
+ return vowelChar;
383
+ }
384
+ const pharyngealized = /rˁ|ט|צ|ץ/;
385
+ if (pharyngealized.test(onset) || pharyngealized.test(coda)) {
386
+ return "\u0251";
387
+ }
388
+ const nextSyllable = (_a = syllable.next) == null ? void 0 : _a.value;
389
+ const nextOnset = nextSyllable == null ? void 0 : nextSyllable.onset;
390
+ const alveolars = /[דזצתטסלנ]|שׂ/;
391
+ if (nextOnset === "\u05E8" && alveolars.test(coda)) {
392
+ return "\u0251";
393
+ }
394
+ if (nextOnset && /[צץט]/.test(nextOnset)) {
395
+ return "\u0251";
396
+ }
397
+ return vowelChar;
398
+ }
399
+ return syllable.text.replace(vowel, `${determinePatachRealization(vowel)}`);
400
+ }
401
+ },
402
+ {
403
+ FEATURE: "syllable",
404
+ HEBREW: /(?<!.*([\u{05B4}-\u{05BB}\u{05C7}]|\u{05D5}\u{05BC}).*)\u{05B0}/u,
405
+ TRANSLITERATION: (syllable, _hebrew, schema) => {
406
+ var _a;
407
+ const nextSyllable = (_a = syllable.next) == null ? void 0 : _a.value;
408
+ if (!nextSyllable)
409
+ return syllable.text;
410
+ const nextSylFirstCluster = nextSyllable.clusters[0].text;
411
+ if (!nextSylFirstCluster)
412
+ return syllable.text;
413
+ const [onset, _, coda] = syllable.structure(true);
414
+ function isBackUnrounded() {
415
+ var _a2;
416
+ const pharyngealized = /rˁ|ט|צ|ץ/;
417
+ if (pharyngealized.test(onset) || pharyngealized.test(coda)) {
418
+ return true;
419
+ }
420
+ const nextSyllable2 = (_a2 = syllable.next) == null ? void 0 : _a2.value;
421
+ if (!nextSyllable2) {
422
+ return false;
423
+ }
424
+ const nextOnset = nextSyllable2.onset;
425
+ if (pharyngealized.test(nextOnset)) {
426
+ return true;
427
+ }
428
+ return false;
429
+ }
430
+ function transliterateShevaAsVowel(vowel) {
431
+ const hasMeteg = syllable.clusters.map((c) => c.hasMeteg).includes(true);
432
+ const secondaryAccent = hasMeteg ? "\u02CC" : "";
433
+ const halfLengthMarker = hasMeteg ? "\u02D1" : "";
434
+ const newVowel = vowel.replace("\u02D0", "") + halfLengthMarker;
435
+ return secondaryAccent + syllable.text.replace(/\u{05B0}/u, newVowel);
436
+ }
437
+ const isGuttural = /[אהחע]/.test(nextSylFirstCluster);
438
+ if (!isGuttural) {
439
+ return transliterateShevaAsVowel(isBackUnrounded() ? "\u0251" : schema["PATAH"]);
440
+ }
441
+ const nextVowel = nextSyllable.vowelName;
442
+ if (!nextVowel) {
443
+ throw new Error(`Syllable ${syllable.text} has a sheva as a vowel, but the next syllable ${nextSylFirstCluster} does not have a vowel`);
444
+ }
445
+ if (nextVowel === "SHEVA") {
446
+ throw new Error(`Syllable ${syllable.text} has a sheva as a vowel, but the next syllable ${nextSylFirstCluster} also has a sheva as a vowel`);
447
+ }
448
+ return transliterateShevaAsVowel(schema[nextVowel]);
449
+ }
450
+ }
451
+ ],
452
+ allowNoNiqqud: false,
453
+ article: false,
454
+ holemHaser: "remove",
455
+ longVowels: false,
456
+ qametsQatan: true,
457
+ shevaAfterMeteg: false,
458
+ shevaWithMeteg: true,
459
+ sqnmlvy: false,
460
+ strict: true,
461
+ wawShureq: false
462
+ };
463
+ // Annotate the CommonJS export names for ESM import in node:
464
+ 0 && (module.exports = {
465
+ tiberian
466
+ });
467
+ //# sourceMappingURL=tiberian.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/schemas/tiberian.ts"],
4
+ "sourcesContent": ["import { Schema } from \"../schema\";\n\nexport const tiberian: Schema = {\n VOCAL_SHEVA: \"a\",\n HATAF_SEGOL: \"\u025B\",\n HATAF_PATAH: \"a\",\n HATAF_QAMATS: \"\u0254\",\n HIRIQ: \"i\",\n TSERE: \"e\",\n SEGOL: \"\u025B\",\n PATAH: \"a\",\n QAMATS: \"\u0254\",\n HOLAM: \"o\",\n HOLAM_HASER: \"o\",\n QUBUTS: \"u\",\n DAGESH: \"\",\n DAGESH_CHAZAQ: true,\n MAQAF: \"-\",\n PASEQ: \"\",\n SOF_PASUQ: \"\",\n QAMATS_QATAN: \"\u0254\",\n FURTIVE_PATAH: \"a\",\n HIRIQ_YOD: \"i\u02D0\",\n TSERE_YOD: \"e\u02D0\",\n SEGOL_YOD: \"\u025B\u02D0\",\n SHUREQ: \"u\u02D0\",\n HOLAM_VAV: \"o\u02D0\",\n QAMATS_HE: \"\u0254\u02D0\",\n SEGOL_HE: \"\u025B\u02D0\",\n TSERE_HE: \"e\u02D0\",\n MS_SUFX: \"\u0254w\",\n ALEF: \"\u0294\",\n BET: \"v\",\n BET_DAGESH: \"b\",\n GIMEL: \"\u0281\",\n GIMEL_DAGESH: \"g\",\n DALET: \"\u00F0\",\n DALET_DAGESH: \"d\",\n HE: \"h\",\n VAV: \"v\",\n ZAYIN: \"z\",\n HET: \"\u0127\",\n TET: \"t\u02C1\",\n YOD: \"j\",\n FINAL_KAF: \"\u03C7\",\n KAF: \"\u03C7\",\n KAF_DAGESH: \"k\u02B0\",\n LAMED: \"l\",\n FINAL_MEM: \"m\",\n MEM: \"m\",\n FINAL_NUN: \"n\",\n NUN: \"n\",\n SAMEKH: \"s\",\n AYIN: \"\u0295\",\n FINAL_PE: \"f\",\n PE: \"f\",\n PE_DAGESH: \"p\u02B0\",\n FINAL_TSADI: \"s\u02C1\",\n TSADI: \"s\u02C1\",\n QOF: \"q\u031F\",\n RESH: \"\u0280\u031F\",\n SHIN: \"\u0283\",\n SIN: \"s\",\n TAV: \"\u03B8\",\n TAV_DAGESH: \"t\u02B0\",\n DIVINE_NAME: \"\u0294a\u00F0o\u02D0\u02C8n\u0254\u02D0\u0254j\",\n DIVINE_NAME_ELOHIM: \"\u0294\u025Blo\u02D0\u02C8hi\u02D0im\",\n STRESS_MARKER: { location: \"before-syllable\", mark: \"\u02C8\" },\n ADDITIONAL_FEATURES: [\n {\n FEATURE: \"cluster\",\n HEBREW: \"\\u{05D9}\\u{05BC}\",\n TRANSLITERATION: (cluster, hebrew) => {\n return cluster.text.replace(hebrew, \"\u025F\u025F\");\n }\n },\n {\n FEATURE: \"cluster\",\n HEBREW: /\u05EA\u05BC(?!\\u{05B0})/u,\n TRANSLITERATION: (cluster, _, schema) => {\n // if there is a dagesh, but it is the beginning of the word\n // we can return the text, as the character w/ the dagesh will not be doubled\n if (!cluster.prev || cluster.prev.value?.isNotHebrew) {\n return cluster.text;\n }\n\n // if there is a dagesh, it may be that it is a dagesh qal (i.e. lene)\n // if it is a dagesh lene, then like the beginning of the word,\n // the character w/ the dagesh will not be doubled\n const prevCoda = cluster.syllable?.prev?.value?.codaWithGemination;\n if (!prevCoda?.includes(\"\u05EA\")) {\n return cluster.text;\n }\n\n // because the *_DAGESH value is a digraph, we need to replace the first character\n // or it will be doubled in rules.ts as \"t\u02B0t\u02B0\"\n const noAspiration = schema[\"TAV_DAGESH\"]?.replace(\"\u02B0\", \"\") ?? \"\";\n return cluster.text.replace(\"\u05EA\u05BC\", `${noAspiration + schema[\"TAV_DAGESH\"]}`);\n }\n },\n {\n FEATURE: \"cluster\",\n HEBREW: /\u05E4(?!\\u{05b0})/u,\n TRANSLITERATION: (cluster, _, schema) => {\n // /\u05EA(?!\\u{05b0})/u rule for explanation\n if (!cluster.prev || cluster.prev.value?.isNotHebrew) {\n return cluster.text;\n }\n\n const prevCoda = cluster.syllable?.prev?.value?.codaWithGemination;\n if (!prevCoda?.includes(\"\u05E4\")) {\n return cluster.text;\n }\n\n const noAspiration = schema[\"PE_DAGESH\"]?.replace(\"\u02B0\", \"\") ?? \"\";\n return cluster.text.replace(\"\u05E4\u05BC\", `${noAspiration + schema[\"PE_DAGESH\"]}`);\n }\n },\n {\n FEATURE: \"cluster\",\n HEBREW: /\u05D8\u05BC(?!\\u{05b0})/u,\n TRANSLITERATION: (cluster, _, schema) => {\n // /\u05EA(?!\\u{05b0})/u rule for explanation\n if (!cluster.prev || cluster.prev.value?.isNotHebrew) {\n return cluster.text;\n }\n\n const prevCoda = cluster.syllable?.prev?.value?.codaWithGemination;\n if (!prevCoda?.includes(\"\u05D8\")) {\n return cluster.text;\n }\n\n const noPharyngealization = schema[\"TET\"]?.replace(\"\u02C1\", \"\") ?? \"\";\n return cluster.text.replace(\"\u05D8\", `${noPharyngealization + schema[\"TET\"]}`);\n }\n },\n {\n FEATURE: \"cluster\",\n HEBREW: /\u05E6\u05BC(?!\\u{05b0})/u,\n TRANSLITERATION: (cluster, _, schema) => {\n // /\u05EA(?!\\u{05b0})/u rule for explanation\n if (!cluster.prev || cluster.prev.value?.isNotHebrew) {\n return cluster.text;\n }\n\n const prevCoda = cluster.syllable?.prev?.value?.codaWithGemination;\n if (!prevCoda?.includes(\"\u05E6\")) {\n return cluster.text;\n }\n\n const noPharyngealization = schema[\"TSADI\"]?.replace(\"\u02C1\", \"\") ?? \"\";\n return cluster.text.replace(\"\u05E6\", `${noPharyngealization + schema[\"TSADI\"]}`);\n }\n },\n {\n FEATURE: \"cluster\",\n HEBREW: /(\u05DB\u05BC|\u05DA\u05BC)(?!\\u{05b0})/u,\n TRANSLITERATION: (cluster, _, schema) => {\n // /\u05EA\u05BC[\\u{05B4}-\\u{05BB}]/u rule for explanation\n if (!cluster.prev || cluster.prev.value?.isNotHebrew) {\n return cluster.text;\n }\n\n const prevCoda = cluster.syllable?.prev?.value?.codaWithGemination;\n if (!prevCoda?.includes(\"\u05DB\") && !prevCoda?.includes(\"\u05DA\")) {\n return cluster.text;\n }\n\n const noAspiration = schema[\"KAF_DAGESH\"]?.replace(\"\u02B0\", \"\") ?? \"\";\n return cluster.text.replace(/\u05DB\u05BC|\u05DA\u05BC/u, `${noAspiration + schema[\"KAF_DAGESH\"]}`);\n }\n },\n {\n FEATURE: \"cluster\",\n HEBREW: \"\\u{05D0}(?![\\u{05B1}-\\u{05BB}\\u{05C7}])\",\n TRANSLITERATION: (cluster) => {\n const next = cluster.next?.value;\n if (next && next.isShureq) {\n return cluster.text;\n }\n\n return \"\";\n }\n },\n {\n FEATURE: \"cluster\",\n HEBREW: \"\\u{05D0}\\u{05BC}\",\n TRANSLITERATION: (cluster) => {\n // remove the dagesh\n return cluster.text.replace(\"\\u{05BC}\", \"\");\n }\n },\n {\n FEATURE: \"syllable\",\n HEBREW: /\u05E8/u,\n TRANSLITERATION: (syllable) => {\n // see TPT 229 for a summary if the pharyngealized resh\n const alveolars = /[\u05D3\u05D6\u05E6\u05EA\u05D8\u05E1\u05DC\u05E0]|\u05E9\u05C2/;\n\n // find cluster containing resh\n const cluster = syllable.clusters.filter((c) => c.text.includes(\"\u05E8\"))[0];\n const prevCluster = cluster.prev?.value;\n const currentSyllable = cluster?.syllable;\n const [onset, _, coda] = currentSyllable ? currentSyllable.structure(true) : [\"\", \"\", \"\"];\n\n if (prevCluster && alveolars.test(prevCluster.text)) {\n if (onset.includes(\"\u05E8\") && !prevCluster.hasVowel) {\n return syllable.text.replace(\"\u05E8\", \"r\u02C1\");\n }\n\n if (coda.includes(\"\u05E8\") && prevCluster.hasVowel) {\n return syllable.text.replace(\"\u05E8\", \"r\u02C1\");\n }\n }\n\n const nextCluster = cluster.next?.value;\n const lamedAndNun = /[\u05DC\u05E0\u05DF]/;\n if (nextCluster && lamedAndNun.test(nextCluster.text)) {\n if (onset.includes(\"\u05E8\") && !cluster.hasVowel) {\n return syllable.text.replace(\"\u05E8\", \"r\u02C1\");\n }\n\n if (coda.includes(\"\u05E8\") && cluster.hasSheva) {\n return syllable.text.replace(\"\u05E8\", \"r\u02C1\");\n }\n }\n\n // default\n return syllable.text;\n }\n },\n {\n FEATURE: \"syllable\",\n HEBREW: \"\u05D7\\u{05B7}\\u{05C3}?$\",\n PASS_THROUGH: true,\n TRANSLITERATION: (syllable, _hebrew, schema) => {\n // furtive patach before het preceded by vav or yod\n const prevText = syllable.prev?.value?.text || \"\";\n // see Khan 497-98 for examples involving length and the meteg\n // make sure to adjust other rules\n if (syllable.isFinal && prevText) {\n if (/[\u05D9\u05D5]/.test(prevText)) {\n const glide = /\u05D5/.test(prevText) ? \"w\" : \"j\";\n return glide + schema[\"PATAH\"] + schema[\"HET\"];\n }\n return schema[\"PATAH\"] + schema[\"HET\"];\n }\n\n return syllable.text;\n }\n },\n {\n FEATURE: \"syllable\",\n HEBREW: \"\u05E2\\u{05B7}\\u{05C3}?$\",\n PASS_THROUGH: true,\n TRANSLITERATION: (syllable, _hebrew, schema) => {\n // furtive patach before ayin preceded by vav or yod\n const prevText = syllable.prev?.value?.text;\n\n if (syllable.isFinal && prevText) {\n if (/[\u05D9\u05D5]/.test(prevText)) {\n const glide = /\u05D5/.test(prevText) ? \"w\" : \"j\";\n return glide + schema[\"PATAH\"] + schema[\"AYIN\"];\n }\n return schema[\"PATAH\"] + schema[\"AYIN\"];\n }\n\n return syllable.text;\n }\n },\n {\n FEATURE: \"syllable\",\n HEBREW: \"\u05D4\\u{05BC}\\u{05B7}\\u{05C3}?$\",\n PASS_THROUGH: true,\n TRANSLITERATION: (syllable, _hebrew, schema) => {\n // furtive patach before he preceded by vav or yod\n const prevText = syllable.prev?.value?.text;\n\n if (syllable.isFinal && prevText) {\n if (/[\u05D9\u05D5]/.test(prevText)) {\n const glide = /\u05D5/.test(prevText) ? \"w\" : \"j\";\n return glide + schema[\"PATAH\"] + schema[\"HE\"];\n }\n return schema[\"PATAH\"] + schema[\"HE\"];\n }\n\n return syllable.text;\n }\n },\n {\n FEATURE: \"syllable\",\n HEBREW: /\u05D5\u05BC(?![\\u{05B4}-\\u{05BB}])/u,\n TRANSLITERATION: (syllable, _, schema) => {\n // finds a vav with a dagesh not followed by a vowel character\n // if the syllable is the first syllable, replace with wu\u02D0\n // syllable.clusters[0].isShureq is not totally necessary, but it's a good check\n if (!syllable.prev && syllable.clusters[0].isShureq) {\n const text = syllable.text;\n const hasMeteg = syllable.clusters.map((c) => c.hasMeteg).includes(true); // also called gaya marking half long vowel length (\u00A71.2.8.2.2)\n const secondaryAccent = hasMeteg ? \"\u02CC\" : \"\";\n const halfLengthMarker = hasMeteg ? \"\u02D1\" : \"\";\n return text.replace(\"\u05D5\u05BC\", `${secondaryAccent}wu${halfLengthMarker}`);\n }\n\n if (syllable.isAccented && syllable.isClosed) {\n const noLength = schema[\"SHUREQ\"].replace(\"\u02D0\", \"\");\n return syllable.text.replace(\"\u05D5\u05BC\", schema[\"SHUREQ\"] + noLength);\n }\n\n return syllable.text;\n }\n },\n {\n FEATURE: \"syllable\",\n HEBREW: /[\\u{05B4}-\\u{05BB}\\u{05C7}]/u,\n TRANSLITERATION: (syllable, _, schema) => {\n // this features matches any syllable that has a full vowel character (i.e. not sheva)\n const vowelName = syllable.vowelName;\n const vowel = syllable.vowel;\n\n if (!vowel || !vowelName) {\n return syllable.text;\n }\n\n if (vowelName === \"SHEVA\") {\n throw new Error(`Syllable ${syllable.text} has a sheva as vowel, should not have matched`);\n }\n\n // half vowels do not have length; exit early\n const hasHalfVowel = syllable.clusters.map((c) => c.hasHalfVowel).includes(true);\n if (hasHalfVowel) {\n throw new Error(`Syllable ${syllable.text} has a hataf as vowel, should not have matched`);\n }\n\n const [onset, _nuclues, coda] = syllable.structure(true);\n /**\n * Determines the realization of a patach\n *\n * @param vowelChar the hebrew vowel character\n * @returns the back unrounded patach realization of the vowel or the original vowel if not patach\n */\n function determinePatachRealization(vowelChar: string) {\n // see comment for explanation: https://github.com/charlesLoder/hebrew-transliteration/issues/45#issuecomment-1712186201\n // exit early if not patach\n if (vowelName !== \"PATAH\" && vowelName !== \"HATAF_PATAH\") {\n return vowelChar;\n }\n\n // by this point, the resh has already been pharyngealized\n // but only for the current syllable\n const pharyngealized = /r\u02C1|\u05D8|\u05E6|\u05E5/;\n if (pharyngealized.test(onset) || pharyngealized.test(coda)) {\n return \"\u0251\";\n }\n\n // the resh of the next syllable has not been transliterated yet\n // check if the next syllable has a resh in the onset\n // and if the current syllable's coda is an alveolar\n const nextSyllable = syllable.next?.value;\n const nextOnset = nextSyllable?.onset;\n const alveolars = /[\u05D3\u05D6\u05E6\u05EA\u05D8\u05E1\u05DC\u05E0]|\u05E9\u05C2/;\n if (nextOnset === \"\u05E8\" && alveolars.test(coda)) {\n return \"\u0251\";\n }\n\n return vowelChar;\n }\n\n const noMaterText = syllable.clusters\n .filter((c) => !c.isMater)\n .map((c) => c.text)\n .join(\"\")\n // a holem followed by a he without a mappiq is not a mater\n // but b/c the he is not pronounced, we need to remove the final he\n .replace(/(\\u{05B9}.{1})\\u{05D4}(?!\\u{05BC})/u, \"$1\");\n\n const hasMaters = syllable.clusters.map((c) => c.isMater).includes(true);\n const lengthMarker = \"\u02D0\";\n const halfLengthMarker = \"\u02D1\";\n\n // See TPT \u00A71.2.10 concering meteg/gaya\n const hasMeteg = syllable.clusters.map((c) => c.hasMeteg).includes(true);\n if (hasMeteg) {\n const hasLongVowel = syllable.clusters.map((c) => c.hasLongVowel).includes(true);\n // when a meteg is present, the syllable implicitly has secondary stress\n // and the vowel is extended if it is not already long\n const firstConsonant = noMaterText[0];\n return noMaterText\n .replace(firstConsonant, `\u02CC${firstConsonant}`)\n .replace(vowel, `${determinePatachRealization(vowel)}${hasLongVowel ? lengthMarker : halfLengthMarker}`);\n }\n\n const isClosed = syllable.isClosed;\n const isAccented = syllable.isAccented;\n\n // TPT \u00A71.2.4, p288\n // When long vowels with the main stress occur in closed syllables,\n // there is evidence that an epenthetic with the same quality as that of the long vowel\n // occurred before the final consonant in its phonetic realization\"\n if (isAccented && isClosed) {\n const syllableSeparator = schema[\"SYLLABLE_SEPARATOR\"] || \"\";\n const vowelRealization = determinePatachRealization(vowel);\n return noMaterText.replace(\n vowel,\n `${vowelRealization + lengthMarker + syllableSeparator + vowelRealization}`\n );\n }\n\n // https://github.com/charlesLoder/hebrew-transliteration/issues/45#issuecomment-1747967050\n const longerVowels = [\"HOLAM\", \"TSERE\", \"QAMATS\"];\n if (!isAccented && isClosed && !syllable.isFinal && longerVowels.includes(vowelName)) {\n const syllableSeparator = schema[\"SYLLABLE_SEPARATOR\"] || \"\";\n const vowelRealization = determinePatachRealization(vowel);\n return noMaterText.replace(\n vowel,\n `${vowelRealization + lengthMarker + syllableSeparator + vowelRealization}`\n );\n }\n\n // TPT \u00A71.2.2.1 p268\n // Vowels represented by basic vowel signs are long when they are either\n // (i) in a stressed syllable or (ii) in an unstressed open syllable.\n if (isAccented || (!isAccented && !isClosed)) {\n return noMaterText.replace(vowel, `${determinePatachRealization(vowel) + lengthMarker}`);\n }\n\n if (!hasMaters && !isClosed && !isAccented) {\n return noMaterText.replace(vowel, `${determinePatachRealization(vowel)}`);\n }\n\n return syllable.text.replace(vowel, `${determinePatachRealization(vowel)}`);\n }\n },\n {\n FEATURE: \"syllable\",\n HEBREW: /[\\u{05B1}-\\u{05B3}]/u,\n TRANSLITERATION: (syllable) => {\n // this features matches any syllable that has a hataf vowel character\n const vowelName = syllable.vowelName;\n const vowel = syllable.vowel;\n\n if (!vowel || !vowelName) {\n return syllable.text;\n }\n\n if (vowelName === \"SHEVA\") {\n throw new Error(`Syllable ${syllable.text} has a sheva as vowel, should not have matched`);\n }\n\n const hasNonHalfVowels = syllable.clusters.map((c) => c.hasShortVowel || c.hasLongVowel).includes(true);\n if (hasNonHalfVowels) {\n throw new Error(`Syllable ${syllable.text} does not have a hataf vowel, should not have matched`);\n }\n\n const [onset, _nuclues, coda] = syllable.structure(true);\n /**\n * Determines the realization of a patach\n *\n * @param vowelChar the hebrew vowel character\n * @returns the back unrounded patach realization of the vowel or the original vowel if not patach\n */\n function determinePatachRealization(vowelChar: string) {\n // exit early if not hataf patach\n if (vowelName !== \"HATAF_PATAH\") {\n return vowelChar;\n }\n\n // by this point, the resh has already been pharyngealized in the transliteration\n // but only for the current syllable\n const pharyngealized = /r\u02C1|\u05D8|\u05E6|\u05E5/;\n if (pharyngealized.test(onset) || pharyngealized.test(coda)) {\n return \"\u0251\";\n }\n\n // the resh of the next syllable has not been transliterated yet\n // check if the next syllable has a resh in the onset\n // and if the current syllable's coda is an alveolar\n const nextSyllable = syllable.next?.value;\n const nextOnset = nextSyllable?.onset;\n const alveolars = /[\u05D3\u05D6\u05E6\u05EA\u05D8\u05E1\u05DC\u05E0]|\u05E9\u05C2/;\n if (nextOnset === \"\u05E8\" && alveolars.test(coda)) {\n return \"\u0251\";\n }\n\n // check for the \"environment of pharyngealized consonants\"\n // https://www.tiberianhebrew.com/patah\n if (nextOnset && /[\u05E6\u05E5\u05D8]/.test(nextOnset)) {\n return \"\u0251\";\n }\n\n return vowelChar;\n }\n\n return syllable.text.replace(vowel, `${determinePatachRealization(vowel)}`);\n }\n },\n {\n FEATURE: \"syllable\",\n HEBREW: /(?<!.*([\\u{05B4}-\\u{05BB}\\u{05C7}]|\\u{05D5}\\u{05BC}).*)\\u{05B0}/u,\n TRANSLITERATION: (syllable, _hebrew, schema) => {\n // matches any syllable that contains a sheva that is not preceded by a full vowel character [\\u{05B4}-\\u{05BB}\\u{05C7}]\n // or shureq \\u{5D5}\\u{5BC}\n const nextSyllable = syllable.next?.value;\n if (!nextSyllable) return syllable.text;\n\n const nextSylFirstCluster = nextSyllable.clusters[0].text;\n if (!nextSylFirstCluster) return syllable.text;\n\n const [onset, _, coda] = syllable.structure(true);\n\n function isBackUnrounded() {\n // see comment for explanation: https://github.com/charlesLoder/hebrew-transliteration/issues/45#issuecomment-1712186201\n // by this point, the resh has already been pharyngealized in the transliteration\n const pharyngealized = /r\u02C1|\u05D8|\u05E6|\u05E5/;\n if (pharyngealized.test(onset) || pharyngealized.test(coda)) {\n return true;\n }\n\n const nextSyllable = syllable.next?.value;\n if (!nextSyllable) {\n return false;\n }\n\n const nextOnset = nextSyllable.onset;\n if (pharyngealized.test(nextOnset)) {\n return true;\n }\n\n return false;\n }\n\n function transliterateShevaAsVowel(vowel: string) {\n const hasMeteg = syllable.clusters.map((c) => c.hasMeteg).includes(true);\n const secondaryAccent = hasMeteg ? \"\u02CC\" : \"\";\n const halfLengthMarker = hasMeteg ? \"\u02D1\" : \"\";\n const newVowel = vowel.replace(\"\u02D0\", \"\") + halfLengthMarker;\n\n return secondaryAccent + syllable.text.replace(/\\u{05B0}/u, newVowel);\n }\n\n const isGuttural = /[\u05D0\u05D4\u05D7\u05E2]/.test(nextSylFirstCluster);\n if (!isGuttural) {\n return transliterateShevaAsVowel(isBackUnrounded() ? \"\u0251\" : schema[\"PATAH\"]);\n }\n\n const nextVowel = nextSyllable.vowelName;\n if (!nextVowel) {\n throw new Error(\n `Syllable ${syllable.text} has a sheva as a vowel, but the next syllable ${nextSylFirstCluster} does not have a vowel`\n );\n }\n\n if (nextVowel === \"SHEVA\") {\n throw new Error(\n `Syllable ${syllable.text} has a sheva as a vowel, but the next syllable ${nextSylFirstCluster} also has a sheva as a vowel`\n );\n }\n\n return transliterateShevaAsVowel(schema[nextVowel]);\n }\n }\n ],\n allowNoNiqqud: false,\n article: false,\n holemHaser: \"remove\",\n longVowels: false,\n qametsQatan: true,\n shevaAfterMeteg: false,\n shevaWithMeteg: true,\n sqnmlvy: false,\n strict: true,\n wawShureq: false\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAEA;;;;;AAAO,MAAM,WAAmB;EAC9B,aAAa;EACb,aAAa;EACb,aAAa;EACb,cAAc;EACd,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,QAAQ;EACR,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ;EACR,eAAe;EACf,OAAO;EACP,OAAO;EACP,WAAW;EACX,cAAc;EACd,eAAe;EACf,WAAW;EACX,WAAW;EACX,WAAW;EACX,QAAQ;EACR,WAAW;EACX,WAAW;EACX,UAAU;EACV,UAAU;EACV,SAAS;EACT,MAAM;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AI,CAAC,YAAY;AACf,iBAAO,0BAA0B,gBAAe,IAAK,WAAM,OAAO,QAAQ;QAC5E;AAEA,cAAM,YAAY,aAAa;AAC/B,YAAI,CAAC,WAAW;AACd,gBAAM,IAAI,MACR,YAAY,SAAS,sDAAsD,2CAA2C;QAE1H;AAEA,YAAI,cAAc,SAAS;AACzB,gBAAM,IAAI,MACR,YAAY,SAAS,sDAAsD,iDAAiD;QAEhI;AAEA,eAAO,0BAA0B,OAAO,UAAU;MACpD;;;EAGJ,eAAe;EACf,SAAS;EACT,YAAY;EACZ,YAAY;EACZ,aAAa;EACb,iBAAiB;EACjB,gBAAgB;EAChB,SAAS;EACT,QAAQ;EACR,WAAW;;",
6
+ "names": ["_a", "nextSyllable"]
7
+ }
@@ -0,0 +1,34 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var sequence_exports = {};
19
+ __export(sequence_exports, {
20
+ sequence: () => sequence,
21
+ vowels: () => vowels
22
+ });
23
+ module.exports = __toCommonJS(sequence_exports);
24
+ var import_havarotjs = require("havarotjs");
25
+ const vowels = /[\u{05B0}-\u{05BC}\u{05C7}]/u;
26
+ const sequence = (text, qametsQatan = false) => {
27
+ return vowels.test(text) ? new import_havarotjs.Text(text, { qametsQatan }).text : text;
28
+ };
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ sequence,
32
+ vowels
33
+ });
34
+ //# sourceMappingURL=sequence.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/sequence.ts"],
4
+ "sourcesContent": ["import { Text } from \"havarotjs\";\n\nexport const vowels = /[\\u{05B0}-\\u{05BC}\\u{05C7}]/u;\n\n/**\n * sequences Hebrew charactes according to the [SBL Hebrew Font Manual](https://www.sbl-site.org/Fonts/SBLHebrewUserManual1.5x.pdf)\n *\n * @param text - a string of Hebrew character\n * @param qametsQatan - option to convert regular qamets characters to qamets qatan\n * @returns a sequenced string of text\n * @remarks\n * 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}\n *\n * @example\n *\n * ```ts\n * 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}\");\n * \"\\u{5D1}\\u{5BC}\\u{5B0}\\u{5E8}\\u{5B5}\\u{5D0}\\u{5E9}\\u{5C1}\\u{5B4}\\u{596}\\u{5D9}\\u{5EA}\";\n * ```\n */\nexport const sequence = (text: string, qametsQatan = false): string => {\n return vowels.test(text) ? new Text(text, { qametsQatan }).text : text;\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;;;;;;uBAAqB;AAEd,MAAM,SAAS;AAkBf,MAAM,WAAW,CAAC,MAAc,cAAc,UAAiB;AACpE,SAAO,OAAO,KAAK,IAAI,IAAI,IAAI,sBAAK,MAAM,EAAE,YAAW,CAAE,EAAE,OAAO;AACpE;",
6
+ "names": []
7
+ }
@@ -0,0 +1,63 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var transliterate_exports = {};
19
+ __export(transliterate_exports, {
20
+ transliterate: () => transliterate
21
+ });
22
+ module.exports = __toCommonJS(transliterate_exports);
23
+ var import_rules = require("./rules.js");
24
+ var import_schema = require("./schema.js");
25
+ var import_havarotjs = require("havarotjs");
26
+ var import_word = require("havarotjs/word");
27
+ const getSylOpts = (schema) => {
28
+ const options = {};
29
+ if ("longVowels" in schema)
30
+ options.longVowels = schema.longVowels;
31
+ if ("qametsQatan" in schema)
32
+ options.qametsQatan = schema.qametsQatan;
33
+ if ("sqnmlvy" in schema)
34
+ options.shevaAfterMeteg = schema.shevaAfterMeteg;
35
+ if ("sqnmlvy" in schema)
36
+ options.sqnmlvy = schema.sqnmlvy;
37
+ if ("wawShureq" in schema)
38
+ options.wawShureq = schema.wawShureq;
39
+ if ("article" in schema)
40
+ options.article = schema.article;
41
+ if ("allowNoNiqqud" in schema)
42
+ options.allowNoNiqqud = schema.allowNoNiqqud;
43
+ if ("strict" in schema)
44
+ options.strict = schema.strict;
45
+ return options;
46
+ };
47
+ const transliterate = (text, schema) => {
48
+ const transSchema = schema instanceof import_schema.Schema ? schema : new import_schema.SBL(schema != null ? schema : {});
49
+ const newText = text instanceof import_havarotjs.Text ? text : new import_havarotjs.Text(text, getSylOpts(transSchema != null ? transSchema : {}));
50
+ return newText.words.map((word) => {
51
+ var _a, _b;
52
+ let transliteration = (0, import_rules.wordRules)(word, transSchema);
53
+ if (transliteration instanceof import_word.Word) {
54
+ transliteration = transliteration.syllables.map((s) => (0, import_rules.sylRules)(s, transSchema)).join((_a = transSchema.SYLLABLE_SEPARATOR) != null ? _a : "");
55
+ }
56
+ return `${transliteration}${(_b = word.whiteSpaceAfter) != null ? _b : ""}`;
57
+ }).join("");
58
+ };
59
+ // Annotate the CommonJS export names for ESM import in node:
60
+ 0 && (module.exports = {
61
+ transliterate
62
+ });
63
+ //# sourceMappingURL=transliterate.js.map