UNPKG

hebrew-transliteration

Version:
245 lines (244 loc) 10 kB
import { Schema } from "../schema.js"; /** * The default schema according to SBL's academic style guide. * * Whereas a new {@link Schema} must have all required properties when constructed, * this schema is meant to be used as a default so particular properties can be overidden (see example). * * If the property is not set, the default value will be used. Each property is documented below with their default values. * * Click into each property's "Overrides" for more information about that property. * * @param schema a {@link Schema | Partial<Schema>} * * @example * Extend the default schema * ```js * transliterate("שָׁלוֹם", { SHIN: "sh" }); * // shālôm * ``` * * @privateRemarks * In order for documentation output to be the way I wanted, the properties are all redefined with their type from the Schema. * This is not necessary for the implementation, just the docs. */ export declare class SBL extends Schema { /** @category Vowels @default "ə" */ VOCAL_SHEVA: Schema["VOCAL_SHEVA"]; /** @category Vowels @default "ĕ" */ HATAF_SEGOL: Schema["HATAF_SEGOL"]; /** @category Vowels @default "ă" */ HATAF_PATAH: Schema["HATAF_PATAH"]; /** @category Vowels @default "ŏ" */ HATAF_QAMATS: Schema["HATAF_QAMATS"]; /** @category Vowels @default "i" */ HIRIQ: Schema["HIRIQ"]; /** @category Vowels @default "ē" */ TSERE: Schema["TSERE"]; /** @category Vowels @default "e" */ SEGOL: Schema["SEGOL"]; /** @category Vowels @default "a" */ PATAH: Schema["PATAH"]; /** @category Vowels @default "ā" */ QAMATS: Schema["QAMATS"]; /** @category Vowels @default "ō" */ HOLAM: Schema["HOLAM"]; /** @category Vowels @default "ō" */ HOLAM_HASER: Schema["HOLAM_HASER"]; /** @category Vowels @default "ū" */ QUBUTS: Schema["QUBUTS"]; /** @category Marks @default "" */ DAGESH: Schema["DAGESH"]; /** @category Marks @category Orthographic Features @default true */ DAGESH_CHAZAQ: Schema["DAGESH_CHAZAQ"]; /** @category Marks @category Taamim @default "-" */ MAQAF: Schema["MAQAF"]; /** @category Marks @default "" */ PASEQ: Schema["PASEQ"]; /** @category Marks @category Taamim @default "" */ SOF_PASUQ: Schema["SOF_PASUQ"]; /** @category Vowels @default "o" */ QAMATS_QATAN: Schema["QAMATS_QATAN"]; /** @category Vowels @category Orthographic Features @default "a" */ FURTIVE_PATAH: Schema["FURTIVE_PATAH"]; /** @category Vowels @category Orthographic Features @default "î" */ HIRIQ_YOD: Schema["HIRIQ_YOD"]; /** @category Vowels @category Orthographic Features @default "ê" */ TSERE_YOD: Schema["TSERE_YOD"]; /** @category Vowels @category Orthographic Features @default "ê" */ SEGOL_YOD: Schema["SEGOL_YOD"]; /** @category Vowels @category Orthographic Features @default "û" */ SHUREQ: Schema["SHUREQ"]; /** @category Vowels @category Orthographic Features @default "ô" */ HOLAM_VAV: Schema["HOLAM_VAV"]; /** @category Vowels @category Orthographic Features @default "â" */ QAMATS_HE: Schema["QAMATS_HE"]; /** @category Vowels @category Orthographic Features @default undefined */ PATAH_HE: Schema["PATAH_HE"]; /** @category Vowels @category Orthographic Features @default undefined */ SEGOL_HE: Schema["SEGOL_HE"]; /** @category Vowels @category Orthographic Features @default undefined */ TSERE_HE: Schema["TSERE_HE"]; /** @category Vowel @category Orthographic Features @default "āyw" */ MS_SUFX: Schema["MS_SUFX"]; /** @category Consonants @default "ʾ" */ ALEF: Schema["ALEF"]; /** @category Consonants @default "b" */ BET: Schema["BET"]; /** @category Consonants @category Orthographic Features @default undefined */ BET_DAGESH: Schema["BET_DAGESH"]; /** @category Consonants @default "g" */ GIMEL: Schema["GIMEL"]; /** @category Consonants @category Orthographic Features @default undefined */ GIMEL_DAGESH: Schema["GIMEL_DAGESH"]; /** @category Consonants @default "d" */ DALET: Schema["DALET"]; /** @category Consonants @category Orthographic Features @default undefined */ DALET_DAGESH: Schema["DALET_DAGESH"]; /** @category Consonants @default "h" */ HE: Schema["HE"]; /** @category Consonants @default "w" */ VAV: Schema["VAV"]; /** @category Consonants @default "z" */ ZAYIN: Schema["ZAYIN"]; /** @category Consonants @default "ḥ" */ HET: Schema["HET"]; /** @category Consonants @default "ṭ" */ TET: Schema["TET"]; /** @category Consonants @default "y" */ YOD: Schema["YOD"]; /** @category Consonants @default "k" */ FINAL_KAF: Schema["FINAL_KAF"]; /** @category Consonants @default "k" */ KAF: Schema["KAF"]; /** @category Consonants @category Orthographic Features @default undefined */ KAF_DAGESH: Schema["KAF_DAGESH"]; /** @category Consonants @default "l" */ LAMED: Schema["LAMED"]; /** @category Consonants @default "m" */ FINAL_MEM: Schema["FINAL_MEM"]; /** @category Consonants @default "m" */ MEM: Schema["MEM"]; /** @category Consonants @default "n" */ FINAL_NUN: Schema["FINAL_NUN"]; /** @category Consonants @default "n" */ NUN: Schema["NUN"]; /** @category Consonants @default "s" */ SAMEKH: Schema["SAMEKH"]; /** @category Consonants @default "ʿ" */ AYIN: Schema["AYIN"]; /** @category Consonants @default "p" */ FINAL_PE: Schema["FINAL_PE"]; /** @category Consonants @default "p" */ PE: Schema["PE"]; /** @category Consonants @category Orthographic Features @default undefined */ PE_DAGESH: Schema["PE_DAGESH"]; /** @category Consonants @default "ṣ" */ FINAL_TSADI: Schema["FINAL_TSADI"]; /** @category Consonants @default "ṣ" */ TSADI: Schema["TSADI"]; /** @category Consonants @default "q" */ QOF: Schema["QOF"]; /** @category Consonants @default "r" */ RESH: Schema["RESH"]; /** @category Consonants @category Orthographic Features @default "š" */ SHIN: Schema["SHIN"]; /** @category Consonants @category Orthographic Features @default "ś" */ SIN: Schema["SIN"]; /** @category Consonants @default "t" */ TAV: Schema["TAV"]; /** @category Consonants @category Orthographic Features @default undefined */ TAV_DAGESH: Schema["TAV_DAGESH"]; /** @category Orthographic Features @default "yhwh" */ DIVINE_NAME: Schema["DIVINE_NAME"]; /** @category Orthographic Features @default undefined */ DIVINE_NAME_ELOHIM: Schema["DIVINE_NAME_ELOHIM"]; /** @category Orthographic Features @default undefined */ SYLLABLE_SEPARATOR: Schema["SYLLABLE_SEPARATOR"]; /** * @category Orthographic Features * @default * ```js * [ * { * FEATURE: "syllable", * HEBREW: /[\u{05B4}\u{05BB}]/u, * TRANSLITERATION: (syllable, heb, schema) => { * // matches any syllable with a hiriq or qubuts, * // and checks for a "long" vowel (i.e a hiriq or qubuts in an accented syllable without a mater) * const hasMater = syllable.clusters.some((cluster) => cluster.isMater); * if (syllable.isAccented && !hasMater) { * const macron = "\u0304"; * const output = syllable.hasVowelName("HIRIQ") ? schema["HIRIQ"] + macron : schema["QUBUTS"] + macron; * return syllable.text.replace(heb, output.normalize("NFC")); * } * return syllable.text; * } * }, * { * FEATURE: "syllable", * HEBREW: "\u{05BC}", * TRANSLITERATION: (syllable, heb) => { * // matches any word with a dagesh, * // and checks for a euphonic dagesh * const currWord = syllable?.word?.value; * const prevWord = currWord?.prev?.value; * if (!currWord || !prevWord || !prevWord.isInConstruct) { * return syllable.text; * } * * if (syllable.prev) { * return syllable.text; * } * * return syllable.text.replace(heb, ""); * } * } * ] * ``` * * @example * Extending SBL with a new feature and keeping the default features * ```js * import { SBL, transliterate } from "hebrew-transliteration"; * * const sbl = new SBL(); * const oldFeatures = sbl.ADDITIONAL_FEATURES; * const newFeature = { * FEATURE: "word", * HEBREW: "הָאָרֶץ", * TRANSLITERATION: "The Earth" * } * * transliterate("הָאָרֶץ", { * ADDITIONAL_FEATURES: [...oldFeatures, newFeature], * }); * ``` */ ADDITIONAL_FEATURES: Schema["ADDITIONAL_FEATURES"]; /** @category Orthographic Features @default undefined */ STRESS_MARKER: Schema["STRESS_MARKER"]; /** @category Syllabification @default true */ longVowels: Schema["longVowels"]; /** @category Syllabification @default true */ qametsQatan: Schema["qametsQatan"]; /** @category Syllabification @default true */ shevaAfterMeteg: Schema["shevaAfterMeteg"]; /** @category Syllabification @default false */ shevaWithMeteg: Schema["shevaWithMeteg"]; /** @category Syllabification @default true */ sqnmlvy: Schema["sqnmlvy"]; /** @category Syllabification @default true */ wawShureq: Schema["wawShureq"]; /** @category Syllabification @default true */ article: Schema["article"]; /** @category Syllabification @default true */ allowNoNiqqud: Schema["allowNoNiqqud"]; /** @category Syllabification @default false */ strict: Schema["strict"]; /** @category Syllabification @default "remove" */ holemHaser: Schema["holemHaser"]; /** @category Syllabification @default undefined */ ketivQeres: Schema["ketivQeres"]; constructor(schema: Partial<Schema>); }