Reading MAM-parsed-plus

The MAM-parsed-plus JSON files are formed by: (a) parsing the Wikitext downloaded from Hebrew Wikisource, (b) adding some conveniences and (c) removing some inconveniences. Of course, what is considered an inconvenience and what is considered a convenience can only be determined relative to a particular application. Nonetheless, we’ve tried to make MAM-parsed-plus convenient to use for a broad variety of applications. This document covers:

For guidance when writing code to use the data, see Notes for applications.

File naming

File names (e.g. A1-Genesis.json) start with two characters that identify the book (in the “24 books” sense) and provide a standard ordering. The first character (sec_char) comes from the set ABCDEF and indicates the section of Tanakh. The second character (book24_char) comes from the set 12345AC and indicates the book within that section.

Files are named {sec_char}{book24_char}-{EnglishName}.json:

Prefix Section Books
A1–A5 Torah Genesis, Exodus, Leviticus, Numbers, Deuteronomy
B1, B2, BA, BC Former Prophets Joshua, Judges, Samuel, Kings
C1–C3, CA Latter Prophets Isaiah, Jeremiah, Ezekiel, The 12 Minor Prophets
D1–D3 Wisdom Psalms, Proverbs, Job
E1–E5 Five Scrolls Song of Songs, Ruth, Lamentations, Ecclesiastes, Esther
F1, FA, FC Late Books Daniel, Ezra-Nehemiah, Chronicles

When book24_char is A or C, the file is for a book24 with sub-books (e.g. BA-Samuel has sub-books 1 Samuel and 2 Samuel). The letter B is not used in order to keep compatibility with a set of codes used for the 39-book system.

Top-level structure

{
  "header": {...},
  "book39s": [...]
}

Header

Key Type Description
book24_name string The name of this file’s book24.
sub_book_names array Array of sub-book names for this book24. (Empty if this book24 has no sub-books.)
chapter_counts array One object per book39, each with sub_book_name and chapter_count. (The sub_book_name will be null for a book39 that is not a sub-book, i.e. a book39 that is also a book24.)
consumer_notice object Guidance for people and programs using the data, with a summary, a nonempty array of critical_rules, and the absolute URL of the notes for applications.

Here’s the header for Job, a book24 that has no sub-books:

{
  "book24_name": "ספר איוב",
  "sub_book_names": [],
  "chapter_counts": [
    {
      "sub_book_name": null,
      "chapter_count": 42
    }
  ],
  "consumer_notice": {...}
}

Here’s the header for Samuel, a book24 that has sub-books:

{
  "book24_name": "ספר שמואל",
  "sub_book_names": [
    "שמ\"א",
    "שמ\"ב"
  ],
  "chapter_counts": [
    {
      "sub_book_name": "שמ\"א",
      "chapter_count": 31
    },
    {
      "sub_book_name": "שמ\"ב",
      "chapter_count": 24
    }
  ],
  "consumer_notice": {...}
}

Book39 structure

{
  "book24_name": "ספר ישעיהו",
  "sub_book_name": null,
  "chapters": {...},
  "good_ending_plus": {...}
}
Key Type Description
book24_name string For a book39 that is not a sub-book, this is its name. For a book39 that is a sub-book, this is the name of the book24 to which this sub-book belongs.
sub_book_name string | null For a book39 that is not a sub-book, this is null. For a book39 that is a sub-book, this is its name.
chapters object Object keyed by chapter numbers; values are chapter objects.
good_ending_plus object | null Non-null only for the 4 book39s with "good endings." See its dedicated page.

Chapter structure

The chapters object is keyed by verse numbers. For example, a chapter with 22 verses has exactly 22 keys, "1" through "22".

Template format

Templates are represented like this:

{
  "tmpl_name": "קו״כ",
  "tmpl_params": {"1": "את", "2": "אַ֠תָּ֠ה"}
}
Key Type Description
tmpl_name string Template name
tmpl_params object Parameters — present only if needed

Numeric string keys "1", "2", … correspond to positional arguments, Non-numeric keys (e.g. "ד", "ס", "סדר") represent named parameters like ד=... in the Wikitext.

