hebrew-transliteration

a package for transliterating Hebrew according to SBL guidelines

Usage no npm install needed!

<script type="module">
  import hebrewTransliteration from 'https://cdn.skypack.dev/hebrew-transliteration';
</script>

README

hebrew-transliteration

A JavaScript package for transliterating Hebrew

install

npm

npm install hebrew-transliteration

local

You will need to have node installed.

Download or clone this repository

cd hebrew-transliteration
npm install
npm run build

example

const heb = require("hebrew-transliteration");
const transliterate = heb.transliterate;
transliterate("אֱלֹהִים");
// ʾĕlōhîm

DOCS

About

This is a JavaScript package for transliterating Hebrew.

It exports 3 functions:

  1. transliterate() — the main function which transliterates Hebrew
  2. remove() — removes taamim and optionally removes certain niqqudim
  3. sequence() — sequences Hebrew characters according to the SBL Hebrew Font Manual

And it exports 2 classes:

  1. Text — the Text class from the havarotjs package
  2. Schema — a schema for transliterating Hebrew

Functions

transliterate()

Takes a string or Text, and optionally a Schema or Partial<Schema>

heb.transliterate("אֱלֹהִים");
// "ʾĕlōhîm";

If no Schema is passed, then the package defaults to SBL's academic style.

You can pass in a Partial<Schema> that will modify SBL's academic style:

heb.transliterate("שָׁלוֹם", { SHIN: "sh" });
// shālôm

If you need a fully customized transliteration, it is best to use the Schema constructor:

const schema = new heb.Schema({
  ALEF: "'",
  BET: "B",
  ...
  QAMETS: "A",
  ...
}) // truncated for brevity

heb.transliterate("אָ֣ב", schema)
// 'AB

remove()

Takes string and options. The default only removes taamim (i.e., accent or cantillation) marks.

heb.remove("שָׂרַ֣י אִשְׁתְּךָ֔");
// "שָׂרַי אִשְׁתְּךָ";

heb.remove("שָׂרַ֣י אִשְׁתְּךָ֔", { removeVowels: true });
// "שׂרי אשׁתך";

heb.remove("שָׂרַ֣י אִשְׁתְּךָ֔", { removeVowels: true, removeShinDot: true, removeSinDot: true });
// "שרי אשתך";

sequence()

Takes a string. Returns a string of properly sequenced characters according to the SBL Hebrew Font manual following the pattern of: consonant - dagesh - vowel - ta'am

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}");
//           "\u{5D1}\u{5BC}\u{5B0}\u{5E8}\u{5B5}\u{5D0}\u{5E9}\u{5C1}\u{5B4}\u{596}\u{5D9}\u{5EA}"

Classes

Text

The Text class from the havarotjs package.

This class is used by transliterate() internally to syllabify Hebrew text, but it is exposed as well.

const text = new heb.Text("הֲבָרֹות");
text.syllables;
// [
//    Syllable { original: "הֲ" },
//    Syllable { original: "בָ" },
//    Syllable { original: "רֹות" }
//  ]

If a Text is passed into transliterate() instead of a string, then the syllabification from the Text class is used. If a string is passed in, then syllabification come from the options passed into the Schema. See more under syllabification.

Schema

A Schema is used to define a schema for transliteration. See the Schema source for all available properties.

The Schema can be divided into a few categories.

1) Syllabification

The options used for syllabifying Hebrew text can be found here

Differences between Text and Schema

There are 5 options for syllabification that are the same as the ones used by the Text class. The only Text syllabification option that Schema does not use is schema (yes, that's confusing):

const text = new heb.Text("חׇכְמָ֣ה", { schema: "traditional" }); // this is okay
const schema = new heb.Schema({ schema: "traditional" }); // this does nothing

Read more about the syllabification options for the Text and a higher level overview

Precedence of Text over Schema

The syllabification options set by Schema are used if a string is passed into transliterate(). If a Text is passed into transliterate() instead of a string, then the syllabification from the Text class is used:

// using default
heb.transliterate("חָכְמָ֣ה"); // ḥokmâ

// using Schema for syllabification
heb.transliterate("חָכְמָ֣ה", { qametsQatan: false }); // ḥākǝmâ

// using Text for syllabification
heb.transliterate(new heb.Text("חָכְמָ֣ה", { qametsQatan: false })); // ḥākǝmâ

// using Schema and Text — Text takes precedence
heb.transliterate(new heb.Text("חָכְמָ֣ה", { qametsQatan: true }), { qametsQatan: false }); // ḥokmâ

Note: qametsQatan only converts a regular qamets character; if a qamets qatan character is used, it will always be a qamets qatan.

2) Characters

