Skip to content

ClusterFeature

Extends

Properties

FEATURE

FEATURE: "cluster"

Additional orthographic feature.

  • "cluster" is any combination of a single character and optionally a dagesh and vowel.
  • "syllable" is any combination of a multiple characters and a single vowel and optionally a dagesh
  • "word" covers everything else

Defined in

src/schema.ts:219


HEBREW

HEBREW: string | RegExp

The Hebrew text — use consonants and vowels; do not use taamim

Remarks

The text is parsed as a Regex so special characters like ? and | can be used

Inherited from

HebrewFeature.HEBREW

Defined in

src/schema.ts:18


PASS_THROUGH?

optional PASS_THROUGH: boolean

If true passes the characters of the result of the TRANSLITERATION callback to the be mapped to the schema. If TRANSLITERATION is a string, this does nothing.

Default

true

Examples

// with PASS_THROUGH true or undefined; the rest of the characters are passed through
// to regular mapping on the schema
heb.transliterate("בְּרֵאשִׁ֖ית", {
ADDITIONAL_FEATURES: [{
HEBREW: "(?<![\u{05B1}-\u{05BB}\u{05C7}].*)\u{05B0}",
FEATURE: "syllable",
PASS_THROUGH: true,
TRANSLITERATION: function (syllable, _hebrew, schema) {
const next = syllable.next;
const nextVowel = next.vowelName === "SHEVA" ? "VOCAL_SHEVA" : next.vowelName
if (next && nextVowel) {
const vowel = schema[nextVowel] || "";
return syllable.text.replacenew RegExp("\u{05B0}", "u"; vowel);
}
return syllable.text;
}
}]
});
// with PASS_THROUGH false, a custom mapping needs to be implemented,
// or Hebrew characters are returned for the rest of the `FEATURE`
heb.transliterate("בְּרֵאשִׁ֖ית", {
ADDITIONAL_FEATURES: [{
HEBREW: "(?<![\u{05B1}-\u{05BB}\u{05C7}].*)\u{05B0}",
FEATURE: "syllable",
PASS_THROUGH: false,
TRANSLITERATION: function (syllable, _hebrew, schema) {
const next = syllable.next;
const nextVowel = next.vowelName === "SHEVA" ? "VOCAL_SHEVA" : next.vowelName
if (next && nextVowel) {
const vowel = schema[nextVowel] || "";
return syllable.text.replacenew RegExp("\u{05B0}", "u"; vowel);
}
return syllable.text;
}
}]
});
// בּērēʾšît

Remarks

This is generally most useful when the callback does not transliterate the entire FEATURE

Inherited from

PassThrough.PASS_THROUGH

Defined in

src/schema.ts:81


TRANSLITERATION

TRANSLITERATION: string | ClusterCallback

A string or callback to customize the output

Examples

Using a string

transliterate("הַזֹּאת", {
ADDITIONAL_FEATURES: [{
FEATURE: "cluster",
HEBREW: "זּ",
TRANSLITERATION: "tz"
}]
});
// hatzōʾt

Using a callback

transliterate("וַתֵּ֨שֶׁב", {
TAV_DAGESH: "",,
ADDITIONAL_FEATURES: [{
FEATURE: 'cluster',
HEBREW: /תּ(?!\u{05B0})/u,
TRANSLITERATION: (cluster, _, schema) => {
// 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;
}
// 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ʰ"
const noAspiration = schema['TAV_DAGESH']?.replace("ʰ",, '') ?? '';
return cluster.text.replace("תּ",,`${noAspiration + schema['TAV_DAGESH']}`);
},
}]
});
// wattʰēšeb

Defined in

src/schema.ts:271