The tmpl_params object is absent when the template has no parameters (e.g. פפ, סס, מ:פסק).

Template parameter values can be complex

Parameter values can themselves be strings, nested template objects, or arrays mixing strings and templates. See the dedicated page on template nesting.

Example — a word with a special letter inside a ketiv/qere inside a נוסח:

{
  "tmpl_name": "נוסח",
  "tmpl_params": {
    "1": {
      "tmpl_name": "כו״ק",
      "tmpl_params": {
        "1": {
          "tmpl_name": "מ:אות-מיוחדת-במילה",
          "tmpl_params": {...}
        },
        "2": "וְג֣וּשׁ"
      }
    },
    "2": ...
  }
}

Verse structure

Each verse is a 3-element array for the separator, verse label, and verse proper. These positions retain the C, D, and E names used by a now-obsolete spreadsheet version of MAM.

C column (index 0): Verse separator

Column C is an array indicating how this verse is separated from the preceding verse:

D column (index 1): Verse label

Column D is an array that, if not empty, contains exactly one element: either a מ:פסוק template or מ:פסוק wrapped in a נוסח template. Column D is sparse: it omits source boundary records that do not supply retained label data:

For example, here is the D column value for Job 1:1, kept because of its סדר param:

[{
  "tmpl_name": "מ:פסוק",
  "tmpl_params": {"1": "איוב", "2": "א", "3": "א", "סדר": "א"}
}]

E column (index 2): Verse proper

Column E is an array mixing strings and templates. Example (Job 1:1):

[
  "אִ֛ישׁ הָיָ֥ה בְאֶֽרֶץ־ע֖וּץ אִיּ֣וֹב שְׁמ֑וֹ וְהָיָ֣ה",
  {"tmpl_name": "מ:לגרמיה-2"},
  " הָאִ֣ישׁ הַה֗וּא תָּ֧ם וְיָשָׁ֛ר וִירֵ֥א אֱלֹהִ֖ים וְסָ֥ר מֵרָֽע׃"
]

Selected templates

The following sections describe the templates selected for this data format. Hebrew Wikisource is the maintained textual source.

Verse label templates

Template Purpose
מ:פסוק Verse label. Takes book name, chapter, and verse as positional params. Optional named params include סדר= (seder number) and עלייה= (value is a מ:עלייה template).
מ:עלייה Torah aliyah identifier. See notes on aliyot.

Ketiv/qere templates

Template Purpose
כו״ק Standard ketiv/qere. Param 1 = unpointed ketiv, param 2 = pointed qere.
קו״כ Qere-first ketiv/qere. Param 1 = unpointed ketiv, param 2 = pointed qere, as in כו״ק, but MAM's rendered Wikisource page has the qere first, then the ketiv. Used where the pair follows a maqaf, and in three verses where the pair follows a narrow-sense paseq (מ:פסק): 1 Samuel 2:16, Jeremiah 4:19 and Ezekiel 35:12.
מ:קו״כ-אם-2 Trivial ketiv/qere. Param 1 = pointed ketiv, param 2 = unpointed ketiv, param 3 = pointed qere. See its dedicated page.
כתיב ולא קרי Ketiv without qere. Param 1 = the ketiv.
קרי ולא כתיב Qere without ketiv. Param 1 = the qere.
מ:כו״ק מיוחד Special ketiv/qere. See its dedicated page.

Example of standard ketiv/qere (Genesis 8:17):

{
    "tmpl_name": "כו״ק",
    "tmpl_params": {"1": "הוצא", "2": "הַיְצֵ֣א"}
}

Special letter templates

Template Purpose
מ:אות-ג
מ:אות-ק
מ:אות תלויה
Large, small, or hung letter. Parameter is the letter along with any diacritical marks.
מ:נו״ן הפוכה Reversed (inverted) nun.
מ:אות-מיוחדת-במילה Marks a whole word containing a special letter. (By “special” we mean large, small, or hung.) See its dedicated page.

Punctuation templates

