L1 data integrity: preserve the edut whole — Shema, middle letter, ketiv/qere, smikhut

Shemot 25:16 — v'natata el ha-aron et ha-edut asher eten elekha.
The edut placed in the aron must be complete. The Masoretic
tradition preserves every letter, every enlarged letter, every
ketiv/qere pair — because each carries meaning the scribe cannot
reconstruct.

The previous build_l1.py silently dropped:
- enlarged letters encoded as <seg type="x-large"> nested in <w>
  → the Shema was corrupt: שמ instead of שמע, אח instead of אחד
  → the middle letter of Torah was corrupt: גח instead of גחון
  → the Zelophchad nun was missing: משפט instead of משפטן
- ketiv/qere dual readings encoded as <note type="variant">/<rdg type="x-qere">
  → the spec committed to preserving both; the code returned []
- smikhut (construct state) pairs marked in morphology codes
  → the spec committed to extracting them; the code returned []

Fixes:
- collect_word_text() walks all nested <seg> children of <w> and records
  large_letters / small_letters metadata with character offsets.
- parse_verse() recognizes <w type="x-ketiv"> followed by <note>, extracts
  both the ketiv and the qere readings, stores a ketiv_qere list on the verse.
- _extract_smikhut() scans words for construct-state morph codes
  (ending in "c" on N/A primary segments, excluding pronominal suffixes)
  and records construct/absolute pairs.
- L1 SHA-256 hash updated everywhere: integrity.sha256, l1_reader.ex,
  shoresh-engine's Luchot.Firmware, its test, KOHEN.md.

Torah-wide results after fix:
- 4 enlarged letters preserved (was 0): Shema ayin, Shema dalet,
  gachon vav (middle of Torah), Zelophchad nun
- 67 ketiv/qere pairs captured (was 0)
- 9,203 smikhut pairs extracted (was 0)

Elixir updates:
- l1_reader.ex: normalize_verse now surfaces ketiv_qere, smikhut,
  and per-word large_letters/small_letters. New type specs. New
  extract_large_letters/1 helper. extract_ketiv_qere and
  extract_smikhut now return real data instead of [].
- step31_shema_test.exs: replaced placeholder asserts with real
  integrity checks. Four new tests verify the Shema word is complete
  (שמע not שמ), echad is complete (אחד not אח), the enlarged
  letters are marked, the middle letter of Torah is preserved,
  and ketiv/qere pairs from Bereishit 8:17 are both captured.

Build script:
- build_l1.py no longer rmtrees the entire l1/ directory (preserves
  l1/README.md). Only regenerates torah/ + build_report.json +
  integrity.sha256.
- Accepts SHORASHIM_SOURCE_DATA env var or CLI arg for morphhb path.

Test counts:
- Elixir: 260 (was 254), 0 failures
- Haskell: 33, 0 failures
- Prolog: 195, 0 failures

The system that can hear שמע correctly has passed its own shema test.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Scott KarpandClaude Opus 4.6 committed 2026-04-21 13:11:52 -04:00
1 parent 04713cc884
commit d4d0a6fcb6
4137 files changed
+73656 -85

No files matched your search

