UNPKG

hebrew-transliteration

Version:
1,618 lines 38.7 kB
/** * @categoryDescription Consonants * Hebrew characters being used as consonants * * @categoryDescription Vowels * Hebrew characters being used as vowels, including the vocal sheva and ligatures * * @categoryDescription Taamim * Hebrew characters that that are used as taamim (i.e. accents) * * @categoryDescription Marks * Hebrew characters that are not consonants, vowels, or taamim, serving some other purpose, such as the dagesh or the paseq * * @categoryDescription Orthographic Features * Multiple Hebrew characters that form a semantic group, like the 3MS Suffix or a consonant with a dagesh * * @categoryDescription Syllabification * Options from havarotjs for syllabifying words */ /** * Class for defining a schema for transliteration. * * @remarks * Examples are truncated for brevity. */ export class Schema { /** * HEBREW POINT SHEVA (U+05B0) ְ◌ * * @category Vowels * * @example * ```js * const schema = new Schema({ * // truncated for brevity * VOCAL_SHEVA: "ə", * }); * transliterate("סְלִ֣ק", schema); * // səliq * ``` */ VOCAL_SHEVA; /** * HEBREW POINT HATAF SEGOL (U+05B1) ֱ◌ * * @category Vowels * * @example * ```js * const schema = new Schema({ * // truncated for brevity * HATAF_SEGOL: "ĕ", * }); * transliterate("אֱלֹהִ֑ים", schema); * // ʾĕlōhîm * ``` */ HATAF_SEGOL; /** * HEBREW POINT HATAF PATAH (U+05B2) ֲ◌ * * @category Vowels * * @example * ```js * const schema = new Schema({ * // truncated for brevity * HATAF_PATAH: "ă", * }); * transliterate("נַֽעֲשֶׂ֥ה", schema); * // naʿăśê * ``` */ HATAF_PATAH; /** * HEBREW POINT HATAF QAMATS (U+05B3) ֳ◌ * * @category Vowels * * @example * ```js * const schema = new Schema({ * // truncated for brevity * HATAF_QAMATS: "ŏ", * }); * transliterate("אֳרָנִים", schema); * // ʾŏrānîm * ``` */ HATAF_QAMATS; /** * HEBREW POINT HIRIQ (U+05B4) ִ◌ * * @category Vowels * * @example * ```js * const schema = new Schema({ * // truncated for brevity * HIRIQ: "i", * }); * transliterate("הִנֵּה֩", schema); * // hinnê * ``` */ HIRIQ; /** * HEBREW POINT TSERE (U+05B5) ֵ◌ * * @category Vowels * * @example * ```js * const schema = new Schema({ * // truncated for brevity * TSERE: "ē", * }); * transliterate("אֵשׁ", schema); * // ʾēš * ``` */ TSERE; /** * HEBREW POINT SEGOL (U+05B6) ֶ◌ * * @category Vowels * * @example * ```js * const schema = new Schema({ * // truncated for brevity * SEGOL: "e", * }); * transliterate("אֶל", schema); * // ʾel * ``` */ SEGOL; /** * HEBREW POINT PATAH (U+05B7) ַ◌ * * @category Vowels * * @example * ```js * const schema = new Schema({ * // truncated for brevity * PATAH: "a", * }); * transliterate("נַ֗עַר", schema); * // naʿar * ``` */ PATAH; /** * HEBREW POINT QAMATS (U+05B8) ָ◌ * * @category Vowels * * @example * ```js * const schema = new Schema({ * // truncated for brevity * QAMATS: "ā", * }); * transliterate("דָבָר֙", schema); * // dābār * ``` */ QAMATS; /** * HEBREW POINT HOLAM (U+05B9) ֹ◌ * * @category Vowels * * @example * ```js * const schema = new Schema({ * // truncated for brevity * HOLAM: "ō", * }); * transliterate("לֹא", schema); * // lōʾ * ``` */ HOLAM; /** * HEBREW POINT HOLAM HASER FOR VAV (U+05BA) ֹ◌ * * @category Vowels * * @example * ```js * const schema = new Schema({ * // truncated for brevity * HOLAM_HASER: "ō", * }); * transliterate("עָוֺן֙", schema); * // ʿāwōn * ``` * * @remarks * See {@link holemHaser} for more about this character */ HOLAM_HASER; /** * HEBREW POINT QUBUTS (U+05BB) ֻ◌ * * @category Vowels * * @example * ```js * const schema = new Schema({ * // truncated for brevity * QUBUTS: "u", * }); * transliterate("קֻ֣ם", schema); * // qūm * ``` */ QUBUTS; /** * HEBREW POINT DAGESH OR MAPIQ (U+05BC) ּ◌ * * @category Marks * * @example * A blank string * ```js * const schema = new Schema({ * // truncated for brevity * DAGESH: "", * }); * transliterate("כֵּ֑ן", schema); * // kēn * ``` * * @example * A character * ```js * const schema = new Schema({ * // truncated for brevity * DAGESH: ".", * }); * transliterate("כֵּ֑ן", schema); * // k.ēn * ``` * * @remarks * Typically, this should be a blank string. */ DAGESH; /** * HEBREW POINT DAGESH OR MAPIQ (U+05BC) ּ◌ * * A string or boolean, and if set to `true`, the consonant with the dagesh is repeated. * * @category Marks * @category Orthographic Features * * @example * As a string * ```js * const schema = new Schema({ * // truncated for brevity * DAGESH_CHAZAQ: "\u0301", * }); * transliterate("שַׁבָּת", schema); * // šab́āt * ``` * * @example * As a boolean * ```js * const schema = new Schema({ * // truncated for brevity * DAGESH_CHAZAQ: true, * }); * transliterate("שַׁבָּת", schema); * // šabbāt * ``` */ DAGESH_CHAZAQ; /** * HEBREW PUNCTUATION MAQAF (U+05BE) ־◌ * * @category Marks * @category Taamim * * @example * ```js * const schema = new Schema({ * // truncated for brevity * { MAQAF: "-" } * }); * transliterate("אַל־", schema); * // ʾal- * ``` */ MAQAF; /** * HEBREW PUNCTUATION PASEQ (U+05C0) ׀ ◌ * * @category Marks * * @example * ```js * const schema = new Schema({ * // truncated for brevity * PASEQ: "", }) * transliterate("כְּשֶׁ֣בֶת ׀ הַמֶּ֣לֶךְ", schema); * // kəšebet hammelek * ``` * * @remarks * If a blank string, two spaces will occur between words; see example. */ PASEQ; /** * HEBREW PUNCTUATION SOF PASUQ (U+05C3) ׃◌ * * @category Marks * @category Taamim * * @example * ```js * const schema = new Schema({ * // truncated for brevity * SOF_PASUQ: ".", * }); * transliterate("הָאָֽרֶץ׃", schema); * // hāʾāreṣ. * ``` */ SOF_PASUQ; /** * HEBREW POINT QAMATS QATAN (U+05C7) ׇ◌ * * @category Vowels * * @example * ```js * const schema = new Schema({ * // truncated for brevity * QAMATS QATAN: "o", * }); * transliterate("כָּל־הָעָ֖ם", schema); * // kol-hāʿām * ``` * * @remarks * See {@link qametsQatan} for details about this character. */ QAMATS_QATAN; /** * HEBREW POINT PATAH (U+05B7) ◌ַ as a furtive patah * * @category Vowels * @category Orthographic Features * * @example * ```js * const schema = new Schema({ * // truncated for brevity * FURTIVE_PATAH: "a", * }); * transliterate("נֹ֖חַ", schema); * // nōaḥ * ``` */ FURTIVE_PATAH; /** * HEBREW POINT HIRIQ (U+05B4) and YOD (U+05D9) י◌ִ * * @category Vowels * @category Orthographic Features * * @example * ```js * const schema = new Schema({ * // truncated for brevity * HIRIQ_YOD: "î", * }); * transliterate("עִ֔יר", schema); * // ʿîr * ``` */ HIRIQ_YOD; /** * HEBREW POINT TSERE (U+05B5) and YOD (U+05D9) י◌ֵ * * @category Vowels * @category Orthographic Features * * @example * ```js * const schema = new Schema({ * // truncated for brevity * TSERE_YOD: "ê", * }); * transliterate("אֵ֤ין", schema); * // ʾên * ``` */ TSERE_YOD; /** * HEBREW POINT SEGOL (U+05B6) and YOD (U+05D9) י◌ֶ * * @category Vowels * @category Orthographic Features * * @example * ```js * const schema = new Schema({ * // truncated for brevity * SEGOL_YOD: "ê", * }); * transliterate("אֱלֹהֶ֑יךָ", schema); * // ʾĕlōhêkā * ``` */ SEGOL_YOD; /** * HEBREW LETTER VAV (U+05D5) and DAGESH (U+05BC) וּ * * @category Vowels * @category Orthographic Features * * @example * ```js * const schema = new Schema({ * // truncated for brevity * SHUREQ: "û", * }); * transliterate("קוּם", schema); * // qûm * ``` */ SHUREQ; /** * HEBREW LETTER HOLAM (U+05B9) and VAV (U+05D5) ֹו◌ * * @category Vowels * @category Orthographic Features * * @example * ```js * const schema = new Schema({ * // truncated for brevity * HOLAM_VAV: "ô", * }); * transliterate("ס֣וֹא", schema); * // sôʾ * ``` */ HOLAM_VAV; /** * HEBREW POINT QAMATS (U+05B8) and HE (U+05D4) ה◌ָ * * @category Vowels * @category Orthographic Features * * @example * ```js * const schema = new Schema({ * // truncated for brevity * QAMATS_HE: "â", * }); * transliterate("עֵצָ֖ה", schema); * // ʿēṣâ * ``` */ QAMATS_HE; /** * HEBREW POINT PATAH (U+05B7) and HE (U+05D4) ה◌ַ * * @category Vowels * @category Orthographic Features * * @example * ```js * const schema = new Schema({ * // truncated for brevity * PATAH_HE: "â", * }); * transliterate("מַה־", schema); * // mâ- * ``` */ PATAH_HE; /** * HEBREW POINT SEGOL (U+05B6) and HE (U+05D4) ה◌ֶ * * @category Vowels * @category Orthographic Features * * @example * ```js * const schema = new Schema({ * // truncated for brevity * SEGOL_HE: "ê", * }); * transliterate("יִקְרֶ֥ה", schema); * // yiqrê * ``` */ SEGOL_HE; /** * HEBREW POINT TSERE (U+05B5) and HE (U+05D4) ה◌ֵ * * @category Vowels * @category Orthographic Features * * @example * ```js * const schema = new Schema({ * // truncated for brevity * TSERE_HE: "ê", * }); * transliterate("הָאַרְיֵ֔ה", schema); * // hāʾaryê * ``` */ TSERE_HE; /** * HEBREW LETTER QAMATS (U+05B8) and YOD (U+05D9) and VAV (U+05D5) יו◌ָ * * @category Vowels * @category Orthographic Features * * @example * ```js * const schema = new Schema({ * // truncated for brevity * MS_SUFX: ”āyw”, * }); * transliterate("יָדָ֛יו", schema); * // yādāyw * ``` */ MS_SUFX; /** * HEBREW LETTER ALEF (U+05D0) א * * @category Consonants * * @example * ```js * const schema = new Schema({ * // truncated for brevity * ALEF: "ʾ", * }); * transliterate("אָב", schema); * // ʾāb * ``` */ ALEF; /** * HEBREW LETTER BET (U+05D1) ב * * @category Consonants * * @example * ```js * const schema = new Schema({ * // truncated for brevity * BET: "b", * }); * transliterate("בְּבֵית", schema); * // bəbêt * ``` */ BET; /** * HEBREW LETTER BET (U+05D1) and DAGESH (U+05BC) ּב * * @category Consonants * @category Orthographic Features * * @example * With only `BET` set * ```js * const schema = new Schema({ * // truncated for brevity * BET: "b", * }); * transliterate("בְּבֵית", schema); * // bəbêt *``` * * @example * With `BET` and `BET_DAGESH` set * ```js * const schema = new Schema({ * // truncated for brevity * BET: "v", * BET_DAGESH: "b", * }); * transliterate("בְּבֵית", schema); * // bəvêt * ``` * * @remarks * The letter bet with a dagesh kal. * Use when need to distinguish between spirantized forms */ BET_DAGESH; /** * HEBREW LETTER GIMEL (U+05D2) ג * * @category Consonants * * @example * ```js * const schema = new Schema({ * // truncated for brevity * GIMEL: "g", * }); * transliterate("גַּ֣גּ", schema); * // gag * ``` */ GIMEL; /** * HEBREW LETTER GIMEL (U+05D2) and DAGESH (U+05BC) גּ * * @category Consonants * @category Orthographic Features * * @example * With only `GIMEL` set * ```js * const schema = new Schema({ * // truncated for brevity * GIMEL: "g" * }); * transliterate("גַּ֣ג", schema); * // gag * ``` * * @example * With `GIMEL` and `GIMEL_DAGESH` set * ```js * const schema = new Schema({ * // truncated for brevity * GIMEL: "gh", * GIMEL_DAGESH: "g", * }); * transliterate("גַּ֣ג", schema); * // gagh * ``` * * @remarks * The letter gimel with a dagesh kal. * Use when need to distinguish between spirantized forms */ GIMEL_DAGESH; /** * HEBREW LETTER DALET (U+05D3) ד * * @category Consonants * * @example * ```js * const schema = new Schema({ * // truncated for brevity * DALET: "d", * }); * transliterate("דֹּ֣ד", schema); * // dōd * ``` */ DALET; /** * HEBREW LETTER DALET (U+05D3) and DAGESH (U+05BC) דּ * * @category Consonants * @category Orthographic Features * * @example * With only `DALET` set * ```js * const schema = new Schema({ * // truncated for brevity * DALET: "d", * }); * transliterate("דֹּ֣ד", schema); * // dōd * ``` * * @example * With `DALET` and `DALET_DAGESH` set * ```js * const schema = new Schema({ * // truncated for brevity * DALET: "dh", * DALET_DAGESH: "d", * }); * transliterate("דֹּ֣ד", schema); * // dōdh * ``` * * @remarks * The letter dalet with a dagesh kal. * Ue when need to distinguish between spirantized forms */ DALET_DAGESH; /** * HEBREW LETTER HE (U+05D4) ה * * @category Consonants * * @example * ```js * const schema = new Schema({ * // truncated for brevity * HE: "h", * }); * transliterate("הֵ֗ם", schema); * // hēm * ``` */ HE; /** * HEBREW LETTER VAV (U+05D5) ו * * @category Consonants * * @example * ```js * const schema = new Schema({ * // truncated for brevity * VAV: "w", * }); * transliterate("וָוִ֖ים", schema); * // wāwîm * ``` */ VAV; /** * HEBREW LETTER ZAYIN (U+05D6) ז * * @category Consonants * * @example * ```js * const schema = new Schema({ * // truncated for brevity * ZAYIN: "z", * }); * transliterate("זֵ֣ד", schema); * // zēd * ``` */ ZAYIN; /** * HEBREW LETTER HET (U+05D7) ח * * @category Consonants * * @example * ```js * const schema = new Schema({ * // truncated for brevity * HET: "ḥ" * }); * transliterate("חַ֣ג", schema); * // ḥag * ``` */ HET; /** * HEBREW LETTER TET (U+05D8) ט * * @category Consonants * * @example * ```js * const schema = new Schema({ * // truncated for brevity * TET: "ṭ", * }); * transliterate("טִֽיט", schema); * // ṭîṭ * ``` */ TET; /** * HEBREW LETTER YOD (U+05D9) י * * @category Consonants * * @example * ```js * const schema = new Schema({ * // truncated for brevity * YOD: "y", * }); * transliterate("יָ֗ד", schema); * // yād * ``` */ YOD; /** * HEBREW LETTER FINAL KAF (U+05DA) ך * * @category Consonants * * @example * ```js * const schema = new Schema({ * // truncated for brevity * FINAL KAF: "k", * }); * transliterate("לֶךְ", schema); * // lek * ``` */ FINAL_KAF; /** * HEBREW LETTER KAF (U+05DB) כ * * @category Consonants * * @example * ```js * const schema = new Schema({ * // truncated for brevity * KAF: "k", * }); * transliterate("כָּ֚כָה", schema); * // kākâ * ``` */ KAF; /** * HEBREW LETTER KAF (U+05DB) and DAGESH (U+05BC) כּ * * @category Consonants * @category Orthographic Features * * @example * With only `KAF` set * ```js * const schema = new Schema({ * // truncated for brevity * KAF: "k", * }); * transliterate("כָּ֚כָה", schema); * // kākâ * ``` * * @example * With `KAF` set and `KAF_DAGESH` set * ```js * const schema = new Schema({ * // truncated for brevity * KAF: "kh", * KAF_DAGESH: "k", * }); * transliterate("כָּ֚כָה", schema); * // kākhâ * ``` * * @remarks * The letter kaf with a dagesh kal. * Use when need to distinguish between spirantized forms */ KAF_DAGESH; /** * HEBREW LETTER LAMED (U+05DC) ל * * @category Consonants * * @example * ```js * const schema = new Schema({ * // truncated for brevity * LAMED: "l", * }); * transliterate("עַל", schema); * // ʿal * ``` */ LAMED; /** * HEBREW LETTER FINAL MEM (U+05DD) ם * * @category Consonants * * @example * ```js * const schema = new Schema({ * // truncated for brevity * FINAL MEM: "m", * }); * transliterate("מַ֖יִם", schema); * // mayim * ``` */ FINAL_MEM; /** * HEBREW LETTER MEM (U+05DE) מ * * @category Consonants * * @example * ```js * const schema = new Schema({ * // truncated for brevity * MEM: "m", * }); * transliterate("מַ֖יִם", schema); * // mayim * ``` */ MEM; /** * HEBREW LETTER FINAL NUN (U+05DF) ן * * @category Consonants * * @example * ```js * const schema = new Schema({ * // truncated for brevity * FINAL NUN: "n", * }); * transliterate("נ֔וּן", schema); * // nûn * ``` */ FINAL_NUN; /** * HEBREW LETTER NUN (U+05E0) נ * * @category Consonants * * @example * ```js * const schema = new Schema({ * // truncated for brevity * NUN: "n", * }); * transliterate("נ֔וּן", schema); * // nûn * ``` */ NUN; /** * HEBREW LETTER SAMEKH (U+05E1) ס * * @category Consonants * * @example * ```js * const schema = new Schema({ * // truncated for brevity * SAMEKH: "s", * }); * transliterate("ס֥וּס", schema); * // sûs * ``` */ SAMEKH; /** * HEBREW LETTER AYIN (U+05E2) ע * * @category Consonants * * @example * ```js * const schema = new Schema({ * // truncated for brevity * AYIN: "ʿ", * }); * transliterate("עָ֑יִן", schema); * // ʿāyin * ``` */ AYIN; /** * HEBREW LETTER FINAL PE (U+05E3) ף * * @category Consonants * * @example * ```js * const schema = new Schema({ * // truncated for brevity * FINAL PE: "p", * }); * transliterate("כַּ֣ף", schema); * // kap * ``` */ FINAL_PE; /** * HEBREW LETTER PE (U+05E4) פ * * @category Consonants * * @example * ```js * const schema = new Schema({ * // truncated for brevity * PE: "p", * }); * transliterate("פֶּ֣רֶא חָפְשִׁ֑י", schema); * // pereʾ ḥopšî * ``` */ PE; /** * HEBREW LETTER PE (U+05E4) and DAGESH (U+05BC) פּ * * @category Consonants * @category Orthographic Features * * @example * With only `PE` set * ```js * const schema = new Schema({ * // truncated for brevity * PE_DAGESH: "p", * }); * transliterate("פֶּ֣רֶא חָפְשִׁ֑י", schema); * // pereʾ ḥopšî * ``` * * @example * With `PE` and `PE_DAGESH` set * ```js * const schema = new Schema({ * // truncated for brevity * PE: "f", * PE_DAGESH: "p", * }); * transliterate("פֶּ֣רֶא חָפְשִׁ֑י", schema); * // pereʾ ḥofšî * ``` * * @remarks * The letter pe with a dagesh kal * Use when need to distinguish between spirantized forms */ PE_DAGESH; /** * HEBREW LETTER FINAL TSADI (U+05E5) ץ * * @category Consonants * * @example * ```js * const schema = new Schema({ * // truncated for brevity * FINAL TSADI: "ṣ", * }); * transliterate("צָ֚ץ", schema); * // ṣāṣ * ``` */ FINAL_TSADI; /** * HEBREW LETTER TSADI (U+05E6) צ * * @category Consonants * * @example * ```js * const schema = new Schema({ * // truncated for brevity * TSADI: "ṣ", * }); * transliterate("צָ֚ץ", schema); * // ṣāṣ * ``` */ TSADI; /** * HEBREW LETTER QOF (U+05E7) ק * * @category Consonants * * @example * ```js * const schema = new Schema({ * // truncated for brevity * QOF: "q", * }); * transliterate("רַ֥ק", schema); * // raq * ``` */ QOF; /** * HEBREW LETTER RESH (U+05E8) ר * * @category Consonants * * @example * ```js * const schema = new Schema({ * // truncated for brevity * RESH: "r", * }); * transliterate("רַ֥ק", schema); * // raq * ``` */ RESH; /** * HEBREW LETTER SHIN (U+05E9) and SHIN DOT (U+05C1) שׁ * * @category Consonants * @category Orthographic Features * * @example * ```js * const schema = new Schema({ * // truncated for brevity * SHIN: "š", * }); * transliterate("שֵׁ֖ן", schema); * // šēn * ``` */ SHIN; /** * HEBREW LETTER SHIN (U+05E9) and SIN DOT (U+05C2) שׁ * * @category Consonants * @category Orthographic Features * * @example * ```js * const schema = new Schema({ * // truncated for brevity * SIN: "ś", * }); * transliterate("כַּשְׂדִּ֔ים", schema); * // kaśdîm * ``` */ SIN; /** * HEBREW LETTER TAV (U+05EA) ת * * @category Consonants * * @example * ```js * const schema = new Schema({ * // truncated for brevity * TAV: "t", * }); * transliterate("תֵּ֛ת", schema); * // tēt * ``` */ TAV; /** * HEBREW LETTER TAV (U+05EA) and DAGESH (U+05BC) תּ * * @category Consonants * @category Orthographic Features * * @example * With only `TAV` set * ```js * const schema = new Schema({ * // truncated for brevity * TAV: "t", * }); * transliterate("תֵּ֛ת", schema); * // tēt * ``` * * @example * With `TAV` and `TAV_DAGESH` set * ```js * const schema = new Schema({ * // truncated for brevity * TAV: "th", * TAV_DAGESH: "t", * }); * transliterate("תֵּ֛ת", schema); * // tēth * ``` * * @remarks * The letter tav with a dagesh kal. * Use when need to distinguish between spirantized forms */ TAV_DAGESH; /** * Rules for customized output * * This property is an array of objects with the following properties each: * - `FEATURE`: the type of feature that the rule is checking — "word", "syllable", or "cluster" * - `HEBREW`: the Hebrew text that the rule matches, given as a string or Regex * - `PASS_THROUGH?`: An optional property; `true` if the rule should pass the characters of the result of the `TRANSLITERATION` callback to the be mapped to the schema * - `TRANSLITERATION`: the output of the rule, either a string or a callback whose properties differ based on the `FEATURE` * * The examples give the best indication of how to use these features, though see the particular types for more details * * @category Orthographic Features * * @example * `FEATURE` is `"word"` and `TRANSLITERATION` is a string * ```js * const schema = new Schema({ * // truncated for brevity * ADDITIONAL_FEATURES: [{ * FEATURE: "word", * HEBREW: "הָאָרֶץ", * TRANSLITERATION: "The Earth" * }] }) * transliterate("וְאֵ֥ת הָאָֽרֶץ", schema); * // wəʾēt The Earth * ``` * * @example * `FEATURE` is `"word"` and `TRANSLITERATION` is a callback * ```js * const schema = new Schema({ * // truncated for brevity * ADDITIONAL_FEATURES: [{ * HEBREW: "שְׁתַּיִם", * FEATURE: "word", * TRANSLITERATION: function (_word, _hebrew, schema) { * return ( * schema["SHIN"] + * (schema["TAV_DAGESH"] ?? schema["TAV"]) + * schema["PATAH"] + * schema["YOD"] + * schema["HIRIQ"] + * schema["FINAL_MEM"] * ); * } * }] * }); * transliterate("שְׁתַּיִם", schema); * // štayim * ``` * @example * `FEATURE` is `"syllable"` and `TRANSLITERATION` is a string * ```js * const schema = new Schema({ * // truncated for brevity * ADDITIONAL_FEATURES: [{ * FEATURE: "syllable", * HEBREW: /יּ(?![\u{05B4}-\u{05BB}])/u, // a yod with a dagesh, not followed by a vowel character * TRANSLITERATION: "Y" * }] * }); * transliterate("מְחִיּיָאֵ֗ל", schema); * // məḥiYyāʾēl * ``` * * @example * `FEATURE` is `"syllable"` and `TRANSLITERATION` is a callback * ```js * const schema = new Schema({ * // truncated for brevity * ADDITIONAL_FEATURES: [{ * FEATURE: "syllable", * HEBREW: /\u{05C7}/u, * TRANSLITERATION: (syllable) => { * // If the syllable contains a qamets qatan character (U+05C7), check the text of the next syllable * const next = syllable?.next?.value?.text; * * // If the next syllable includes a hateph qamets, then replace the qamets qatan with a regular qamets * if (next && next.includes("\u05B3")) { * return syllable.text.replace("\u{05C7}", "\u{05B8}"); * } * return syllable.text; * } * }] * }); * transliterate("נָעֳמִי֙", schema); * // nāʿŏmî * ``` * * @example * `FEATURE` is `"cluster"` and `TRANSLITERATION` is a string * ```js * const schema = new Schema({ * // truncated for brevity * ADDITIONAL_FEATURES: [{ * FEATURE: "cluster", * HEBREW: "זּ", * TRANSLITERATION: "tz" * }] * });; * transliterate("הַזֹּאת", schema); * // hatzōʾt * ``` * * @example * `FEATURE` is "cluster" and `TRANSLITERATION` is a callback * ```js * const schema = new Schema({ * // truncated for brevity * TAV_DAGESH: "tʰ",, * ADDITIONAL_FEATURES: [{ * FEATURE: 'cluster', * HEBREW: /תּ(?!\u{05B0})/u, * TRANSLITERATION: (cluster, _, schema) => { * // Because the *_DAGESH value is a digraph, we need to replace the first character * // or it will be doubled in rules.ts as "tʰtʰ" * * * // If there is a dagesh, but it is the beginning of the word * // we can return the text, as the character w/ the dagesh will not be doubled * if (!cluster.prev || cluster.prev.value?.isNotHebrew) { * return cluster.text; * } * * // If there is a dagesh, it may be that it is a dagesh qal (i.e. lene) * // If it is a dagesh lene, then like the beginning of the word, * // the character w/ the dagesh will not be doubled * const prevCoda = cluster.syllable?.prev?.value?.codaWithGemination; * if (!prevCoda?.includes("ת",)) { * return cluster.text; * } * * // convert "tʰtʰ" to "ttʰ" * const noAspiration = schema['TAV_DAGESH']?.replace("ʰ",, '') ?? ''; * return cluster.text.replace("תּ",,`${noAspiration + schema['TAV_DAGESH']}`); * }, * }] * }); * transliterate("וַתֵּ֨שֶׁב", schema); * // wattʰēšeb * ``` * */ ADDITIONAL_FEATURES; /** * The full form of the divine name - יהוה * * @category Orthographic Features * * @example * ```js * const schema = new Schema({ * // truncated for brevity * DIVINE_NAME: "yhwh", * }); * transliterate("יְהֹוָ֗ה", schema); * // yhwh * ``` */ DIVINE_NAME; /** * The full form of the divine name pointed as 'elohim * * @category Orthographic Features * * @example * ```js * const schema = new Schema({ * // truncated for brevity * DIVINE_NAME_ELOHIM: "ʾĕlōhîm", * }); * transliterate("יֱהֹוִה", schema); * // ʾĕlōhîm * ``` * * @remarks * Matches on the forms: * - יֱהֹוִה * - יֱהוִה * - יְהֹוִה * - יְהוִה * If `undefined`, defaults to value of {@link DIVINE_NAME} */ DIVINE_NAME_ELOHIM; /** * A syllable separator, usually an empty string * * @category Orthographic Features * * @example * ```js * const schema = new Schema({ * // truncated for brevity * SYLLABLE_SEPARATOR: "-", * }); * transliterate('הָאָֽרֶץ', schema); * // hā-ʾā-reṣ * ``` */ SYLLABLE_SEPARATOR; /** * A mark for indentifying the stressed syllable * * @category Orthographic Features * * @example * ```js * const schema = new Schema({ * // truncated for brevity * STRESS_MARKER: { * location: "after-vowel", * mark: "\u0301", * }, * }); * transliterate("מֶ֣לֶךְ", schema); * // mélek * ``` * * @remarks * Taamim are needed in the Hebrew text to correctly identify stress. */ STRESS_MARKER; /** * A callback that is invoked when transliteration is complete * * @category Orthographic Features * * @example * Modifying the result * ```js * const schema = new Schema({ * // truncated for brevity * ON_COMPLETE: (result) => result.replace("th", "t'h"), * }); * transliterate("תִתְהַלָּֽל", schema); * // tit'hallāl * ``` * * @example * Accessing callback arguments * ```js * const schema = new Schema({ * // truncated for brevity * ON_COMPLETE: (result, { original, schema, text }) => { * console.log("Original Hebrew:", original); * console.log("Schema value:", schema.PATAH); * console.log("Word count:", text.words.length); * return result; * }, * }); * transliterate("שָּׁלוֹם", schema); * // "šālôm" * // Original Hebrew: שָּׁלוֹם * // Schema value: a * // Word count: 1 * ``` */ ON_COMPLETE; /** * @category Syllabification * * @remarks * See implementation for more details */ allowNoNiqqud; /** * @category Syllabification * * @remarks * See implementation for more details */ article; /** * @category Syllabification * * @remarks * See implementation for more details */ holemHaser; /** * @category Syllabification * * @remarks * See implementation for more details * */ ketivQeres; /** * @category Syllabification * * @remarks * See implementation for more details */ longVowels; /** * @category Syllabification * * @remarks * See implementation for more details */ qametsQatan; /** * @category Syllabification * * @remarks * See implementation for more details */ shevaAfterMeteg; /** * @category Syllabification * * @remarks * See implementation for more details */ shevaWithMeteg; /** * @category Syllabification * * @remarks * See implementation for more details */ sqnmlvy; /** * @category Syllabification * * @remarks * See implementation for more details */ strict; /** * @category Syllabification * * @remarks * See implementation for more details */ wawShureq; /**@category Constructors */ constructor(schema) { this.VOCAL_SHEVA = schema.VOCAL_SHEVA; this.HATAF_SEGOL = schema.HATAF_SEGOL; this.HATAF_PATAH = schema.HATAF_PATAH; this.HATAF_QAMATS = schema.HATAF_QAMATS; this.HIRIQ = schema.HIRIQ; this.TSERE = schema.TSERE; this.SEGOL = schema.SEGOL; this.PATAH = schema.PATAH; this.QAMATS = schema.QAMATS; this.HOLAM = schema.HOLAM; this.HOLAM_HASER = schema.HOLAM_HASER; this.QUBUTS = schema.QUBUTS; this.DAGESH = schema.DAGESH; this.DAGESH_CHAZAQ = schema.DAGESH_CHAZAQ; this.MAQAF = schema.MAQAF; this.PASEQ = schema.PASEQ; this.SOF_PASUQ = schema.SOF_PASUQ; this.QAMATS_QATAN = schema.QAMATS_QATAN; this.FURTIVE_PATAH = schema.FURTIVE_PATAH; this.HIRIQ_YOD = schema.HIRIQ_YOD; this.TSERE_YOD = schema.TSERE_YOD; this.SEGOL_YOD = schema.SEGOL_YOD; this.SHUREQ = schema.SHUREQ; this.HOLAM_VAV = schema.HOLAM_VAV; this.QAMATS_HE = schema.QAMATS_HE; this.PATAH_HE = schema.PATAH_HE; this.SEGOL_HE = schema.SEGOL_HE; this.TSERE_HE = schema.TSERE_HE; this.MS_SUFX = schema.MS_SUFX; this.ALEF = schema.ALEF; this.BET_DAGESH = schema.BET_DAGESH; this.BET = schema.BET; this.GIMEL = schema.GIMEL; this.GIMEL_DAGESH = schema.GIMEL_DAGESH; this.DALET = schema.DALET; this.DALET_DAGESH = schema.DALET_DAGESH; this.HE = schema.HE; this.VAV = schema.VAV; this.ZAYIN = schema.ZAYIN; this.HET = schema.HET; this.TET = schema.TET; this.YOD = schema.YOD; this.FINAL_KAF = schema.FINAL_KAF; this.KAF = schema.KAF; this.KAF_DAGESH = schema.KAF_DAGESH; this.LAMED = schema.LAMED; this.FINAL_MEM = schema.FINAL_MEM; this.MEM = schema.MEM; this.FINAL_NUN = schema.FINAL_NUN; this.NUN = schema.NUN; this.SAMEKH = schema.SAMEKH; this.AYIN = schema.AYIN; this.FINAL_PE = schema.FINAL_PE; this.PE = schema.PE; this.PE_DAGESH = schema.PE_DAGESH; this.FINAL_TSADI = schema.FINAL_TSADI; this.TSADI = schema.TSADI; this.QOF = schema.QOF; this.RESH = schema.RESH; this.SHIN = schema.SHIN; this.SIN = schema.SIN; this.TAV = schema.TAV; this.TAV_DAGESH = schema.TAV_DAGESH; this.DIVINE_NAME = schema.DIVINE_NAME; this.DIVINE_NAME_ELOHIM = schema.DIVINE_NAME_ELOHIM; this.SYLLABLE_SEPARATOR = schema.SYLLABLE_SEPARATOR; this.ADDITIONAL_FEATURES = schema.ADDITIONAL_FEATURES; this.STRESS_MARKER = schema.STRESS_MARKER; this.ON_COMPLETE = schema.ON_COMPLETE; this.longVowels = schema.longVowels; this.qametsQatan = schema.qametsQatan; this.sqnmlvy = schema.sqnmlvy; this.shevaAfterMeteg = schema.shevaAfterMeteg; this.shevaWithMeteg = schema.shevaWithMeteg; this.wawShureq = schema.wawShureq; this.article = schema.article; this.allowNoNiqqud = schema.allowNoNiqqud; this.strict = schema.strict; this.holemHaser = schema.holemHaser; this.ketivQeres = schema.ketivQeres; } } //# sourceMappingURL=schema.js.map