Repository navigation
fix: a marginal note reading "Orat." discarded its whole container - #40
Merged
Merged
Conversation
PyHellen answers HTTP 400 on a block whose text is nothing but a French abbreviation. `pie_extended` masks those forms before sentence splitting so their period does not end the sentence (models/fr/excluders.py, ABBREVIATIONS); when the block holds nothing else, no sentence is left, PaPie's padding calls `max()` on an empty list and raises `ValueError: max() arg is an empty sequence`. The pipeline counted the block in `containers_refused` and the run reported it as an incident needing a human. Two independent changes: - `_finish_container` no longer returns on the first refused block. One block coming back 400 threw away every block of the container the service HAD answered -- a five-character reference could cost a Latin quotation and two French paragraphs. The refusal flags are counted once after the loop, because the report divides them by `containers_found` and they have to stay container counts, not block counts. - `_prepare_container` does not send a block reduced to a lone abbreviation. There is no lemma to find in "Orat." or "Ibid.", so the request that provokes the 400 is not made at all. The guard is exact equality on the stripped block, not a "word then period" heuristic, which would have swallowed "Bonjour." as well. Measured on the corpus, enrich phase only, against the live service: LIV0020 went from "3 of 394 containers -- the service refused these" to no incident, LIV0026c from 2 of 1687 to none, and PyHellen logged no 400 at all. The `containers unanchored` counts are untouched (5 and 48): that guard is a deliberate decision, not a bug. The upstream defect remains: "nothing to tag" is not a bad request, and PyHellen should answer 200 with an empty token list rather than 400. This change stops the pipeline from losing good blocks over it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
rayondemiel
added a commit
that referenced
this pull request
Sep 21, 2026
Carries the fix from #40: a block refused by PyHellen no longer discards the blocks the service did answer, and a lone abbreviation is not sent at all. Patch release — no interface change, no output change (the end-to-end golden diff is unchanged). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
teille-sync runreported incidents like this on documents thatotherwise converted cleanly:
The run still exits 0 and every document is
ok, so the incident is purenoise in the report — but it is noise that says "this needs a human", and
that kind of false alarm is what wears down attention on the real ones.
Root cause
Traced end to end, and reproducible on demand.
PyHellen answers HTTP 400 on a block whose entire text is a French
abbreviation.
pie_extendedmasks those forms before sentence splittingso their period does not end the sentence
(
models/fr/excluders.py,ABBREVIATIONS). When the block holds nothingbut the abbreviation, nothing is left to split: zero sentences reach
PaPie, whose padding does
max()on an empty list and raisesValueError: max() arg is an empty sequence. PyHellen catches it in_handle_processing_errorand turns it into a 400.Probed directly against the service —
Orat.andIbid.are in theupstream list, the others are not:
Orat.,Ibid.Arist.,Cic.,Plin.,Abcd.orat.,ORAT.(list is case-sensitive)Orat. Le roi est mort.(other content survives)Every refusal observed on the corpus is one of these: 3 ×
Orat.inLIV0020, 2 ×
Ibid.in LIV0026c. Both are exactly 5 characters, which isprecisely
ENRICHMENT_MIN_TEXT_LENGTH— they clear the existing filter bya hair.
What this changes
1. A refused block no longer discards its neighbours.
_finish_containerreturned on the first non-ok outcome, so one 400 threwaway every block of the container the service had answered — a
five-character reference could cost a Latin quotation and two French
paragraphs. It now skips that block and keeps the rest. The refusal flags
are counted once after the loop: the report divides them by
containers_found, so they must stay container counts, not block counts.2. A lone abbreviation is not sent at all.
There is no lemma to find in
Orat., so_prepare_containerskips theblock instead of making the request that provokes the 400. The guard is
exact equality on the block's stripped text, not a "word then period"
heuristic — that would have swallowed
Bonjour., a real word with a reallemma. A test pins that boundary.
The two are independent: (1) is the robustness fix and matters for any
future refusal from any cause; (2) removes this particular one at the
source.
Evidence
Enrich phase only, against the live service:
3 of 394 — the service refused these2 of 1687 — the service refused thesePyHellen logged zero 400s across both runs.
containers unanchoredis untouched (5 and 48): that guard is a deliberate decision, not a bug,
and this PR does not touch it. Full suite green; the end-to-end golden
diff is unchanged.
Not fixed here
The upstream defect stands: nothing to tag is not a bad request, and
PyHellen should answer 200 with an empty token list rather than 400 —
ultimately
pie_extendedshould yield one sentence for an input that isonly an abbreviation, not zero. This PR stops the pipeline from losing
good blocks over it, and
ENRICHMENT_LONE_ABBREVIATIONScarries a note toresynchronise if the upstream list moves.
🤖 Generated with Claude Code