Most Schema properties are for defining single Hebrew characters:

heb.transliterate("אָ", { ALEF: "@", QAMETS: "A" });
// @A
3) Orthographic Features

Some properties are for defining common Hebrew orthographies for:

BeGaDKePhaT

There are properties for the digraphs of BeGaDKePhaT letters:

  • BET_DAGESH
  • GIMEL_DAGESH
  • DALET_DAGESH
  • KAF_DAGESH
  • PE_DAGESH
  • TAV_DAGESH

Each one is the consonant character followed by the dagesh character (U+05BC).

These are helpful for distinguishing between spirantized forms.

heb.transliterate("בְּבֵית", { BET: "b" });
// bǝbêt

heb.transliterate("בְּבֵית", { BET: "v", BET_DAGESH: "b" });
// bǝvêt
Matres Lectionis

The following properties are for matres lectionis:

  • HIRIQ_YOD
  • TSERE_YOD
  • SEGOL_YOD
  • SHUREQ
  • HOLAM_VAV
  • QAMATS_HE
  • SEGOL_HE
  • TSERE_HE
heb.transliterate("פֶּה", { SEGOL_HE: "é" });
// pé
Others

There are other orthographic features:

  • MS_SUFX — HEBREW LETTER QAMATS (U+05B8) and YOD (U+05D9) and VAV (U+05D5) יו◌ָ
  • DIVINE_NAME — the full form of the divine name - יהוה
  • SYLLABLE_SEPARATOR — a syllable separator, usually an empty string
  • DAGESH_CHAZAQ — if true, repeats the consonant with the dagesh
heb.transliterate("שַׁבָּת", { DAGESH_CHAZAQ: true });
// šabbāt

heb.transliterate("שַׁבָּת", { DAGESH_CHAZAQ: false });
// šabāt

heb.transliterate("הָאָֽרֶץ", { SYLLABLE_SEPARATOR: "-" });
// hā-ʾā-reṣ
4) Others
Additional Features

The ADDITIONAL_FEATURES property is for defining non-typical Hebrew orthography, example:

heb.transliterate("הַזֹּאת", {
  ADDITIONAL_FEATURES: [
    {
      FEATURE: "cluster",
      HEBREW: "זּ",
      TRANSLITERATION: "tz"
    }
  ]
});
// hatzōʾt
  • The orthography זּ is most often a doubling of the ZAYIN (i.e. 'z' with no dagesh, and 'zz' with a dagesh chazaq)
  • In the Romaniote reading tradition, however, the ZAYIN is usually transliterated with 'z' (really 'ζ'),
  • but a ZAYIN followed by a dagesh is transliterated as 'tz' (really 'τζ')

Each additional feature consists of 3 parts:

  1. FEATURE — has three options:
  • "cluster" — a cluster is any combination of a single character and optionally a dagesh and vowel.
  • "syllable" — a syllable is any combination of a multiple characters and a single vowel and optionally a dagesh
  • "word" — covers everything else
  1. HEBREW — the Hebrew text to be transliterated
  2. TRANSLITERATION — the text used to transliterate the Hebrew text

:warning: this is an experimental property; results may not always meet expectations

Stress Marker

The STRESS_MARKER property is an optional mark to indicate stress in transliteration.

heb.transliterate("מֶ֣לֶךְ", { STRESS_MARKER: { location: "after-vowel", mark: "\u0301" } });
// mélek

The location has four options:

  • "before-syllable"
  • "after-syllable"
  • "before-vowel"
  • "after-vowel"

A combining mark (e.g. "\u0301") placed "after-vowel" will print on top of the vowel, and placed after a digraph will print on the second vowel.

heb.transliterate("בֵּ֣ית", {
  TSERE_YOD: "ei",
  STRESS_MARKER: { location: "after-vowel", mark: "\u0301" }
});
// beít

Live

Use it live at charlesLoder.github.io/hebrewTransliteration

Contributing

See contributing