+9
View File
@@ -197,5 +197,14 @@
],
"prefix": "ו"
}
],
"smikhut": [
{
"position": 13,
"construct": "אֱלֹהֵ֣י",
"construct_consonants": "אלהי",
"absolute": "הָֽעִבְרִ֔ים",
"absolute_consonants": "העברים"
}
]
}
+16
View File
@@ -197,5 +197,21 @@
"prefix": "וב",
"shoresh": "בהמ"
}
],
"smikhut": [
{
"position": 3,
"construct": "פִּ֣יחַ",
"construct_consonants": "פיח",
"absolute": "הַכִּבְשָׁ֗ן",
"absolute_consonants": "הכבשן"
},
{
"position": 6,
"construct": "לִפְנֵ֣י",
"construct_consonants": "לפני",
"absolute": "פַרְעֹ֔ה",
"absolute_consonants": "פרעה"
}
]
}
+23
View File
@@ -166,5 +166,28 @@
],
"shoresh": "מצר"
}
],
"smikhut": [
{
"position": 5,
"construct": "לִפְנֵ֥י",
"construct_consonants": "לפני",
"absolute": "מֹשֶׁ֖ה",
"absolute_consonants": "משה"
},
{
"position": 7,
"construct": "מִפְּנֵ֣י",
"construct_consonants": "מפני",
"absolute": "הַשְּׁחִ֑ין",
"absolute_consonants": "השחין"
},
{
"position": 13,
"construct": "וּבְכָל",
"construct_consonants": "ובכל",
"absolute": "מִצְרָֽיִם",
"absolute_consonants": "מצרים"
}
]
}
+9
View File
@@ -142,5 +142,14 @@
],
"shoresh": "משה"
}
],
"smikhut": [
{
"position": 4,
"construct": "לֵ֣ב",
"construct_consonants": "לב",
"absolute": "פַּרְעֹ֔ה",
"absolute_consonants": "פרעה"
}
]
}
+16
View File
@@ -225,5 +225,21 @@
],
"prefix": "ו"
}
],
"smikhut": [
{
"position": 8,
"construct": "לִפְנֵ֣י",
"construct_consonants": "לפני",
"absolute": "פַרְעֹ֑ה",
"absolute_consonants": "פרעה"
},
{
"position": 15,
"construct": "אֱלֹהֵ֣י",
"construct_consonants": "אלהי",
"absolute": "הָֽעִבְרִ֔ים",
"absolute_consonants": "העברים"
}
]
}
+23
View File
@@ -203,5 +203,28 @@
"prefix": "ה",
"shoresh": "ארץ"
}
],
"smikhut": [
{
"position": 7,
"construct": "כָּל",
"construct_consonants": "כל",
"absolute": "מַגֵּפֹתַי֙",
"absolute_consonants": "מגפתי"
},
{
"position": 13,
"construct": "בַּעֲב֣וּר",
"construct_consonants": "בעבור",
"absolute": "תֵּדַ֔ע",
"absolute_consonants": "תדע"
},
{
"position": 18,
"construct": "בְּכָל",
"construct_consonants": "בכל",
"absolute": "הָאָֽרֶץ",
"absolute_consonants": "הארץ"
}
]
}
+23
View File
@@ -143,5 +143,28 @@
"prefix": "ה",
"shoresh": "ארץ"
}
],
"smikhut": [
{
"position": 2,
"construct": "בַּעֲב֥וּר",
"construct_consonants": "בעבור",
"absolute": "זֹאת֙",
"absolute_consonants": "זאת"
},
{
"position": 5,
"construct": "בַּעֲב֖וּר",
"construct_consonants": "בעבור",
"absolute": "הַרְאֹתְךָ֣",
"absolute_consonants": "הראתך"
},
{
"position": 12,
"construct": "בְּכָל",
"construct_consonants": "בכל",
"absolute": "הָאָֽרֶץ",
"absolute_consonants": "הארץ"
}
]
}
+16
View File
@@ -257,5 +257,21 @@
"prefix": "ו",
"shoresh": "מתו"
}
],
"smikhut": [
{
"position": 7,
"construct": "כָּל",
"construct_consonants": "כל",
"absolute": "אֲשֶׁ֥ר",
"absolute_consonants": "אשר"
},
{
"position": 11,
"construct": "כָּל",
"construct_consonants": "כל",
"absolute": "הָאָדָ֨ם",
"absolute_consonants": "האדם"
}
]
}
+16
View File
@@ -139,5 +139,21 @@
"prefix": "ה",
"shoresh": "בת"
}
],
"smikhut": [
{
"position": 3,
"construct": "דְּבַ֣ר",
"construct_consonants": "דבר",
"absolute": "יְהוָ֔ה",
"absolute_consonants": "יהוה"
},
{
"position": 5,
"construct": "מֵֽעַבְדֵ֖י",
"construct_consonants": "מעבדי",
"absolute": "פַּרְעֹ֑ה",
"absolute_consonants": "פרעה"
}
]
}
+9
View File
@@ -137,5 +137,14 @@
"prefix": "ב",
"shoresh": "שדה"
}
],
"smikhut": [
{
"position": 6,
"construct": "דְּבַ֣ר",
"construct_consonants": "דבר",
"absolute": "יְהוָ֑ה",
"absolute_consonants": "יהוה"
}
]
}
+37
View File
@@ -257,5 +257,42 @@
],
"shoresh": "מצר"
}
],
"smikhut": [
{
"position": 12,
"construct": "בְּכָל",
"construct_consonants": "בכל",
"absolute": "אֶ֣רֶץ",
"absolute_consonants": "ארץ"
},
{
"position": 13,
"construct": "אֶ֣רֶץ",
"construct_consonants": "ארץ",
"absolute": "מִצְרָ֑יִם",
"absolute_consonants": "מצרים"
},
{
"position": 20,
"construct": "כָּל",
"construct_consonants": "כל",
"absolute": "עֵ֥שֶׂב",
"absolute_consonants": "עשב"
},
{
"position": 21,
"construct": "עֵ֥שֶׂב",
"construct_consonants": "עשב",
"absolute": "הַשָּׂדֶ֖ה",
"absolute_consonants": "השדה"
},
{
"position": 23,
"construct": "בְּאֶ֥רֶץ",
"construct_consonants": "בארץ",
"absolute": "מִצְרָֽיִם",
"absolute_consonants": "מצרים"
}
]
}
+9
View File
@@ -210,5 +210,14 @@
],
"shoresh": "מצר"
}
],
"smikhut": [
{
"position": 18,
"construct": "אֶ֥רֶץ",
"construct_consonants": "ארץ",
"absolute": "מִצְרָֽיִם",
"absolute_consonants": "מצרים"
}
]
}
+23
View File
@@ -206,5 +206,28 @@
"prefix": "ל",
"shoresh": "גוי"
}
],
"smikhut": [
{
"position": 5,
"construct": "בְּת֣וֹךְ",
"construct_consonants": "בתוך",
"absolute": "הַבָּרָ֑ד",
"absolute_consonants": "הברד"
},
{
"position": 13,
"construct": "בְּכָל",
"construct_consonants": "בכל",
"absolute": "אֶ֣רֶץ",
"absolute_consonants": "ארץ"
},
{
"position": 14,
"construct": "אֶ֣רֶץ",
"construct_consonants": "ארץ",
"absolute": "מִצְרַ֔יִם",
"absolute_consonants": "מצרים"
}
]
}
+51
View File
@@ -252,5 +252,56 @@
],
"shoresh": "שבר"
}
],
"smikhut": [
{
"position": 3,
"construct": "בְּכָל",
"construct_consonants": "בכל",
"absolute": "אֶ֣רֶץ",
"absolute_consonants": "ארץ"
},
{
"position": 4,
"construct": "אֶ֣רֶץ",
"construct_consonants": "ארץ",
"absolute": "מִצְרַ֗יִם",
"absolute_consonants": "מצרים"
},
{
"position": 7,
"construct": "כָּל",
"construct_consonants": "כל",
"absolute": "אֲשֶׁ֣ר",
"absolute_consonants": "אשר"
},
{
"position": 14,
"construct": "כָּל",
"construct_consonants": "כל",
"absolute": "עֵ֤שֶׂב",
"absolute_consonants": "עשב"
},
{
"position": 15,
"construct": "עֵ֤שֶׂב",
"construct_consonants": "עשב",
"absolute": "הַשָּׂדֶה֙",
"absolute_consonants": "השדה"
},
{
"position": 20,
"construct": "כָּל",
"construct_consonants": "כל",
"absolute": "עֵ֥ץ",
"absolute_consonants": "עץ"
},
{
"position": 21,
"construct": "עֵ֥ץ",
"construct_consonants": "עץ",
"absolute": "הַשָּׂדֶ֖ה",
"absolute_consonants": "השדה"
}
]
}
+16
View File
@@ -111,5 +111,21 @@
],
"shoresh": "ברד"
}
],
"smikhut": [
{
"position": 2,
"construct": "בְּאֶ֣רֶץ",
"construct_consonants": "בארץ",
"absolute": "גֹּ֔שֶׁן",
"absolute_consonants": "גשן"
},
{
"position": 6,
"construct": "בְּנֵ֣י",
"construct_consonants": "בני",
"absolute": "יִשְׂרָאֵ֑ל",
"absolute_consonants": "ישראל"
}
]
}
+9
View File
@@ -150,5 +150,14 @@
"prefix": "ל",
"shoresh": "עמד"
}
],
"smikhut": [
{
"position": 6,
"construct": "קֹלֹ֥ת",
"construct_consonants": "קלת",
"absolute": "אֱלֹהִ֖ים",
"absolute_consonants": "אלהים"
}
]
}
+9
View File
@@ -173,5 +173,14 @@
],
"shoresh": "מאד"
}
],
"smikhut": [
{
"position": 2,
"construct": "יַד",
"construct_consonants": "יד",
"absolute": "יְהוָ֜ה",
"absolute_consonants": "יהוה"
}
]
}
+9
View File
@@ -104,5 +104,14 @@
],
"shoresh": "אלה"
}
],
"smikhut": [
{
"position": 7,
"construct": "מִפְּנֵ֖י",
"construct_consonants": "מפני",
"absolute": "יְהוָ֥ה",
"absolute_consonants": "יהוה"
}
]
}
+23
View File
@@ -146,5 +146,28 @@
],
"shoresh": "משה"
}
],
"smikhut": [
{
"position": 2,
"construct": "לֵ֣ב",
"construct_consonants": "לב",
"absolute": "פַּרְעֹ֔ה",
"absolute_consonants": "פרעה"
},
{
"position": 7,
"construct": "בְּנֵ֣י",
"construct_consonants": "בני",
"absolute": "יִשְׂרָאֵ֑ל",
"absolute_consonants": "ישראל"
},
{
"position": 12,
"construct": "בְּיַד",
"construct_consonants": "ביד",
"absolute": "מֹשֶֽׁה",
"absolute_consonants": "משה"
}
]
}
+23
View File
@@ -159,5 +159,28 @@
],
"shoresh": "דבר"
}
],
"smikhut": [
{
"position": 4,
"construct": "מִקְנֵ֣ה",
"construct_consonants": "מקנה",
"absolute": "יִשְׂרָאֵ֔ל",
"absolute_consonants": "ישראל"
},
{
"position": 7,
"construct": "מִקְנֵ֣ה",
"construct_consonants": "מקנה",
"absolute": "מִצְרָ֑יִם",
"absolute_consonants": "מצרים"
},
{
"position": 12,
"construct": "לִבְנֵ֥י",
"construct_consonants": "לבני",
"absolute": "יִשְׂרָאֵ֖ל",
"absolute_consonants": "ישראל"
}
]
}
+30
View File
@@ -181,5 +181,35 @@
],
"shoresh": "אחד"
}
],
"smikhut": [
{
"position": 8,
"construct": "כֹּ֖ל",
"construct_consonants": "כל",
"absolute": "מִקְנֵ֣ה",
"absolute_consonants": "מקנה"
},
{
"position": 9,
"construct": "מִקְנֵ֣ה",
"construct_consonants": "מקנה",
"absolute": "מִצְרָ֑יִם",
"absolute_consonants": "מצרים"
},
{
"position": 11,
"construct": "וּמִמִּקְנֵ֥ה",
"construct_consonants": "וממקנה",
"absolute": "בְנֵֽי",
"absolute_consonants": "בני"
},
{
"position": 12,
"construct": "בְנֵֽי",
"construct_consonants": "בני",
"absolute": "יִשְׂרָאֵ֖ל",
"absolute_consonants": "ישראל"
}
]
}
+16
View File
@@ -176,5 +176,21 @@
"prefix": "ה",
"shoresh": "עם"
}
],
"smikhut": [
{
"position": 6,
"construct": "מִמִּקְנֵ֥ה",
"construct_consonants": "ממקנה",
"absolute": "יִשְׂרָאֵ֖ל",
"absolute_consonants": "ישראל"
},
{
"position": 11,
"construct": "לֵ֣ב",
"construct_consonants": "לב",
"absolute": "פַּרְעֹ֔ה",
"absolute_consonants": "פרעה"
}
]
}
+23
View File
@@ -189,5 +189,28 @@
],
"shoresh": "פרע"
}
],
"smikhut": [
{
"position": 9,
"construct": "מְלֹ֣א",
"construct_consonants": "מלא",
"absolute": "חָפְנֵיכֶ֔ם",
"absolute_consonants": "חפניכם"
},
{
"position": 11,
"construct": "פִּ֖יחַ",
"construct_consonants": "פיח",
"absolute": "כִּבְשָׁ֑ן",
"absolute_consonants": "כבשן"
},
{
"position": 16,
"construct": "לְעֵינֵ֥י",
"construct_consonants": "לעיני",
"absolute": "פַרְעֹֽה",
"absolute_consonants": "פרעה"
}
]
}
+30
View File
@@ -189,5 +189,35 @@
],
"shoresh": "מצר"
}
],
"smikhut": [
{
"position": 4,
"construct": "כָּל",
"construct_consonants": "כל",
"absolute": "אֶ֣רֶץ",
"absolute_consonants": "ארץ"
},
{
"position": 5,
"construct": "אֶ֣רֶץ",
"construct_consonants": "ארץ",
"absolute": "מִצְרָ֑יִם",
"absolute_consonants": "מצרים"
},
{
"position": 15,
"construct": "בְּכָל",
"construct_consonants": "בכל",
"absolute": "אֶ֥רֶץ",
"absolute_consonants": "ארץ"
},
{
"position": 16,
"construct": "אֶ֥רֶץ",
"construct_consonants": "ארץ",
"absolute": "מִצְרָֽיִם",
"absolute_consonants": "מצרים"
}
]
}