hebrew-transliteration 2.8.3 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/rules.js +110 -93
- package/dist/cjs/rules.js.map +3 -3
- package/dist/cjs/schema.js +134 -130
- package/dist/cjs/schema.js.map +2 -2
- package/dist/cjs/schemas/romaniote.js +1 -1
- package/dist/cjs/schemas/romaniote.js.map +1 -1
- package/dist/cjs/transliterate.js +11 -9
- package/dist/cjs/transliterate.js.map +3 -3
- package/dist/esm/rules.js +120 -99
- package/dist/esm/rules.js.map +1 -1
- package/dist/esm/schema.js +20 -0
- package/dist/esm/schema.js.map +1 -1
- package/dist/esm/schemas/romaniote.js +1 -1
- package/dist/esm/schemas/romaniote.js.map +1 -1
- package/dist/esm/transliterate.js +12 -12
- package/dist/esm/transliterate.js.map +1 -1
- package/dist/types/schema.d.ts +19 -0
- package/package.json +15 -5
package/dist/cjs/rules.js
CHANGED
|
@@ -26,7 +26,66 @@ var import_syllable = require("havarotjs/syllable");
|
|
|
26
26
|
var import_regularExpressions = require("havarotjs/utils/regularExpressions");
|
|
27
27
|
var import_word = require("havarotjs/word");
|
|
28
28
|
var import_hebCharsTrans = require("./hebCharsTrans.js");
|
|
29
|
-
const taamim = /[\u{
|
|
29
|
+
const taamim = /[\u{0591}-\u{05AF}\u{05BD}\u{05BF}]/gu;
|
|
30
|
+
const addStressMarker = (text, syl, schema) => {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
if (!schema.STRESS_MARKER || !text) {
|
|
33
|
+
return text;
|
|
34
|
+
}
|
|
35
|
+
if (!syl.isAccented) {
|
|
36
|
+
return text;
|
|
37
|
+
}
|
|
38
|
+
const exclude = (_b = (_a = schema.STRESS_MARKER) == null ? void 0 : _a.exclude) != null ? _b : "never";
|
|
39
|
+
if (exclude === "single" && !syl.prev && !syl.next) {
|
|
40
|
+
return text;
|
|
41
|
+
}
|
|
42
|
+
if (exclude === "final" && !syl.next) {
|
|
43
|
+
return text;
|
|
44
|
+
}
|
|
45
|
+
const location = schema.STRESS_MARKER.location;
|
|
46
|
+
const mark = schema.STRESS_MARKER.mark;
|
|
47
|
+
if (text.includes(mark)) {
|
|
48
|
+
return text;
|
|
49
|
+
}
|
|
50
|
+
if (location === "before-syllable") {
|
|
51
|
+
const isDoubled = syl.clusters.map((c) => isDageshChazaq(c, schema)).includes(true);
|
|
52
|
+
if (isDoubled) {
|
|
53
|
+
const [first, ...rest] = text.split("");
|
|
54
|
+
return `${first}${mark}${rest.join("")}`;
|
|
55
|
+
}
|
|
56
|
+
return `${mark}${text}`;
|
|
57
|
+
}
|
|
58
|
+
if (location === "after-syllable") {
|
|
59
|
+
return `${text}${mark}`;
|
|
60
|
+
}
|
|
61
|
+
const vowels = [
|
|
62
|
+
schema.PATAH,
|
|
63
|
+
schema.HATAF_PATAH,
|
|
64
|
+
schema.QAMATS,
|
|
65
|
+
schema.HATAF_QAMATS,
|
|
66
|
+
schema.SEGOL,
|
|
67
|
+
schema.HATAF_SEGOL,
|
|
68
|
+
schema.TSERE,
|
|
69
|
+
schema.HIRIQ,
|
|
70
|
+
schema.HOLAM,
|
|
71
|
+
schema.QAMATS_QATAN,
|
|
72
|
+
schema.QUBUTS,
|
|
73
|
+
schema.QAMATS_HE,
|
|
74
|
+
schema.SEGOL_HE,
|
|
75
|
+
schema.TSERE_HE,
|
|
76
|
+
schema.HIRIQ_YOD,
|
|
77
|
+
schema.TSERE_YOD,
|
|
78
|
+
schema.SEGOL_YOD,
|
|
79
|
+
schema.HOLAM_VAV,
|
|
80
|
+
schema.SHUREQ
|
|
81
|
+
].filter((v) => typeof v === "string").sort((a, b) => b.length - a.length);
|
|
82
|
+
const vowelRgx = new RegExp(`${vowels.join("|")}`);
|
|
83
|
+
const match = text.match(vowelRgx);
|
|
84
|
+
if (location === "before-vowel") {
|
|
85
|
+
return (match == null ? void 0 : match.length) ? text.replace(match[0], `${mark}${match[0]}`) : text;
|
|
86
|
+
}
|
|
87
|
+
return (match == null ? void 0 : match.length) ? text.replace(match[0], `${match[0]}${mark}`) : text;
|
|
88
|
+
};
|
|
30
89
|
const copySyllable = (newText, old) => {
|
|
31
90
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
32
91
|
const newClusters = newText.split(import_regularExpressions.clusterSplitGroup).map((clusterString) => new import_cluster.Cluster(clusterString, true));
|
|
@@ -60,12 +119,15 @@ const copySyllable = (newText, old) => {
|
|
|
60
119
|
newSyl.word = old.word;
|
|
61
120
|
return newSyl;
|
|
62
121
|
};
|
|
63
|
-
const getDageshChazaqVal = (input,
|
|
122
|
+
const getDageshChazaqVal = (input, schema, isChazaq) => {
|
|
123
|
+
var _a;
|
|
64
124
|
if (!isChazaq) {
|
|
65
125
|
return input;
|
|
66
126
|
}
|
|
127
|
+
const dagesh = schema["DAGESH_CHAZAQ"];
|
|
128
|
+
const syllableSeparator = (_a = schema["SYLLABLE_SEPARATOR"]) != null ? _a : "";
|
|
67
129
|
if (typeof dagesh === "boolean") {
|
|
68
|
-
return input
|
|
130
|
+
return input + syllableSeparator + input;
|
|
69
131
|
}
|
|
70
132
|
return input + dagesh;
|
|
71
133
|
};
|
|
@@ -76,7 +138,7 @@ const getDivineName = (str, schema) => {
|
|
|
76
138
|
return `${import_regularExpressions.hebChars.test(begn) ? "" : begn}${divineName}${import_regularExpressions.hebChars.test(end) ? "" : end}`;
|
|
77
139
|
};
|
|
78
140
|
const isDageshChazaq = (cluster, schema) => {
|
|
79
|
-
var _a, _b, _c, _d, _e, _f;
|
|
141
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
80
142
|
if (!schema.DAGESH_CHAZAQ) {
|
|
81
143
|
return false;
|
|
82
144
|
}
|
|
@@ -86,22 +148,26 @@ const isDageshChazaq = (cluster, schema) => {
|
|
|
86
148
|
if (!/\u{05BC}/u.test(cluster.text)) {
|
|
87
149
|
return false;
|
|
88
150
|
}
|
|
89
|
-
const
|
|
151
|
+
const prevCluster = (_a = cluster.prev) == null ? void 0 : _a.value;
|
|
152
|
+
if (prevCluster && prevCluster.hasSheva) {
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
const prevWord = (_d = (_c = (_b = cluster.syllable) == null ? void 0 : _b.word) == null ? void 0 : _c.prev) == null ? void 0 : _d.value;
|
|
90
156
|
if (prevWord && (prevWord == null ? void 0 : prevWord.isInConstruct) && !prevWord.syllables[prevWord.syllables.length - 1].isClosed) {
|
|
91
157
|
return true;
|
|
92
158
|
}
|
|
93
|
-
const prevSyllable = (
|
|
159
|
+
const prevSyllable = (_e = cluster.syllable) == null ? void 0 : _e.prev;
|
|
94
160
|
if (!prevSyllable) {
|
|
95
161
|
return false;
|
|
96
162
|
}
|
|
97
|
-
const prevCoda = (
|
|
163
|
+
const prevCoda = (_f = prevSyllable.value) == null ? void 0 : _f.codaWithGemination;
|
|
98
164
|
if (!prevCoda) {
|
|
99
165
|
return false;
|
|
100
166
|
}
|
|
101
|
-
return prevCoda === ((
|
|
167
|
+
return prevCoda === ((_g = cluster.syllable) == null ? void 0 : _g.onset);
|
|
102
168
|
};
|
|
103
169
|
const joinSyllableChars = (syl, sylChars, schema) => {
|
|
104
|
-
var _a
|
|
170
|
+
var _a;
|
|
105
171
|
const isInConstruct = (_a = syl.word) == null ? void 0 : _a.isInConstruct;
|
|
106
172
|
if (isInConstruct) {
|
|
107
173
|
return sylChars.map(mapChars(schema)).join("");
|
|
@@ -113,60 +179,6 @@ const joinSyllableChars = (syl, sylChars, schema) => {
|
|
|
113
179
|
if (isOnlyPunctuation) {
|
|
114
180
|
return sylChars.map(mapChars(schema)).join("");
|
|
115
181
|
}
|
|
116
|
-
if (schema.STRESS_MARKER) {
|
|
117
|
-
const exclude = (_c = (_b = schema.STRESS_MARKER) == null ? void 0 : _b.exclude) != null ? _c : "never";
|
|
118
|
-
if (exclude === "single" && !syl.prev && !syl.next) {
|
|
119
|
-
return sylChars.map(mapChars(schema)).join("");
|
|
120
|
-
}
|
|
121
|
-
if (exclude === "final" && !syl.next) {
|
|
122
|
-
return sylChars.map(mapChars(schema)).join("");
|
|
123
|
-
}
|
|
124
|
-
const location = schema.STRESS_MARKER.location;
|
|
125
|
-
const mark = schema.STRESS_MARKER.mark;
|
|
126
|
-
if (syl.text.includes(mark)) {
|
|
127
|
-
return sylChars.map(mapChars(schema)).join("");
|
|
128
|
-
}
|
|
129
|
-
if (location === "before-syllable") {
|
|
130
|
-
const isDoubled = syl.clusters.map((c) => isDageshChazaq(c, schema)).includes(true);
|
|
131
|
-
if (isDoubled) {
|
|
132
|
-
const chars = sylChars.map(mapChars(schema)).join("");
|
|
133
|
-
const [first, ...rest] = chars;
|
|
134
|
-
return `${first}${mark}${rest.join("")}`;
|
|
135
|
-
}
|
|
136
|
-
return `${mark}${sylChars.map(mapChars(schema)).join("")}`;
|
|
137
|
-
}
|
|
138
|
-
if (location === "after-syllable") {
|
|
139
|
-
return `${sylChars.map(mapChars(schema)).join("")}${mark}`;
|
|
140
|
-
}
|
|
141
|
-
const vowels = [
|
|
142
|
-
schema.PATAH,
|
|
143
|
-
schema.HATAF_PATAH,
|
|
144
|
-
schema.QAMATS,
|
|
145
|
-
schema.HATAF_QAMATS,
|
|
146
|
-
schema.SEGOL,
|
|
147
|
-
schema.HATAF_SEGOL,
|
|
148
|
-
schema.TSERE,
|
|
149
|
-
schema.HIRIQ,
|
|
150
|
-
schema.HOLAM,
|
|
151
|
-
schema.QAMATS_QATAN,
|
|
152
|
-
schema.QUBUTS,
|
|
153
|
-
schema.QAMATS_HE,
|
|
154
|
-
schema.SEGOL_HE,
|
|
155
|
-
schema.TSERE_HE,
|
|
156
|
-
schema.HIRIQ_YOD,
|
|
157
|
-
schema.TSERE_YOD,
|
|
158
|
-
schema.SEGOL_YOD,
|
|
159
|
-
schema.HOLAM_VAV,
|
|
160
|
-
schema.SHUREQ
|
|
161
|
-
].filter((v) => typeof v === "string").sort((a, b) => b.length - a.length);
|
|
162
|
-
const vowelRgx = new RegExp(`${vowels.join("|")}`);
|
|
163
|
-
const str = sylChars.map(mapChars(schema)).join("");
|
|
164
|
-
const match = str.match(vowelRgx);
|
|
165
|
-
if (location === "before-vowel") {
|
|
166
|
-
return (match == null ? void 0 : match.length) ? str.replace(match[0], `${mark}${match[0]}`) : str;
|
|
167
|
-
}
|
|
168
|
-
return (match == null ? void 0 : match.length) ? str.replace(match[0], `${match[0]}${mark}`) : str;
|
|
169
|
-
}
|
|
170
182
|
return sylChars.map(mapChars(schema)).join("");
|
|
171
183
|
};
|
|
172
184
|
const mapChars = (schema) => (input) => {
|
|
@@ -250,36 +262,36 @@ const cluterRules = (cluster, schema) => {
|
|
|
250
262
|
}
|
|
251
263
|
const isDageshChazq = isDageshChazaq(cluster, schema);
|
|
252
264
|
if (schema.BET_DAGESH && /ב\u{05BC}/u.test(clusterText)) {
|
|
253
|
-
return replaceWithRegex(clusterText, /ב\u{05BC}/u, getDageshChazaqVal(schema.BET_DAGESH, schema
|
|
265
|
+
return replaceWithRegex(clusterText, /ב\u{05BC}/u, getDageshChazaqVal(schema.BET_DAGESH, schema, isDageshChazq));
|
|
254
266
|
}
|
|
255
267
|
if (schema.GIMEL_DAGESH && /ג\u{05BC}/u.test(clusterText)) {
|
|
256
|
-
return replaceWithRegex(clusterText, /ג\u{05BC}/u, getDageshChazaqVal(schema.GIMEL_DAGESH, schema
|
|
268
|
+
return replaceWithRegex(clusterText, /ג\u{05BC}/u, getDageshChazaqVal(schema.GIMEL_DAGESH, schema, isDageshChazq));
|
|
257
269
|
}
|
|
258
270
|
if (schema.DALET_DAGESH && /ד\u{05BC}/u.test(clusterText)) {
|
|
259
|
-
return replaceWithRegex(clusterText, /ד\u{05BC}/u, getDageshChazaqVal(schema.DALET_DAGESH, schema
|
|
271
|
+
return replaceWithRegex(clusterText, /ד\u{05BC}/u, getDageshChazaqVal(schema.DALET_DAGESH, schema, isDageshChazq));
|
|
260
272
|
}
|
|
261
273
|
if (schema.KAF_DAGESH && /כ\u{05BC}/u.test(clusterText)) {
|
|
262
|
-
return replaceWithRegex(clusterText, /כ\u{05BC}/u, getDageshChazaqVal(schema.KAF_DAGESH, schema
|
|
274
|
+
return replaceWithRegex(clusterText, /כ\u{05BC}/u, getDageshChazaqVal(schema.KAF_DAGESH, schema, isDageshChazq));
|
|
263
275
|
}
|
|
264
276
|
if (schema.KAF_DAGESH && /ך\u{05BC}/u.test(clusterText)) {
|
|
265
|
-
return replaceWithRegex(clusterText, /ך\u{05BC}/u, getDageshChazaqVal(schema.KAF_DAGESH, schema
|
|
277
|
+
return replaceWithRegex(clusterText, /ך\u{05BC}/u, getDageshChazaqVal(schema.KAF_DAGESH, schema, isDageshChazq));
|
|
266
278
|
}
|
|
267
279
|
if (schema.PE_DAGESH && /פ\u{05BC}/u.test(clusterText)) {
|
|
268
|
-
return replaceWithRegex(clusterText, /פ\u{05BC}/u, getDageshChazaqVal(schema.PE_DAGESH, schema
|
|
280
|
+
return replaceWithRegex(clusterText, /פ\u{05BC}/u, getDageshChazaqVal(schema.PE_DAGESH, schema, isDageshChazq));
|
|
269
281
|
}
|
|
270
282
|
if (schema.TAV_DAGESH && /ת\u{05BC}/u.test(clusterText)) {
|
|
271
|
-
return replaceWithRegex(clusterText, /ת\u{05BC}/u, getDageshChazaqVal(schema.TAV_DAGESH, schema
|
|
283
|
+
return replaceWithRegex(clusterText, /ת\u{05BC}/u, getDageshChazaqVal(schema.TAV_DAGESH, schema, isDageshChazq));
|
|
272
284
|
}
|
|
273
285
|
if (/ש\u{05C1}/u.test(clusterText)) {
|
|
274
|
-
return replaceWithRegex(clusterText, /ש\u{05C1}/u, getDageshChazaqVal(schema.SHIN, schema
|
|
286
|
+
return replaceWithRegex(clusterText, /ש\u{05C1}/u, getDageshChazaqVal(schema.SHIN, schema, isDageshChazq));
|
|
275
287
|
}
|
|
276
288
|
if (/ש\u{05C2}/u.test(clusterText)) {
|
|
277
|
-
return replaceWithRegex(clusterText, /ש\u{05C2}/u, getDageshChazaqVal(schema.SIN, schema
|
|
289
|
+
return replaceWithRegex(clusterText, /ש\u{05C2}/u, getDageshChazaqVal(schema.SIN, schema, isDageshChazq));
|
|
278
290
|
}
|
|
279
291
|
if (isDageshChazq) {
|
|
280
292
|
const consonant = cluster.chars[0].text;
|
|
281
293
|
const consonantDagesh = new RegExp(consonant + "\u05BC", "u");
|
|
282
|
-
return replaceWithRegex(clusterText, consonantDagesh, getDageshChazaqVal(consonant, schema
|
|
294
|
+
return replaceWithRegex(clusterText, consonantDagesh, getDageshChazaqVal(consonant, schema, isDageshChazq));
|
|
283
295
|
}
|
|
284
296
|
if (cluster.isShureq) {
|
|
285
297
|
return clusterText.replace("\u05D5\u05BC", schema.SHUREQ);
|
|
@@ -288,49 +300,54 @@ const cluterRules = (cluster, schema) => {
|
|
|
288
300
|
};
|
|
289
301
|
const sylRules = (syl, schema) => {
|
|
290
302
|
var _a, _b;
|
|
291
|
-
const
|
|
303
|
+
const baseSyllableText = syl.text.replace(taamim, "");
|
|
292
304
|
const syllableFeatures = (_a = schema.ADDITIONAL_FEATURES) == null ? void 0 : _a.filter((seq) => seq.FEATURE === "syllable");
|
|
293
305
|
if (syllableFeatures) {
|
|
294
306
|
for (const feature of syllableFeatures) {
|
|
295
307
|
const heb = new RegExp(feature.HEBREW, "u");
|
|
296
|
-
if (feature.FEATURE === "syllable" && heb.test(
|
|
308
|
+
if (feature.FEATURE === "syllable" && heb.test(baseSyllableText)) {
|
|
297
309
|
const transliteration = feature.TRANSLITERATION;
|
|
298
310
|
const passThrough = (_b = feature.PASS_THROUGH) != null ? _b : true;
|
|
299
311
|
if (typeof transliteration === "string") {
|
|
300
|
-
return replaceAndTransliterate(
|
|
312
|
+
return replaceAndTransliterate(baseSyllableText, heb, transliteration, schema);
|
|
301
313
|
}
|
|
302
314
|
if (!passThrough) {
|
|
303
315
|
return transliteration(syl, feature.HEBREW, schema);
|
|
304
316
|
}
|
|
305
317
|
const newText = transliteration(syl, feature.HEBREW, schema);
|
|
306
|
-
if (newText !==
|
|
318
|
+
if (newText !== baseSyllableText) {
|
|
307
319
|
syl = copySyllable(newText, syl);
|
|
308
320
|
}
|
|
309
321
|
}
|
|
310
322
|
}
|
|
311
323
|
}
|
|
312
|
-
const mSSuffix = /\u{05B8}\u{05D9}\u{05D5}/u;
|
|
313
|
-
if (syl.isFinal && mSSuffix.test(sylTxt)) {
|
|
314
|
-
const sufxSyl = replaceWithRegex(sylTxt, mSSuffix, schema.MS_SUFX);
|
|
315
|
-
return joinSyllableChars(syl, [...sufxSyl], schema);
|
|
316
|
-
}
|
|
317
324
|
const hasMater = syl.clusters.map((c) => c.isMater).includes(true);
|
|
318
325
|
if (hasMater) {
|
|
319
326
|
const materSyl = materFeatures(syl, schema);
|
|
320
|
-
|
|
327
|
+
const text2 = joinSyllableChars(syl, [...materSyl], schema);
|
|
328
|
+
return addStressMarker(text2, syl, schema);
|
|
329
|
+
}
|
|
330
|
+
const clusters = syl.clusters.map((cluster) => cluterRules(cluster, schema));
|
|
331
|
+
const joined = joinSyllableChars(syl, clusters, schema).replace(taamim, "");
|
|
332
|
+
const mSSuffix = /\u{05B8}\u{05D9}\u{05D5}/u;
|
|
333
|
+
if (syl.isFinal && mSSuffix.test(baseSyllableText)) {
|
|
334
|
+
const text2 = joined.replace(schema["QAMATS"] + schema["YOD"] + schema["VAV"], schema.MS_SUFX);
|
|
335
|
+
return addStressMarker(text2, syl, schema);
|
|
336
|
+
}
|
|
337
|
+
if (schema.SEGOL_HE && /\u{05B6}\u{05D4}/u.test(baseSyllableText)) {
|
|
338
|
+
const text2 = joined.replace(schema["SEGOL"] + schema["HE"], schema.SEGOL_HE);
|
|
339
|
+
return addStressMarker(text2, syl, schema);
|
|
321
340
|
}
|
|
322
|
-
if (schema.
|
|
323
|
-
const
|
|
324
|
-
|
|
325
|
-
return joined.replace(schema["SEGOL"] + schema["HE"], schema.SEGOL_HE);
|
|
341
|
+
if (schema.TSERE_HE && /\u{05B5}\u{05D4}/u.test(baseSyllableText)) {
|
|
342
|
+
const text2 = joined.replace(schema["TSERE"] + schema["HE"], schema.TSERE_HE);
|
|
343
|
+
return addStressMarker(text2, syl, schema);
|
|
326
344
|
}
|
|
327
|
-
if (schema.
|
|
328
|
-
const
|
|
329
|
-
|
|
330
|
-
return joined.replace(schema["TSERE"] + schema["HE"], schema.TSERE_HE);
|
|
345
|
+
if (schema.PATAH_HE && /\u{05B7}\u{05D4}/u.test(baseSyllableText)) {
|
|
346
|
+
const text2 = joined.replace(schema["PATAH"] + schema["HE"], schema.PATAH_HE);
|
|
347
|
+
return addStressMarker(text2, syl, schema);
|
|
331
348
|
}
|
|
332
|
-
const
|
|
333
|
-
return
|
|
349
|
+
const text = joined.replace(taamim, "");
|
|
350
|
+
return addStressMarker(text, syl, schema);
|
|
334
351
|
};
|
|
335
352
|
const wordRules = (word, schema) => {
|
|
336
353
|
var _a, _b;
|
package/dist/cjs/rules.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/rules.ts"],
|
|
4
|
-
"sourcesContent": ["import { Cluster } from \"havarotjs/cluster\";\nimport { Syllable } from \"havarotjs/syllable\";\nimport { clusterSplitGroup, hebChars } from \"havarotjs/utils/regularExpressions\";\nimport { Word } from \"havarotjs/word\";\nimport { transliterateMap as map } from \"./hebCharsTrans\";\nimport { Schema } from \"./schema\";\n\nconst taamim = /[\\u{0590}-\\u{05AF}\\u{05BD}\\u{05BF}]/gu;\n\nconst copySyllable = (newText: string, old: Syllable) => {\n const newClusters = newText.split(clusterSplitGroup).map((clusterString) => new Cluster(clusterString, true));\n const oldClusters = old.clusters;\n\n // set prev and next based on old syllable\n if (newClusters.length === oldClusters.length) {\n newClusters.forEach((c, i) => ((c.prev = oldClusters[i]?.prev ?? null), (c.next = oldClusters[i]?.next ?? null)));\n } else {\n for (let i = 0; i < newClusters.length; i++) {\n const c = newClusters[i];\n if (oldClusters[i]?.text[0] === c?.text[0]) {\n c.prev = oldClusters[i]?.prev ?? null;\n c.next = oldClusters[i]?.next ?? null;\n } else {\n c.prev = oldClusters[i]?.prev ?? null;\n c.next = oldClusters[i + 1]?.next ?? null;\n i++;\n }\n }\n }\n\n const newSyl = new Syllable(newClusters, {\n isClosed: old.isClosed,\n isAccented: old.isAccented,\n isFinal: old.isFinal\n });\n\n newClusters.forEach((c) => (c.syllable = newSyl));\n\n newSyl.prev = old.prev;\n newSyl.next = old.next;\n newSyl.word = old.word;\n\n return newSyl;\n};\n\nconst getDageshChazaqVal = (input: string, dagesh: Schema[\"DAGESH_CHAZAQ\"], isChazaq: boolean) => {\n if (!isChazaq) {\n return input;\n }\n\n if (typeof dagesh === \"boolean\") {\n return input.repeat(2);\n }\n\n return input + dagesh;\n};\n\n/**\n * Formats the Divine Name with any Latin chars\n *\n * @param str word text\n * @param schema\n * @returns the Divine Name with any pre or proceding Latin chars\n */\nconst getDivineName = (str: string, schema: Schema): string => {\n const begn = str[0];\n const end = str[str.length - 1];\n // if DN is pointed with a hiriq, then it is read as 'elohim\n const divineName =\n schema.DIVINE_NAME_ELOHIM && /\\u{05B4}/u.test(str) ? schema.DIVINE_NAME_ELOHIM : schema.DIVINE_NAME;\n return `${hebChars.test(begn) ? \"\" : begn}${divineName}${hebChars.test(end) ? \"\" : end}`;\n};\n\nconst isDageshChazaq = (cluster: Cluster, schema: Schema) => {\n // if there is no dagesh chazaq in the schema, then return false\n if (!schema.DAGESH_CHAZAQ) {\n return false;\n }\n\n // a shureq could potentially match because of dagesh\n if (cluster.isShureq) {\n return false;\n }\n\n // if there is no dagesh in the text, then return false\n if (!/\\u{05BC}/u.test(cluster.text)) {\n return false;\n }\n\n const prevWord = cluster.syllable?.word?.prev?.value;\n if (prevWord && prevWord?.isInConstruct && !prevWord.syllables[prevWord.syllables.length - 1].isClosed) {\n return true;\n }\n\n // this could be a code smell, b/c the copySyllable function results are not the most predictable\n const prevSyllable = cluster.syllable?.prev;\n if (!prevSyllable) {\n return false;\n }\n\n const prevCoda = prevSyllable.value?.codaWithGemination;\n if (!prevCoda) {\n return false;\n }\n\n return prevCoda === cluster.syllable?.onset;\n};\n\nconst joinSyllableChars = (syl: Syllable, sylChars: string[], schema: Schema): string => {\n const isInConstruct = syl.word?.isInConstruct;\n\n if (isInConstruct) {\n return sylChars.map(mapChars(schema)).join(\"\");\n }\n\n if (!syl.isAccented) {\n return sylChars.map(mapChars(schema)).join(\"\");\n }\n\n // if syllable is only punctuation (e.g. a paseq), it should not receive a stress marker\n const isOnlyPunctuation = syl.clusters.map((c) => c.isPunctuation).every((c) => c);\n if (isOnlyPunctuation) {\n return sylChars.map(mapChars(schema)).join(\"\");\n }\n\n if (schema.STRESS_MARKER) {\n const exclude = schema.STRESS_MARKER?.exclude ?? \"never\";\n\n if (exclude === \"single\" && !syl.prev && !syl.next) {\n return sylChars.map(mapChars(schema)).join(\"\");\n }\n\n if (exclude === \"final\" && !syl.next) {\n return sylChars.map(mapChars(schema)).join(\"\");\n }\n\n const location = schema.STRESS_MARKER.location;\n const mark = schema.STRESS_MARKER.mark;\n\n // if the stress marker is already present, no need to add it again\n if (syl.text.includes(mark)) {\n return sylChars.map(mapChars(schema)).join(\"\");\n }\n\n if (location === \"before-syllable\") {\n const isDoubled = syl.clusters.map((c) => isDageshChazaq(c, schema)).includes(true);\n if (isDoubled) {\n const chars = sylChars.map(mapChars(schema)).join(\"\");\n const [first, ...rest] = chars;\n return `${first}${mark}${rest.join(\"\")}`;\n }\n\n return `${mark}${sylChars.map(mapChars(schema)).join(\"\")}`;\n }\n\n if (location === \"after-syllable\") {\n return `${sylChars.map(mapChars(schema)).join(\"\")}${mark}`;\n }\n\n const vowels = [\n schema.PATAH,\n schema.HATAF_PATAH,\n schema.QAMATS,\n schema.HATAF_QAMATS,\n schema.SEGOL,\n schema.HATAF_SEGOL,\n schema.TSERE,\n schema.HIRIQ,\n schema.HOLAM,\n schema.QAMATS_QATAN,\n schema.QUBUTS,\n schema.QAMATS_HE,\n schema.SEGOL_HE,\n schema.TSERE_HE,\n schema.HIRIQ_YOD,\n schema.TSERE_YOD,\n schema.SEGOL_YOD,\n schema.HOLAM_VAV,\n schema.SHUREQ\n ]\n .filter((v) => typeof v === \"string\")\n .sort((a, b) => b.length - a.length);\n const vowelRgx = new RegExp(`${vowels.join(\"|\")}`);\n const str = sylChars.map(mapChars(schema)).join(\"\");\n const match = str.match(vowelRgx);\n\n if (location === \"before-vowel\") {\n return match?.length ? str.replace(match[0], `${mark}${match[0]}`) : str;\n }\n\n // after-vowel\n return match?.length ? str.replace(match[0], `${match[0]}${mark}`) : str;\n }\n\n return sylChars.map(mapChars(schema)).join(\"\");\n};\n\n/**\n * Maps Hebrew characters to schema\n *\n * @param input - text to be transliterated\n * @param schema - a {@link Schema} for transliterating the input\n * @returns transliteration of characters\n *\n */\nconst mapChars = (schema: Schema) => (input: string) => {\n return [...input].map((char: string) => (char in map ? schema[map[char]] : char)).join(\"\");\n};\n\nconst materFeatures = (syl: Syllable, schema: Schema) => {\n const mater = syl.clusters.filter((c) => c.isMater)[0];\n const prev = mater.prev instanceof Cluster ? mater.prev : null;\n const materText = mater.text;\n const prevText = (prev?.text || \"\").replace(taamim, \"\");\n // string comprised of all non-mater clusters in a syl with a mater\n let noMaterText = syl.clusters\n .filter((c) => !c.isMater)\n .map((c) => cluterRules(c, schema))\n .join(\"\");\n\n // workaround for maqaf\n const hasMaqaf = mater.text.includes(\"\u05BE\");\n noMaterText = hasMaqaf ? noMaterText.concat(\"\u05BE\") : noMaterText;\n\n if (/\u05D9/.test(materText)) {\n // hiriq\n if (/\\u{05B4}/u.test(prevText)) {\n return replaceWithRegex(noMaterText, /\\u{05B4}/u, schema.HIRIQ_YOD);\n }\n // tsere\n if (/\\u{05B5}/u.test(prevText)) {\n return replaceWithRegex(noMaterText, /\\u{05B5}/u, schema.TSERE_YOD);\n }\n // segol\n if (/\\u{05B6}/u.test(prevText)) {\n return replaceWithRegex(noMaterText, /\\u{05B6}/u, schema.SEGOL_YOD);\n }\n }\n\n if (/\u05D5/u.test(materText)) {\n // holam\n if (/\\u{05B9}/u.test(prevText)) {\n return replaceWithRegex(noMaterText, /\\u{05B9}/u, schema.HOLAM_VAV);\n }\n }\n\n if (/\u05D4/.test(materText)) {\n // qamets\n if (/\\u{05B8}/u.test(prevText)) {\n return replaceWithRegex(noMaterText, /\\u{05B8}/u, schema.QAMATS_HE);\n }\n }\n\n return materText;\n};\n\nconst removeTaamim = (input: string) => input.replace(taamim, \"\");\n\n/**\n * Replaces part of a string and transliterates the remaining characters according to the schema\n *\n * @example\n * ```ts\n * // replaces \u05D1\u05B8 as VA, but only when matching the regex sequence\n * const betAndQamats = /\\u{05D1}\\u{05B8}/u\n * replaceAndTransliterate(\"\u05D3\u05BC\u05B8\u05D1\u05B8\u05E8\", betAndQamats, \"VA\", schema);\n * // d\u0101VAr\n * ```\n *\n * @param input the text to be transliterated\n * @param regex the regex used as the search value\n * @param replaceValue the string to replace the regex\n * @param schema the Schema\n */\nconst replaceAndTransliterate = (input: string, regex: RegExp, replaceValue: string, schema: Schema) => {\n const sylSeq = replaceWithRegex(input, regex, replaceValue);\n return [...sylSeq].map(mapChars(schema)).join(\"\");\n};\n\n/**\n * Wrapper around `String.replace()` to constrain to a RegExp\n *\n * @param input the string to be modified\n * @param regex the regex to be used as the search value\n * @param replaceValue the string to replace the regex\n */\nconst replaceWithRegex = (input: string, regex: RegExp, replaceValue: string) => input.replace(regex, replaceValue);\n\n// MAIN RULES\n\nconst cluterRules = (cluster: Cluster, schema: Schema) => {\n let clusterText = removeTaamim(cluster.text);\n const clusterFeatures = schema.ADDITIONAL_FEATURES?.filter((seq) => seq.FEATURE === \"cluster\");\n if (clusterFeatures) {\n for (const feature of clusterFeatures) {\n const heb = new RegExp(feature.HEBREW, \"u\");\n if (feature.FEATURE === \"cluster\" && heb.test(clusterText)) {\n const transliteration = feature.TRANSLITERATION;\n const passThrough = feature.PASS_THROUGH ?? true;\n\n if (typeof transliteration === \"string\") {\n return replaceAndTransliterate(clusterText, heb, transliteration, schema);\n }\n\n if (!passThrough) {\n return transliteration(cluster, feature.HEBREW, schema);\n }\n\n clusterText = transliteration(cluster, feature.HEBREW, schema);\n }\n }\n }\n\n const syl = cluster.syllable;\n clusterText = cluster.hasSheva && syl?.isClosed ? clusterText.replace(/\\u{05B0}/u, \"\") : clusterText;\n\n // mappiq he\n if (/\u05D4\\u{05BC}$/mu.test(clusterText)) {\n return replaceWithRegex(clusterText, /\u05D4\\u{05BC}/u, schema.HE);\n }\n\n if (syl?.isFinal && !syl?.isClosed) {\n const furtiveChet = /\\u{05D7}\\u{05B7}$/mu;\n if (furtiveChet.test(clusterText)) {\n return replaceWithRegex(clusterText, furtiveChet, \"\\u{05B7}\\u{05D7}\");\n }\n\n const furtiveAyin = /\\u{05E2}\\u{05B7}$/mu;\n if (furtiveAyin.test(clusterText)) {\n return replaceWithRegex(clusterText, furtiveAyin, \"\\u{05B7}\\u{05E2}\");\n }\n\n const furtiveHe = /\\u{05D4}\\u{05BC}\\u{05B7}$/mu;\n if (furtiveHe.test(clusterText)) {\n return replaceWithRegex(clusterText, furtiveHe, \"\\u{05B7}\\u{05D4}\\u{05BC}\");\n }\n }\n\n // dagesh chazaq\n const isDageshChazq = isDageshChazaq(cluster, schema);\n\n if (schema.BET_DAGESH && /\u05D1\\u{05BC}/u.test(clusterText)) {\n return replaceWithRegex(\n clusterText,\n /\u05D1\\u{05BC}/u,\n getDageshChazaqVal(schema.BET_DAGESH, schema.DAGESH_CHAZAQ, isDageshChazq)\n );\n }\n\n if (schema.GIMEL_DAGESH && /\u05D2\\u{05BC}/u.test(clusterText)) {\n return replaceWithRegex(\n clusterText,\n /\u05D2\\u{05BC}/u,\n getDageshChazaqVal(schema.GIMEL_DAGESH, schema.DAGESH_CHAZAQ, isDageshChazq)\n );\n }\n\n if (schema.DALET_DAGESH && /\u05D3\\u{05BC}/u.test(clusterText)) {\n return replaceWithRegex(\n clusterText,\n /\u05D3\\u{05BC}/u,\n getDageshChazaqVal(schema.DALET_DAGESH, schema.DAGESH_CHAZAQ, isDageshChazq)\n );\n }\n\n if (schema.KAF_DAGESH && /\u05DB\\u{05BC}/u.test(clusterText)) {\n return replaceWithRegex(\n clusterText,\n /\u05DB\\u{05BC}/u,\n getDageshChazaqVal(schema.KAF_DAGESH, schema.DAGESH_CHAZAQ, isDageshChazq)\n );\n }\n\n if (schema.KAF_DAGESH && /\u05DA\\u{05BC}/u.test(clusterText)) {\n return replaceWithRegex(\n clusterText,\n /\u05DA\\u{05BC}/u,\n getDageshChazaqVal(schema.KAF_DAGESH, schema.DAGESH_CHAZAQ, isDageshChazq)\n );\n }\n\n if (schema.PE_DAGESH && /\u05E4\\u{05BC}/u.test(clusterText)) {\n return replaceWithRegex(\n clusterText,\n /\u05E4\\u{05BC}/u,\n getDageshChazaqVal(schema.PE_DAGESH, schema.DAGESH_CHAZAQ, isDageshChazq)\n );\n }\n\n if (schema.TAV_DAGESH && /\u05EA\\u{05BC}/u.test(clusterText)) {\n return replaceWithRegex(\n clusterText,\n /\u05EA\\u{05BC}/u,\n getDageshChazaqVal(schema.TAV_DAGESH, schema.DAGESH_CHAZAQ, isDageshChazq)\n );\n }\n\n if (/\u05E9\\u{05C1}/u.test(clusterText)) {\n return replaceWithRegex(\n clusterText,\n /\u05E9\\u{05C1}/u,\n getDageshChazaqVal(schema.SHIN, schema.DAGESH_CHAZAQ, isDageshChazq)\n );\n }\n\n if (/\u05E9\\u{05C2}/u.test(clusterText)) {\n return replaceWithRegex(\n clusterText,\n /\u05E9\\u{05C2}/u,\n getDageshChazaqVal(schema.SIN, schema.DAGESH_CHAZAQ, isDageshChazq)\n );\n }\n\n if (isDageshChazq) {\n const consonant = cluster.chars[0].text;\n const consonantDagesh = new RegExp(consonant + \"\\u{05BC}\", \"u\");\n return replaceWithRegex(\n clusterText,\n consonantDagesh,\n getDageshChazaqVal(consonant, schema.DAGESH_CHAZAQ, isDageshChazq)\n );\n }\n\n if (cluster.isShureq) {\n return clusterText.replace(\"\u05D5\u05BC\", schema.SHUREQ);\n }\n\n return clusterText;\n};\n\nexport const sylRules = (syl: Syllable, schema: Schema): string => {\n const sylTxt = syl.text.replace(taamim, \"\");\n\n const syllableFeatures = schema.ADDITIONAL_FEATURES?.filter((seq) => seq.FEATURE === \"syllable\");\n if (syllableFeatures) {\n for (const feature of syllableFeatures) {\n const heb = new RegExp(feature.HEBREW, \"u\");\n if (feature.FEATURE === \"syllable\" && heb.test(sylTxt)) {\n const transliteration = feature.TRANSLITERATION;\n const passThrough = feature.PASS_THROUGH ?? true;\n\n if (typeof transliteration === \"string\") {\n return replaceAndTransliterate(sylTxt, heb, transliteration, schema);\n }\n\n if (!passThrough) {\n return transliteration(syl, feature.HEBREW, schema);\n }\n\n const newText = transliteration(syl, feature.HEBREW, schema);\n\n // if the transliteration just returns the syllable.text, then no need to copy the syllable\n if (newText !== sylTxt) {\n syl = copySyllable(newText, syl);\n }\n }\n }\n }\n\n // syllable is 3ms sufx\n const mSSuffix = /\\u{05B8}\\u{05D9}\\u{05D5}/u;\n if (syl.isFinal && mSSuffix.test(sylTxt)) {\n const sufxSyl = replaceWithRegex(sylTxt, mSSuffix, schema.MS_SUFX);\n return joinSyllableChars(syl, [...sufxSyl], schema);\n }\n\n // syllable has a mater\n const hasMater = syl.clusters.map((c) => c.isMater).includes(true);\n if (hasMater) {\n const materSyl = materFeatures(syl, schema);\n return joinSyllableChars(syl, [...materSyl], schema);\n }\n\n if (schema.SEGOL_HE && /\\u{05B6}\\u{05D4}/u.test(sylTxt)) {\n const returnTxt = syl.clusters.map((cluster) => cluterRules(cluster, schema));\n const joined = joinSyllableChars(syl, returnTxt, schema).replace(taamim, \"\");\n return joined.replace(schema[\"SEGOL\"] + schema[\"HE\"], schema.SEGOL_HE);\n }\n\n // tsere\n if (schema.TSERE_HE && /\\u{05B5}\\u{05D4}/u.test(sylTxt)) {\n const returnTxt = syl.clusters.map((cluster) => cluterRules(cluster, schema));\n const joined = joinSyllableChars(syl, returnTxt, schema).replace(taamim, \"\");\n return joined.replace(schema[\"TSERE\"] + schema[\"HE\"], schema.TSERE_HE);\n }\n\n // regular syllables\n const returnTxt = syl.clusters.map((cluster) => cluterRules(cluster, schema));\n\n // there may be taamim still in the text, so remove them\n return joinSyllableChars(syl, returnTxt, schema).replace(taamim, \"\");\n};\n\nexport const wordRules = (word: Word, schema: Schema): string | Word => {\n if (word.isDivineName) {\n return getDivineName(word.text, schema);\n }\n\n if (word.hasDivineName) {\n return `${sylRules(word.syllables[0], schema)}-${getDivineName(word.text, schema)}`;\n }\n\n if (word.isNotHebrew) {\n return word.text;\n }\n\n const wordFeatures = schema.ADDITIONAL_FEATURES?.filter((seq) => seq.FEATURE === \"word\");\n if (wordFeatures) {\n const text = word.text.replace(taamim, \"\");\n for (const feature of wordFeatures) {\n const heb = new RegExp(feature.HEBREW, \"u\");\n if (heb.test(text)) {\n const transliteration = feature.TRANSLITERATION;\n const passThrough = feature.PASS_THROUGH ?? true;\n\n if (typeof transliteration === \"string\") {\n return replaceAndTransliterate(text, heb, transliteration, schema);\n }\n\n if (!passThrough) {\n return transliteration(word, feature.HEBREW, schema);\n }\n\n return new Word(transliteration(word, feature.HEBREW, schema), schema);\n }\n }\n return word;\n }\n\n return word;\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;;;;;;qBAAwB;AACxB,sBAAyB;AACzB,gCAA4C;AAC5C,kBAAqB;AACrB,2BAAwC;AAGxC,MAAM,SAAS;
|
|
6
|
-
"names": ["_a", "_b", "_c", "_d", "map", "
|
|
4
|
+
"sourcesContent": ["import { Cluster } from \"havarotjs/cluster\";\nimport { Syllable } from \"havarotjs/syllable\";\nimport { clusterSplitGroup, hebChars } from \"havarotjs/utils/regularExpressions\";\nimport { Word } from \"havarotjs/word\";\nimport { transliterateMap as map } from \"./hebCharsTrans\";\nimport { Schema } from \"./schema\";\n\nconst taamim = /[\\u{0591}-\\u{05AF}\\u{05BD}\\u{05BF}]/gu;\n\n/**\n * Adds a stress marker to a syllable according to the schema settings\n *\n * @param text the transliterated text\n * @param syl the current syllable\n * @param schema the schema\n */\nconst addStressMarker = (text: string, syl: Syllable, schema: Schema) => {\n if (!schema.STRESS_MARKER || !text) {\n return text;\n }\n\n if (!syl.isAccented) {\n return text;\n }\n\n const exclude = schema.STRESS_MARKER?.exclude ?? \"never\";\n\n if (exclude === \"single\" && !syl.prev && !syl.next) {\n return text;\n }\n\n if (exclude === \"final\" && !syl.next) {\n return text;\n }\n\n const location = schema.STRESS_MARKER.location;\n const mark = schema.STRESS_MARKER.mark;\n\n // if the stress marker is already present, no need to add it again\n if (text.includes(mark)) {\n return text;\n }\n\n if (location === \"before-syllable\") {\n const isDoubled = syl.clusters.map((c) => isDageshChazaq(c, schema)).includes(true);\n if (isDoubled) {\n const [first, ...rest] = text.split(\"\");\n return `${first}${mark}${rest.join(\"\")}`;\n }\n\n return `${mark}${text}`;\n }\n\n if (location === \"after-syllable\") {\n return `${text}${mark}`;\n }\n\n const vowels = [\n schema.PATAH,\n schema.HATAF_PATAH,\n schema.QAMATS,\n schema.HATAF_QAMATS,\n schema.SEGOL,\n schema.HATAF_SEGOL,\n schema.TSERE,\n schema.HIRIQ,\n schema.HOLAM,\n schema.QAMATS_QATAN,\n schema.QUBUTS,\n schema.QAMATS_HE,\n schema.SEGOL_HE,\n schema.TSERE_HE,\n schema.HIRIQ_YOD,\n schema.TSERE_YOD,\n schema.SEGOL_YOD,\n schema.HOLAM_VAV,\n schema.SHUREQ\n ]\n .filter((v) => typeof v === \"string\")\n .sort((a, b) => b.length - a.length);\n const vowelRgx = new RegExp(`${vowels.join(\"|\")}`);\n const match = text.match(vowelRgx);\n\n if (location === \"before-vowel\") {\n return match?.length ? text.replace(match[0], `${mark}${match[0]}`) : text;\n }\n\n // after-vowel\n return match?.length ? text.replace(match[0], `${match[0]}${mark}`) : text;\n};\n\nconst copySyllable = (newText: string, old: Syllable) => {\n const newClusters = newText.split(clusterSplitGroup).map((clusterString) => new Cluster(clusterString, true));\n const oldClusters = old.clusters;\n\n // set prev and next based on old syllable\n if (newClusters.length === oldClusters.length) {\n newClusters.forEach((c, i) => ((c.prev = oldClusters[i]?.prev ?? null), (c.next = oldClusters[i]?.next ?? null)));\n } else {\n for (let i = 0; i < newClusters.length; i++) {\n const c = newClusters[i];\n if (oldClusters[i]?.text[0] === c?.text[0]) {\n c.prev = oldClusters[i]?.prev ?? null;\n c.next = oldClusters[i]?.next ?? null;\n } else {\n c.prev = oldClusters[i]?.prev ?? null;\n c.next = oldClusters[i + 1]?.next ?? null;\n i++;\n }\n }\n }\n\n const newSyl = new Syllable(newClusters, {\n isClosed: old.isClosed,\n isAccented: old.isAccented,\n isFinal: old.isFinal\n });\n\n newClusters.forEach((c) => (c.syllable = newSyl));\n\n newSyl.prev = old.prev;\n newSyl.next = old.next;\n newSyl.word = old.word;\n\n return newSyl;\n};\n\nconst getDageshChazaqVal = (input: string, schema: Schema, isChazaq: boolean) => {\n if (!isChazaq) {\n return input;\n }\n\n const dagesh = schema[\"DAGESH_CHAZAQ\"];\n const syllableSeparator = schema[\"SYLLABLE_SEPARATOR\"] ?? \"\";\n\n if (typeof dagesh === \"boolean\") {\n return input + syllableSeparator + input;\n }\n\n return input + dagesh;\n};\n\n/**\n * Formats the Divine Name with any Latin chars\n *\n * @param str word text\n * @param schema\n * @returns the Divine Name with any pre or proceding Latin chars\n */\nconst getDivineName = (str: string, schema: Schema): string => {\n const begn = str[0];\n const end = str[str.length - 1];\n // if DN is pointed with a hiriq, then it is read as 'elohim\n const divineName =\n schema.DIVINE_NAME_ELOHIM && /\\u{05B4}/u.test(str) ? schema.DIVINE_NAME_ELOHIM : schema.DIVINE_NAME;\n return `${hebChars.test(begn) ? \"\" : begn}${divineName}${hebChars.test(end) ? \"\" : end}`;\n};\n\nconst isDageshChazaq = (cluster: Cluster, schema: Schema) => {\n // if there is no dagesh chazaq in the schema, then return false\n if (!schema.DAGESH_CHAZAQ) {\n return false;\n }\n\n // a shureq could potentially match because of dagesh\n if (cluster.isShureq) {\n return false;\n }\n\n // if there is no dagesh in the text, then return false\n if (!/\\u{05BC}/u.test(cluster.text)) {\n return false;\n }\n\n // if the previous cluster has a sheva, then it is not a dagesh chazaq\n // likely being a Qal 2fs suffix (e.g. \u05E7\u05B8\u05D8\u05B7\u05DC\u05B0\u05EA\u05BC\u05B0)\n const prevCluster = cluster.prev?.value;\n if (prevCluster && prevCluster.hasSheva) {\n return false;\n }\n\n const prevWord = cluster.syllable?.word?.prev?.value;\n if (prevWord && prevWord?.isInConstruct && !prevWord.syllables[prevWord.syllables.length - 1].isClosed) {\n return true;\n }\n\n // this could be a code smell, b/c the copySyllable function results are not the most predictable\n const prevSyllable = cluster.syllable?.prev;\n if (!prevSyllable) {\n return false;\n }\n\n const prevCoda = prevSyllable.value?.codaWithGemination;\n if (!prevCoda) {\n return false;\n }\n\n return prevCoda === cluster.syllable?.onset;\n};\n\nconst joinSyllableChars = (syl: Syllable, sylChars: string[], schema: Schema): string => {\n const isInConstruct = syl.word?.isInConstruct;\n\n if (isInConstruct) {\n return sylChars.map(mapChars(schema)).join(\"\");\n }\n\n if (!syl.isAccented) {\n return sylChars.map(mapChars(schema)).join(\"\");\n }\n\n // if syllable is only punctuation (e.g. a paseq), it should not receive a stress marker\n const isOnlyPunctuation = syl.clusters.map((c) => c.isPunctuation).every((c) => c);\n if (isOnlyPunctuation) {\n return sylChars.map(mapChars(schema)).join(\"\");\n }\n\n return sylChars.map(mapChars(schema)).join(\"\");\n};\n\n/**\n * Maps Hebrew characters to schema\n *\n * @param input - text to be transliterated\n * @param schema - a {@link Schema} for transliterating the input\n * @returns transliteration of characters\n *\n */\nconst mapChars = (schema: Schema) => (input: string) => {\n return [...input].map((char: string) => (char in map ? schema[map[char]] : char)).join(\"\");\n};\n\nconst materFeatures = (syl: Syllable, schema: Schema) => {\n const mater = syl.clusters.filter((c) => c.isMater)[0];\n const prev = mater.prev instanceof Cluster ? mater.prev : null;\n const materText = mater.text;\n const prevText = (prev?.text || \"\").replace(taamim, \"\");\n // string comprised of all non-mater clusters in a syl with a mater\n let noMaterText = syl.clusters\n .filter((c) => !c.isMater)\n .map((c) => cluterRules(c, schema))\n .join(\"\");\n\n // workaround for maqaf\n const hasMaqaf = mater.text.includes(\"\u05BE\");\n noMaterText = hasMaqaf ? noMaterText.concat(\"\u05BE\") : noMaterText;\n\n if (/\u05D9/.test(materText)) {\n // hiriq\n if (/\\u{05B4}/u.test(prevText)) {\n return replaceWithRegex(noMaterText, /\\u{05B4}/u, schema.HIRIQ_YOD);\n }\n // tsere\n if (/\\u{05B5}/u.test(prevText)) {\n return replaceWithRegex(noMaterText, /\\u{05B5}/u, schema.TSERE_YOD);\n }\n // segol\n if (/\\u{05B6}/u.test(prevText)) {\n return replaceWithRegex(noMaterText, /\\u{05B6}/u, schema.SEGOL_YOD);\n }\n }\n\n if (/\u05D5/u.test(materText)) {\n // holam\n if (/\\u{05B9}/u.test(prevText)) {\n return replaceWithRegex(noMaterText, /\\u{05B9}/u, schema.HOLAM_VAV);\n }\n }\n\n if (/\u05D4/.test(materText)) {\n // qamets\n if (/\\u{05B8}/u.test(prevText)) {\n return replaceWithRegex(noMaterText, /\\u{05B8}/u, schema.QAMATS_HE);\n }\n }\n\n return materText;\n};\n\nconst removeTaamim = (input: string) => input.replace(taamim, \"\");\n\n/**\n * Replaces part of a string and transliterates the remaining characters according to the schema\n *\n * @example\n * ```ts\n * // replaces \u05D1\u05B8 as VA, but only when matching the regex sequence\n * const betAndQamats = /\\u{05D1}\\u{05B8}/u\n * replaceAndTransliterate(\"\u05D3\u05BC\u05B8\u05D1\u05B8\u05E8\", betAndQamats, \"VA\", schema);\n * // d\u0101VAr\n * ```\n *\n * @param input the text to be transliterated\n * @param regex the regex used as the search value\n * @param replaceValue the string to replace the regex\n * @param schema the Schema\n */\nconst replaceAndTransliterate = (input: string, regex: RegExp, replaceValue: string, schema: Schema) => {\n const sylSeq = replaceWithRegex(input, regex, replaceValue);\n return [...sylSeq].map(mapChars(schema)).join(\"\");\n};\n\n/**\n * Wrapper around `String.replace()` to constrain to a RegExp\n *\n * @param input the string to be modified\n * @param regex the regex to be used as the search value\n * @param replaceValue the string to replace the regex\n */\nconst replaceWithRegex = (input: string, regex: RegExp, replaceValue: string) => input.replace(regex, replaceValue);\n\n// MAIN RULES\n\nconst cluterRules = (cluster: Cluster, schema: Schema) => {\n let clusterText = removeTaamim(cluster.text);\n const clusterFeatures = schema.ADDITIONAL_FEATURES?.filter((seq) => seq.FEATURE === \"cluster\");\n if (clusterFeatures) {\n for (const feature of clusterFeatures) {\n const heb = new RegExp(feature.HEBREW, \"u\");\n if (feature.FEATURE === \"cluster\" && heb.test(clusterText)) {\n const transliteration = feature.TRANSLITERATION;\n const passThrough = feature.PASS_THROUGH ?? true;\n\n if (typeof transliteration === \"string\") {\n return replaceAndTransliterate(clusterText, heb, transliteration, schema);\n }\n\n if (!passThrough) {\n return transliteration(cluster, feature.HEBREW, schema);\n }\n\n clusterText = transliteration(cluster, feature.HEBREW, schema);\n }\n }\n }\n\n const syl = cluster.syllable;\n clusterText = cluster.hasSheva && syl?.isClosed ? clusterText.replace(/\\u{05B0}/u, \"\") : clusterText;\n\n // mappiq he\n if (/\u05D4\\u{05BC}$/mu.test(clusterText)) {\n return replaceWithRegex(clusterText, /\u05D4\\u{05BC}/u, schema.HE);\n }\n\n if (syl?.isFinal && !syl?.isClosed) {\n const furtiveChet = /\\u{05D7}\\u{05B7}$/mu;\n if (furtiveChet.test(clusterText)) {\n return replaceWithRegex(clusterText, furtiveChet, \"\\u{05B7}\\u{05D7}\");\n }\n\n const furtiveAyin = /\\u{05E2}\\u{05B7}$/mu;\n if (furtiveAyin.test(clusterText)) {\n return replaceWithRegex(clusterText, furtiveAyin, \"\\u{05B7}\\u{05E2}\");\n }\n\n const furtiveHe = /\\u{05D4}\\u{05BC}\\u{05B7}$/mu;\n if (furtiveHe.test(clusterText)) {\n return replaceWithRegex(clusterText, furtiveHe, \"\\u{05B7}\\u{05D4}\\u{05BC}\");\n }\n }\n\n // dagesh chazaq\n const isDageshChazq = isDageshChazaq(cluster, schema);\n\n if (schema.BET_DAGESH && /\u05D1\\u{05BC}/u.test(clusterText)) {\n return replaceWithRegex(clusterText, /\u05D1\\u{05BC}/u, getDageshChazaqVal(schema.BET_DAGESH, schema, isDageshChazq));\n }\n\n if (schema.GIMEL_DAGESH && /\u05D2\\u{05BC}/u.test(clusterText)) {\n return replaceWithRegex(clusterText, /\u05D2\\u{05BC}/u, getDageshChazaqVal(schema.GIMEL_DAGESH, schema, isDageshChazq));\n }\n\n if (schema.DALET_DAGESH && /\u05D3\\u{05BC}/u.test(clusterText)) {\n return replaceWithRegex(clusterText, /\u05D3\\u{05BC}/u, getDageshChazaqVal(schema.DALET_DAGESH, schema, isDageshChazq));\n }\n\n if (schema.KAF_DAGESH && /\u05DB\\u{05BC}/u.test(clusterText)) {\n return replaceWithRegex(clusterText, /\u05DB\\u{05BC}/u, getDageshChazaqVal(schema.KAF_DAGESH, schema, isDageshChazq));\n }\n\n if (schema.KAF_DAGESH && /\u05DA\\u{05BC}/u.test(clusterText)) {\n return replaceWithRegex(clusterText, /\u05DA\\u{05BC}/u, getDageshChazaqVal(schema.KAF_DAGESH, schema, isDageshChazq));\n }\n\n if (schema.PE_DAGESH && /\u05E4\\u{05BC}/u.test(clusterText)) {\n return replaceWithRegex(clusterText, /\u05E4\\u{05BC}/u, getDageshChazaqVal(schema.PE_DAGESH, schema, isDageshChazq));\n }\n\n if (schema.TAV_DAGESH && /\u05EA\\u{05BC}/u.test(clusterText)) {\n return replaceWithRegex(clusterText, /\u05EA\\u{05BC}/u, getDageshChazaqVal(schema.TAV_DAGESH, schema, isDageshChazq));\n }\n\n if (/\u05E9\\u{05C1}/u.test(clusterText)) {\n return replaceWithRegex(clusterText, /\u05E9\\u{05C1}/u, getDageshChazaqVal(schema.SHIN, schema, isDageshChazq));\n }\n\n if (/\u05E9\\u{05C2}/u.test(clusterText)) {\n return replaceWithRegex(clusterText, /\u05E9\\u{05C2}/u, getDageshChazaqVal(schema.SIN, schema, isDageshChazq));\n }\n\n if (isDageshChazq) {\n const consonant = cluster.chars[0].text;\n const consonantDagesh = new RegExp(consonant + \"\\u{05BC}\", \"u\");\n return replaceWithRegex(clusterText, consonantDagesh, getDageshChazaqVal(consonant, schema, isDageshChazq));\n }\n\n if (cluster.isShureq) {\n return clusterText.replace(\"\u05D5\u05BC\", schema.SHUREQ);\n }\n\n return clusterText;\n};\n\nexport const sylRules = (syl: Syllable, schema: Schema): string => {\n /** The syllable's original text with taamim removed */\n const baseSyllableText = syl.text.replace(taamim, \"\");\n\n const syllableFeatures = schema.ADDITIONAL_FEATURES?.filter((seq) => seq.FEATURE === \"syllable\");\n if (syllableFeatures) {\n for (const feature of syllableFeatures) {\n const heb = new RegExp(feature.HEBREW, \"u\");\n if (feature.FEATURE === \"syllable\" && heb.test(baseSyllableText)) {\n const transliteration = feature.TRANSLITERATION;\n const passThrough = feature.PASS_THROUGH ?? true;\n\n if (typeof transliteration === \"string\") {\n return replaceAndTransliterate(baseSyllableText, heb, transliteration, schema);\n }\n\n if (!passThrough) {\n return transliteration(syl, feature.HEBREW, schema);\n }\n\n const newText = transliteration(syl, feature.HEBREW, schema);\n\n // if the transliteration just returns the syllable.text, then no need to copy the syllable\n if (newText !== baseSyllableText) {\n syl = copySyllable(newText, syl);\n }\n }\n }\n }\n\n const hasMater = syl.clusters.map((c) => c.isMater).includes(true);\n if (hasMater) {\n const materSyl = materFeatures(syl, schema);\n const text = joinSyllableChars(syl, [...materSyl], schema);\n return addStressMarker(text, syl, schema);\n }\n\n const clusters = syl.clusters.map((cluster) => cluterRules(cluster, schema));\n const joined = joinSyllableChars(syl, clusters, schema).replace(taamim, \"\");\n\n // syllable is 3ms sufx\n const mSSuffix = /\\u{05B8}\\u{05D9}\\u{05D5}/u;\n if (syl.isFinal && mSSuffix.test(baseSyllableText)) {\n const text = joined.replace(schema[\"QAMATS\"] + schema[\"YOD\"] + schema[\"VAV\"], schema.MS_SUFX);\n return addStressMarker(text, syl, schema);\n }\n\n if (schema.SEGOL_HE && /\\u{05B6}\\u{05D4}/u.test(baseSyllableText)) {\n const text = joined.replace(schema[\"SEGOL\"] + schema[\"HE\"], schema.SEGOL_HE);\n return addStressMarker(text, syl, schema);\n }\n\n if (schema.TSERE_HE && /\\u{05B5}\\u{05D4}/u.test(baseSyllableText)) {\n const text = joined.replace(schema[\"TSERE\"] + schema[\"HE\"], schema.TSERE_HE);\n return addStressMarker(text, syl, schema);\n }\n\n if (schema.PATAH_HE && /\\u{05B7}\\u{05D4}/u.test(baseSyllableText)) {\n const text = joined.replace(schema[\"PATAH\"] + schema[\"HE\"], schema.PATAH_HE);\n return addStressMarker(text, syl, schema);\n }\n\n const text = joined.replace(taamim, \"\");\n return addStressMarker(text, syl, schema);\n};\n\nexport const wordRules = (word: Word, schema: Schema): string | Word => {\n if (word.isDivineName) {\n return getDivineName(word.text, schema);\n }\n\n if (word.hasDivineName) {\n return `${sylRules(word.syllables[0], schema)}-${getDivineName(word.text, schema)}`;\n }\n\n if (word.isNotHebrew) {\n return word.text;\n }\n\n const wordFeatures = schema.ADDITIONAL_FEATURES?.filter((seq) => seq.FEATURE === \"word\");\n if (wordFeatures) {\n const text = word.text.replace(taamim, \"\");\n for (const feature of wordFeatures) {\n const heb = new RegExp(feature.HEBREW, \"u\");\n if (heb.test(text)) {\n const transliteration = feature.TRANSLITERATION;\n const passThrough = feature.PASS_THROUGH ?? true;\n\n if (typeof transliteration === \"string\") {\n return replaceAndTransliterate(text, heb, transliteration, schema);\n }\n\n if (!passThrough) {\n return transliteration(word, feature.HEBREW, schema);\n }\n\n return new Word(transliteration(word, feature.HEBREW, schema), schema);\n }\n }\n return word;\n }\n\n return word;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;;;;;;qBAAwB;AACxB,sBAAyB;AACzB,gCAA4C;AAC5C,kBAAqB;AACrB,2BAAwC;AAGxC,MAAM,SAAS;AASf,MAAM,kBAAkB,CAAC,MA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