Template Purpose
מ:לגרמיה-2 Legarmeh. The vertical line ׀ as legarmeh (part of the word’s cantillation). Shares Unicode with paseq but differs in function.
מ:פסק Paseq. The vertical line ׀ as paseq in the narrow sense, i.e. paseq as distinct from legarmeh. Narpas forms no compound of any kind; only maqaf joins atoms into a chanted word. MAM stores this template with no text whitespace before or after it to avoid prescribing display spacing, not to group the surrounding text.
מ:מקף אפור Gray maqaf. A maqaf that is only implicit in the manuscript. Appears only in poetic verses.

Choice templates

Most applications will need to make a choice between the two or three options presented by these templates.

Template Purpose
מ:דחי
מ:צינור
Deḥi and tsinnor variation. Presents both stress-helped and non-stress-helped versions of a word.
מ:קמץ Qamats variation. Named params: ד= (grammatical) and ס= (Sephardic tradition).
מ:כפול Dual-trope span. See its dedicated page.

Whitespace templates

A whitespace template can be the only separator between adjacent Scripture strings: the strings before and after מ:ששש or ססס can contain no literal whitespace at that boundary. A plain-text projection that does not preserve layout must therefore supply at least one separator; a layout-preserving renderer implements the documented space or break. Dropping the template fuses separate atoms, while collecting a descriptive parameter such as פסקא באמצע פסוק inserts documentation into Scripture. This rule does not apply to narpas: מ:פסק is a punctuation template, and its missing literal whitespace prescribes no display spacing.

Template Purpose
פפ / פפפ / סס / ססס Parashah petuḥah / setumah variants. When any of these appears within a verse (rather than between verses), it takes the argument פסקא באמצע פסוק.
מ:ששש Setumah-like section divider for the 8 shirah (song) sections in the 21 prose books; analogous to ססס.
ר0–ר4 Poetic spacing: See their dedicated page.
מ:ספר חדש New-book marker. Placed at the start of each of the 24 books. Parameter is the book name.
מ:רווח בתרי עשר
בפסוק הראשון
First-verse spacing marker for minor-prophetic book-parts. Parameter is the prophet name.
מ:רווח לספר בתהלים
בפסוק הראשון
First-verse spacing marker for each Psalms division. Parameter is the division designation (e.g. ספר שני).

Many editions will choose to skip poetic formatting by treating ר0–ר4 as simple word spaces.

Lack-of-whitespace templates

Template Purpose
מ:אין פרשה ... פרק No-parashah chapter start (21 books). Tags chapters that begin without a coinciding parashah division, so a space can be added before the first verse when presenting sequential text.
מ:אין פרשה ... אמ״ת No-parashah chapter start (poetic books). Analogous to the previous template for Ps, Prov, and Job; redirects to ר4.
מ:אין רווח ... השבוע No-parashah weekly-portion start. Used only at Gen 47:28 (the only Torah weekly portion that begins without a parashah).

Note template

Template Purpose
מ:הערה-2 Targeted scroll-difference note (Torah and Esther only). See dedicated page for מ:הערה-2.

Documentation templates

Template Purpose
נוסח Documentation template. See its dedicated page.
ש Paragraph separator within the notes argument (param 2) of נוסח.
מודגש Bold styling within the notes argument (param 2) of נוסח.
מ:קישור בהערה External URL link within the notes argument (param 2) of נוסח.
מ:קישור פנימי בהערה Internal Wikisource link within the notes argument (param 2) of נוסח.

In this table, מ:קישור פנימי בהערה param 1 is a Wikisource-internal target (path or fragment) rendered under https://he.wikisource.org/wiki/; מ:קישור בהערה param 1 is an external URL used as-is.

Notes for applications

The notes below are for writers of programs that read ("consume") the JSON data. Such programs are the "consumers" named by the header.consumer_notice field. The notes are as follows:

This is a structured dataset, not ready-to-display Scripture; interpret each structure by its documented role and choose a projection wherever the payload presents alternatives.

Every generated MAM-parsed/plus/*.json file includes these notes in header.consumer_notice. Its documentation field is an absolute URL to this section.