cycle: one root, once — a verse that repeats a word (tablet 32a)
Reading roots from the verse (tablet 32) met a verse that carries אור twice: the real engine answers per word and Bereishit 1:3 came back with א-ו-ר listed twice, each already carrying positions 4 and 6. uniq_by shoresh after normalization. Found by running the built image against the real shoresh-engine binary, not by the suite. 460 tests, 0 failures on seeds 0 42 99. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
a48c22c5a3
commit
83fa5ac46b
2 files changed
+17
-1
No files matched your search
@@ -156,7 +156,13 @@ defmodule VavPipeline.BereishitCycle do
|
|||||||
end
|
end
|
||||||
|
|
||||||
Map.merge(state, %{
|
Map.merge(state, %{
|
||||||
roots_activated: Enum.map(raw_roots, &normalize_root(&1, context, :engine)),
|
# A verse may carry the same word twice (אור in Bereishit 1:3);
|
||||||
|
# the engine answers per word, and each normalized root already
|
||||||
|
# lists every position. One root, once.
|
||||||
|
roots_activated:
|
||||||
|
raw_roots
|
||||||
|
|> Enum.map(&normalize_root(&1, context, :engine))
|
||||||
|
|> Enum.uniq_by(& &1.shoresh),
|
||||||
parse_tree: get_result(engine_result, :parse_tree, "parse_tree", nil),
|
parse_tree: get_result(engine_result, :parse_tree, "parse_tree", nil),
|
||||||
dual_readings: get_result(engine_result, :dual_readings, "dual_readings", []),
|
dual_readings: get_result(engine_result, :dual_readings, "dual_readings", []),
|
||||||
teamim_parse: context.teamim_marks,
|
teamim_parse: context.teamim_marks,
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ defmodule VavPipeline.Tablet32ReferenceTest do
|
|||||||
cond do
|
cond do
|
||||||
# Devarim 6:5 opens וְאָהַבְתָּ — the engine would find א-ה-ב.
|
# Devarim 6:5 opens וְאָהַבְתָּ — the engine would find א-ה-ב.
|
||||||
String.contains?(text, "ואהבת") -> [root(["aleph", "he", "bet"], "אהב", 8)]
|
String.contains?(text, "ואהבת") -> [root(["aleph", "he", "bet"], "אהב", 8)]
|
||||||
|
# A verse with a repeated word: the engine answers per word.
|
||||||
|
String.contains?(text, "אור ויהי אור") -> List.duplicate(root(["aleph", "vav", "resh"], "אור", 207), 2)
|
||||||
String.match?(text, ~r/[\x{05D0}-\x{05EA}]/u) -> [root(["bet", "resh", "aleph"], "ברא", 203)]
|
String.match?(text, ~r/[\x{05D0}-\x{05EA}]/u) -> [root(["bet", "resh", "aleph"], "ברא", 203)]
|
||||||
true -> []
|
true -> []
|
||||||
end
|
end
|
||||||
@@ -103,6 +105,14 @@ defmodule VavPipeline.Tablet32ReferenceTest do
|
|||||||
assert body["answer"] =~ "Devarim 6:5"
|
assert body["answer"] =~ "Devarim 6:5"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "a word the verse carries twice is one root, not two" do
|
||||||
|
conn = post_ask("bereishit 1:3")
|
||||||
|
body = Jason.decode!(conn.resp_body)
|
||||||
|
|
||||||
|
assert conn.status == 200
|
||||||
|
assert length(body["processing"]["roots_consulted"]) == 1
|
||||||
|
end
|
||||||
|
|
||||||
test "English around the reference changes nothing" do
|
test "English around the reference changes nothing" do
|
||||||
conn = post_ask("What does Deuteronomy 6:5 command?")
|
conn = post_ask("What does Deuteronomy 6:5 command?")
|
||||||
body = Jason.decode!(conn.resp_body)
|
body = Jason.decode!(conn.resp_body)
|
||||||
|
|||||||
Reference in new issue
Block a user