engine: a word's root is what L1 records for it (tablet 33)
The Shoresh Engine never opened L1 to find a root. extractRoots called every word of two or three letters a root and dropped every longer one: את → א-ת-ה (padded with a He the text never wrote), ואת → ו-א-ת, בכל → ב-כ-ל; ויאמר, ואהבת, אלהים → nothing. Handed all of Devarim 6:5 it found no א-ה-ב. Binyan was "Qal" for everything, nouns included. shoresh-engine: - Shoresh.Roots: an index over all of L1 (5853 verses, built once at server start, <1 s). A word resolves, in order: from the verse in scope (its own shoresh, with the binyan read from the verb's morphology; else its lemma's shoresh — לבבך → לבב); else the way Torah most often reads that surface form (its commonest lemma decides, so אשר the particle has no root); else a root the asker named, if Torah knows it. A word in the verse that L1 gives no root has none, whatever a homograph elsewhere carries. Unknown words yield nothing. - Roots are rendered as L1 records them: two letters stay two letters. - binyan is null unless a verb stands in the scoped verse. - L1 is found via L1_MOUNT_POINT, not the literal l1/ relative to cwd — which is why parse_tree was null on the pod. - Adds "surface" and "derivation" to each root (verse|lemma|torah| named_root). 22 new HSpec examples; 55 examples, 0 failures. vav_pipeline: - normalize_root places a lemma-derived root at the word it was heard from (L1 has no shoresh on לבבך to search by). - A binyan is printed only where there is one; "binyan unknown" on a noun claimed a question that does not exist. - test/tablet33_engine_roots_test.exs: the new shape through the router. - liveness_test: clear a halt leaked by halt_monitor_test (the seed 0/191243 flake, present since before tablet 30). 461 tests, 0 failures on seeds 0 42 191243. Verified before push with BOTH built images, the real engine binary and a local PostgreSQL 16 (SSL): Devarim 6:5 → א-ה-ב (Qal, word 1), י-ה-ו, א-ל-ה, כ-ל (words 5,7,9), ל-ב-ב, נ-פ-ש, מ-א-ד; 4 interpretations written to L3, 0 L3_WRITE_FAILED, health healthy. NOT repaired here: the quality of L1's own shoresh field, which the engine is now faithful to — ויהי is recorded as יהי, שמים as שמ, יהוה as יהו, הבאתי as בא. That is the quarry's tablet (scripts/build_l1.py) and it changes the L1 hash; a decision, not a patch. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
83fa5ac46b
commit
6d3411fcfa
7 files changed
+683
-69
No files matched your search
@@ -365,7 +365,13 @@ defmodule VavPipeline.BereishitCycle do
|
||||
ps -> "word " <> Enum.join(Enum.map(ps, &to_string/1), ", ")
|
||||
end
|
||||
|
||||
"#{hyphenate(r.shoresh)} (gematria #{r.gematria}, #{r.binyan || "binyan unknown"}, #{where})"
|
||||
# A binyan is said only where the engine read one off a verb in
|
||||
# this verse. A noun has none; saying "unknown" (or, before
|
||||
# tablet 33, "Qal" for everything) claims a question that does
|
||||
# not exist.
|
||||
binyan = if r.binyan, do: "#{r.binyan}, ", else: ""
|
||||
|
||||
"#{hyphenate(r.shoresh)} (gematria #{r.gematria}, #{binyan}#{where})"
|
||||
end)
|
||||
|
||||
group_line =
|
||||
@@ -891,10 +897,20 @@ defmodule VavPipeline.BereishitCycle do
|
||||
Map.get(root, "shoresh_hebrew") ||
|
||||
letters_to_hebrew(Map.get(root, "shoresh"))
|
||||
|
||||
# Where the root stands in the verse: every word L1 gives this
|
||||
# shoresh, and — for a root the engine heard through a word's lemma
|
||||
# (לבבך → לבב; L1 records no shoresh on the suffixed noun itself) —
|
||||
# the word it was heard from (tablet 33).
|
||||
positions =
|
||||
case shoresh do
|
||||
nil -> []
|
||||
s -> verse_positions_for(s, context)
|
||||
nil ->
|
||||
[]
|
||||
|
||||
s ->
|
||||
(verse_positions_for(s, context) ++
|
||||
surface_positions_for(Map.get(root, "surface"), context))
|
||||
|> Enum.uniq()
|
||||
|> Enum.sort()
|
||||
end
|
||||
|
||||
given_position = Map.get(root, :position)
|
||||
@@ -906,7 +922,8 @@ defmodule VavPipeline.BereishitCycle do
|
||||
binyan: Map.get(root, :binyan) || Map.get(root, "binyan"),
|
||||
domain: Map.get(root, :domain) || Map.get(root, "domain"),
|
||||
torah_refs: Map.get(root, :torah_refs) || Map.get(root, "torah_refs") || [],
|
||||
word: Map.get(root, :word),
|
||||
word: Map.get(root, :word) || Map.get(root, "surface"),
|
||||
derivation: Map.get(root, "derivation"),
|
||||
morph: Map.get(root, :morph),
|
||||
positions: positions,
|
||||
position: given_position || List.first(positions),
|
||||
@@ -924,6 +941,14 @@ defmodule VavPipeline.BereishitCycle do
|
||||
|> Enum.sort()
|
||||
end
|
||||
|
||||
defp surface_positions_for(nil, _context), do: []
|
||||
|
||||
defp surface_positions_for(surface, context) do
|
||||
(get_in(context, [:verse, :words]) || [])
|
||||
|> Enum.filter(fn w -> w.consonants == surface end)
|
||||
|> Enum.map(& &1.position)
|
||||
end
|
||||
|
||||
# The engine's "shoresh" is a list of consonant NAMES ("bet","resh",
|
||||
# "aleph"). shoresh_hebrew is the authoritative Hebrew form and is
|
||||
# always present in practice; this is a last resort that never
|
||||
|
||||
Reference in new issue
Block a user