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

+30
View File
@@ -136,5 +136,35 @@
"prefix": "ו",
"shoresh": "אהר"
}
],
"smikhut": [
{
"position": 2,
"construct": "מַסְעֵ֣י",
"construct_consonants": "מסעי",
"absolute": "בְנֵֽי",
"absolute_consonants": "בני"
},
{
"position": 3,
"construct": "בְנֵֽי",
"construct_consonants": "בני",
"absolute": "יִשְׂרָאֵ֗ל",
"absolute_consonants": "ישראל"
},
{
"position": 7,
"construct": "מֵאֶ֥רֶץ",
"construct_consonants": "מארץ",
"absolute": "מִצְרַ֖יִם",
"absolute_consonants": "מצרים"
},
{
"position": 10,
"construct": "בְּיַד",
"construct_consonants": "ביד",
"absolute": "מֹשֶׁ֖ה",
"absolute_consonants": "משה"
}
]
}
+9
View File
@@ -70,5 +70,14 @@
],
"shoresh": "סוף"
}
],
"smikhut": [
{
"position": 5,
"construct": "יַם",
"construct_consonants": "ים",
"absolute": "סֽוּף",
"absolute_consonants": "סוף"
}
]
}
+16
View File
@@ -72,5 +72,21 @@
],
"shoresh": "סין"
}
],
"smikhut": [
{
"position": 2,
"construct": "מִיַּם",
"construct_consonants": "מים",
"absolute": "ס֑וּף",
"absolute_consonants": "סוף"
},
{
"position": 5,
"construct": "בְּמִדְבַּר",
"construct_consonants": "במדבר",
"absolute": "סִֽין",
"absolute_consonants": "סין"
}
]
}
+9
View File
@@ -63,5 +63,14 @@
"prefix": "ב",
"shoresh": "דפק"
}
],
"smikhut": [
{
"position": 2,
"construct": "מִמִּדְבַּר",
"construct_consonants": "ממדבר",
"absolute": "סִ֑ין",
"absolute_consonants": "סין"
}
]
}
+9
View File
@@ -65,5 +65,14 @@
],
"shoresh": "סינ"
}
],
"smikhut": [
{
"position": 4,
"construct": "בְּמִדְבַּ֥ר",
"construct_consonants": "במדבר",
"absolute": "סִינָֽי",
"absolute_consonants": "סיני"
}
]
}
+9
View File
@@ -77,5 +77,14 @@
],
"shoresh": "התא"
}
],
"smikhut": [
{
"position": 2,
"construct": "מִמִּדְבַּ֣ר",
"construct_consonants": "ממדבר",
"absolute": "סִינָ֑י",
"absolute_consonants": "סיני"
}
]
}
+9
View File
@@ -119,5 +119,14 @@
],
"prefix": "ל"
}
],
"smikhut": [
{
"position": 7,
"construct": "פִּ֣י",
"construct_consonants": "פי",
"absolute": "יְהוָ֑ה",
"absolute_consonants": "יהוה"
}
]
}
+9
View File
@@ -63,5 +63,14 @@
],
"shoresh": "שפר"
}
],
"smikhut": [
{
"position": 4,
"construct": "בְּהַר",
"construct_consonants": "בהר",
"absolute": "שָֽׁפֶר",
"absolute_consonants": "שפר"
}
]
}
+9
View File
@@ -65,5 +65,14 @@
"prefix": "ב",
"shoresh": "חרד"
}
],
"smikhut": [
{
"position": 2,
"construct": "מֵֽהַר",
"construct_consonants": "מהר",
"absolute": "שָׁ֑פֶר",
"absolute_consonants": "שפר"
}
]
}
+30
View File
@@ -226,5 +226,35 @@
],
"shoresh": "מצר"
}
],
"smikhut": [
{
"position": 10,
"construct": "מִֽמָּחֳרַ֣ת",
"construct_consonants": "ממחרת",
"absolute": "הַפֶּ֗סַח",
"absolute_consonants": "הפסח"
},
{
"position": 13,
"construct": "בְנֵֽי",
"construct_consonants": "בני",
"absolute": "יִשְׂרָאֵל֙",
"absolute_consonants": "ישראל"
},
{
"position": 17,
"construct": "לְעֵינֵ֖י",
"construct_consonants": "לעיני",
"absolute": "כָּל",
"absolute_consonants": "כל"
},
{
"position": 18,
"construct": "כָּל",
"construct_consonants": "כל",
"absolute": "מִצְרָֽיִם",
"absolute_consonants": "מצרים"
}
]
}
+9
View File
@@ -94,5 +94,14 @@
],
"shoresh": "קדש"
}
],
"smikhut": [
{
"position": 5,
"construct": "בְמִדְבַּר",
"construct_consonants": "במדבר",
"absolute": "צִ֖ן",
"absolute_consonants": "צן"
}
]
}
+16
View File
@@ -100,5 +100,21 @@
],
"shoresh": "אדו"
}
],
"smikhut": [
{
"position": 6,
"construct": "בִּקְצֵ֖ה",
"construct_consonants": "בקצה",
"absolute": "אֶ֥רֶץ",
"absolute_consonants": "ארץ"
},
{
"position": 7,
"construct": "אֶ֥רֶץ",
"construct_consonants": "ארץ",
"absolute": "אֱדֽוֹם",
"absolute_consonants": "אדום"
}
]
}
+30
View File
@@ -254,5 +254,35 @@
"prefix": "ל",
"shoresh": "חדש"
}
],
"smikhut": [
{
"position": 8,
"construct": "פִּ֥י",
"construct_consonants": "פי",
"absolute": "יְהוָ֖ה",
"absolute_consonants": "יהוה"
},
{
"position": 12,
"construct": "בִּשְׁנַ֣ת",
"construct_consonants": "בשנת",
"absolute": "הָֽאַרְבָּעִ֗ים",
"absolute_consonants": "הארבעים"
},
{
"position": 15,
"construct": "בְּנֵֽי",
"construct_consonants": "בני",
"absolute": "יִשְׂרָאֵל֙",
"absolute_consonants": "ישראל"
},
{
"position": 17,
"construct": "מֵאֶ֣רֶץ",
"construct_consonants": "מארץ",
"absolute": "מִצְרַ֔יִם",
"absolute_consonants": "מצרים"
}
]
}
+16
View File
@@ -107,5 +107,21 @@
"prefix": "ה",
"shoresh": "הר"
}
],
"smikhut": [
{
"position": 2,
"construct": "בֶּן",
"construct_consonants": "בן",
"absolute": "שָׁלֹ֧שׁ",
"absolute_consonants": "שלש"
},
{
"position": 5,
"construct": "וּמְאַ֖ת",
"construct_consonants": "ומאת",
"absolute": "שָׁנָ֑ה",
"absolute_consonants": "שנה"
}
]
}
+9
View File
@@ -145,5 +145,14 @@
],
"shoresh": "שפט"
}
],
"smikhut": [
{
"position": 8,
"construct": "כָּל",
"construct_consonants": "כל",
"absolute": "בְּכ֑וֹר",
"absolute_consonants": "בכור"
}
]
}
+23
View File
@@ -143,5 +143,28 @@
],
"shoresh": "ישר"
}
],
"smikhut": [
{
"position": 3,
"construct": "מֶ֣לֶךְ",
"construct_consonants": "מלך",
"absolute": "עֲרָ֔ד",
"absolute_consonants": "ערד"
},
{
"position": 8,
"construct": "בְּאֶ֣רֶץ",
"construct_consonants": "בארץ",
"absolute": "כְּנָ֑עַן",
"absolute_consonants": "כנען"
},
{
"position": 11,
"construct": "בְּנֵ֥י",
"construct_consonants": "בני",
"absolute": "יִשְׂרָאֵֽל",
"absolute_consonants": "ישראל"
}
]
}
+9
View File
@@ -88,5 +88,14 @@
],
"shoresh": "מוא"
}
],
"smikhut": [
{
"position": 6,
"construct": "בִּגְב֥וּל",
"construct_consonants": "בגבול",
"absolute": "מוֹאָֽב",
"absolute_consonants": "מואב"
}
]
}
+16
View File
@@ -99,5 +99,21 @@
],
"shoresh": "נבו"
}
],
"smikhut": [
{
"position": 5,
"construct": "בְּהָרֵ֥י",
"construct_consonants": "בהרי",
"absolute": "הָעֲבָרִ֖ים",
"absolute_consonants": "העברים"
},
{
"position": 7,
"construct": "לִפְנֵ֥י",
"construct_consonants": "לפני",
"absolute": "נְבֽוֹ",
"absolute_consonants": "נבו"
}
]
}
+16
View File
@@ -110,5 +110,21 @@
],
"shoresh": "ירח"
}
],
"smikhut": [
{
"position": 2,
"construct": "מֵהָרֵ֣י",
"construct_consonants": "מהרי",
"absolute": "הָעֲבָרִ֑ים",
"absolute_consonants": "העברים"
},
{
"position": 5,
"construct": "בְּעַֽרְבֹ֣ת",
"construct_consonants": "בערבת",
"absolute": "מוֹאָ֔ב",
"absolute_consonants": "מואב"
}
]
}
+9
View File
@@ -116,5 +116,14 @@
],
"shoresh": "מוא"
}
],
"smikhut": [
{
"position": 9,
"construct": "בְּעַֽרְבֹ֖ת",
"construct_consonants": "בערבת",
"absolute": "מוֹאָֽב",
"absolute_consonants": "מואב"
}
]
}
+9
View File
@@ -76,5 +76,14 @@
"prefix": "ב",
"shoresh": "סכת"
}
],
"smikhut": [
{
"position": 2,
"construct": "בְנֵֽי",
"construct_consonants": "בני",
"absolute": "יִשְׂרָאֵ֖ל",
"absolute_consonants": "ישראל"
}
]
}
+9
View File
@@ -113,5 +113,14 @@
"prefix": "ל",
"shoresh": "אמר"
}
],
"smikhut": [
{
"position": 5,
"construct": "בְּעַֽרְבֹ֣ת",
"construct_consonants": "בערבת",
"absolute": "מוֹאָ֑ב",
"absolute_consonants": "מואב"
}
]
}
+16
View File
@@ -149,5 +149,21 @@
],
"shoresh": "כנע"
}
],
"smikhut": [
{
"position": 3,
"construct": "בְּנֵ֣י",
"construct_consonants": "בני",
"absolute": "יִשְׂרָאֵ֔ל",
"absolute_consonants": "ישראל"
},
{
"position": 13,
"construct": "אֶ֥רֶץ",
"construct_consonants": "ארץ",
"absolute": "כְּנָֽעַן",
"absolute_consonants": "כנען"
}
]
}
+37
View File
@@ -206,5 +206,42 @@
],
"shoresh": "שמי"
}
],
"smikhut": [
{
"position": 3,
"construct": "כָּל",
"construct_consonants": "כל",
"absolute": "יֹשְׁבֵ֤י",
"absolute_consonants": "ישבי"
},
{
"position": 9,
"construct": "כָּל",
"construct_consonants": "כל",
"absolute": "מַשְׂכִּיֹּתָ֑ם",
"absolute_consonants": "משכיתם"
},
{
"position": 12,
"construct": "כָּל",
"construct_consonants": "כל",
"absolute": "צַלְמֵ֤י",
"absolute_consonants": "צלמי"
},
{
"position": 13,
"construct": "צַלְמֵ֤י",
"construct_consonants": "צלמי",
"absolute": "מַסֵּֽכֹתָם֙",
"absolute_consonants": "מסכתם"
},
{
"position": 17,
"construct": "כָּל",
"construct_consonants": "כל",
"absolute": "בָּמֹתָ֖ם",
"absolute_consonants": "במתם"
}
]
}
+9
View File
@@ -258,5 +258,14 @@
],
"shoresh": "נחל"
}
],
"smikhut": [
{
"position": 22,
"construct": "לְמַטּ֥וֹת",
"construct_consonants": "למטות",
"absolute": "אֲבֹתֵיכֶ֖ם",
"absolute_consonants": "אבתיכם"
}
]
}
+9
View File
@@ -87,5 +87,14 @@
"prefix": "ה",
"shoresh": "מדב"
}
],
"smikhut": [
{
"position": 6,
"construct": "בִּקְצֵ֥ה",
"construct_consonants": "בקצה",
"absolute": "הַמִּדְבָּֽר",
"absolute_consonants": "המדבר"
}
]
}
+16
View File
@@ -160,5 +160,21 @@
],
"shoresh": "מגד"
}
],
"smikhut": [
{
"position": 9,
"construct": "פְּנֵ֖י",
"construct_consonants": "פני",
"absolute": "בַּ֣עַל",
"absolute_consonants": "בעל"
},
{
"position": 13,
"construct": "לִפְנֵ֥י",
"construct_consonants": "לפני",
"absolute": "מִגְדֹּֽל",
"absolute_consonants": "מגדל"
}
]
}
+37
View File
@@ -182,5 +182,42 @@
"prefix": "ב",
"shoresh": "מרה"
}
],
"smikhut": [
{
"position": 2,
"construct": "מִפְּנֵ֣י",
"construct_consonants": "מפני",
"absolute": "הַֽחִירֹ֔ת",
"absolute_consonants": "החירת"
},
{
"position": 5,
"construct": "בְתוֹךְ",
"construct_consonants": "בתוך",
"absolute": "הַיָּ֖ם",
"absolute_consonants": "הים"
},
{
"position": 9,
"construct": "דֶּ֣רֶךְ",
"construct_consonants": "דרך",
"absolute": "שְׁלֹ֤שֶׁת",
"absolute_consonants": "שלשת"
},
{
"position": 10,
"construct": "שְׁלֹ֤שֶׁת",
"construct_consonants": "שלשת",
"absolute": "יָמִים֙",
"absolute_consonants": "ימים"
},
{
"position": 12,
"construct": "בְּמִדְבַּ֣ר",
"construct_consonants": "במדבר",
"absolute": "אֵתָ֔ם",
"absolute_consonants": "אתם"
}
]
}
+9
View File
@@ -151,5 +151,14 @@
],
"shoresh": "שם"
}
],
"smikhut": [
{
"position": 8,
"construct": "עֵינֹ֥ת",
"construct_consonants": "עינת",
"absolute": "מַ֛יִם",
"absolute_consonants": "מים"
}
]
}