From 02e553fffafe9dbc97f78e0c0208af349742158d Mon Sep 17 00:00:00 2001 From: ChemaVX Date: Thu, 13 Aug 2026 20:40:05 +0000 Subject: [PATCH] =?UTF-8?q?fix(short):=20el=20divisor=20del=20prompt=20iba?= =?UTF-8?q?=20redondeado=20y=20no=20reproduc=C3=ADa=20su=20propia=20cuenta?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 12 ÷ 2.8 no da 5.1, da 5.0. La cuenta trabajada la hace el modelo con el número que ve, así que el número que ve tiene que ser el real. Co-Authored-By: Claude Opus 5 --- src/generator/shortspec.py | 8 ++++---- tests/test_shortspec.py | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/generator/shortspec.py b/src/generator/shortspec.py index c1a96fe..62c96d8 100644 --- a/src/generator/shortspec.py +++ b/src/generator/shortspec.py @@ -183,11 +183,11 @@ competing with words already on the frame. Chosen silence is an edit; a spec \ with one narrated shot out of eight is not a Short with a voice, it is a Short \ that forgot to speak. - **Give every narrated shot enough time for its own line, and work it out \ -rather than guessing.** The voice reads about {words_per_second:.1f} words a \ +rather than guessing.** The voice reads about {words_per_second:g} words a \ second and pauses a quarter second at every full stop, so **count the words AND \ count the sentences**: - duration ≥ words ÷ {words_per_second:.1f} + {sentence_pause} × sentences + \ + duration ≥ words ÷ {words_per_second:g} + {sentence_pause} × sentences + \ {rounded_pad} The second term is the one that catches people out. "Witness identities. \ @@ -196,9 +196,9 @@ not a fast line, it is three quarters of a second of silence on top. Two lines \ of the same length do not take the same time if one of them is chopped. Worked, on the example below: shot 1 speaks twelve words in one sentence, so \ -12 ÷ {words_per_second:.1f} + {sentence_pause} + {rounded_pad} = 5.1, and it \ +12 ÷ {words_per_second:g} + {sentence_pause} + {rounded_pad} = 5.1, and it \ declares 5.5. Shot 4 speaks thirteen words in two sentences, so 13 ÷ \ -{words_per_second:.1f} + 0.5 + {rounded_pad} = 5.7, and it declares 6.0. Round \ +{words_per_second:g} + 0.5 + {rounded_pad} = 5.7, and it declares 6.0. Round \ up, never down. This is the one rule that makes your own arithmetic true: a shot runs for the LONGER of \ diff --git a/tests/test_shortspec.py b/tests/test_shortspec.py index b01e1db..6a38b52 100644 --- a/tests/test_shortspec.py +++ b/tests/test_shortspec.py @@ -166,9 +166,11 @@ def test_the_prompt_gives_a_budget_the_model_can_count(): w, _ = writer("{}") prompt = w.build_prompt("Caso X", "material", None, "X.TEST") - assert f"{NARRATION_WORDS_PER_SECOND:.1f} words a second" in prompt, \ + # La constante exacta, no redondeada: el prompt trae una cuenta trabajada, y + # con "2.8" el divisor mostrado no reproduce el resultado mostrado. + assert f"{NARRATION_WORDS_PER_SECOND:g} words a second" in prompt, \ "sin el ritmo de la voz no hay cuenta que el modelo pueda hacer" - assert f"words ÷ {NARRATION_WORDS_PER_SECOND:.1f}" in prompt + assert f"words ÷ {NARRATION_WORDS_PER_SECOND:g}" in prompt assert f"{NARRATION_WORD_BUDGET} words" in prompt