Broaden disturbing-content filter to catch death/burial themes#677
Merged
Conversation
A Romanian "coffin therapy" lifestyle article (being buried alive in a sealed coffin for relaxation) slipped past the "Avoid disturbing news" filter. The filter only understood death/violence as a *news event*, not as a *topic or image*, so a morbid-but-not-tragic novelty piece passed both detection gates. Three changes: 1. Keyword detection: add a "Death imagery & morbid themes" category to every language (coffin/burial/corpse/morgue/exhume/buried-alive). This is deliberately broader than the event-based categories and accepts some false positives — the user-facing checkbox promises to hide "death", not only tragedies. Romanian now matches sicri(u)/coșciug, which catches the reported article by title alone. 2. LLM prompt: the DISTURBING_CONTENT question now flags death/burial imagery and themes (corpses, coffins, being buried, funerary/mortuary practices, medical gore) in addition to tragic events, with an explicit note that a novelty/wellness piece whose subject is death or burial is YES. Brief incidental mentions and purely historical/educational treatment remain NO. 3. Decouple classification from simplification: persist the keyword-based DISTURBING flag immediately after detection, before the daily simplification-cap early-return. Previously the flag was only saved inside the post-simplification block, so a capped/skipped/errored simplification silently dropped it. Extracted a _save_classifications helper; find_or_create keeps the later LLM save idempotent. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
ArchLens - No architecturally relevant changes to the existing views |
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.
Why
A Romanian "coffin therapy" article — a lifestyle/novelty piece about being buried alive in a sealed coffin for relaxation (tagged Business, from adevarul.ro) — passed the "Avoid disturbing news (violence, death, disasters)" filter and showed up for a user who had it enabled.
Root cause: the filter's notion of "death" is death-as-a-news-event (killings, war, disasters, fatal accidents), not death-as-a-topic-or-image. The article is morbid by subject but not a violent/tragic event, so it tripped neither detection gate:
ucis,cadavru,atentat,prăbușire…). None of the article's actual words (sicriu,coșciug,îngropați,terapie) were present.NO.Plus a structural gap: the keyword flag was only persisted inside the post-simplification block, so a capped/skipped/errored simplification silently dropped it.
Changes
Keyword detection (
disturbing_content_detection.py) — new "Death imagery & morbid themes" category across all 9 languages (coffin / burial / corpse / morgue / exhume / buried-alive). Intentionally broader than the event-based categories and accepts some false positives — the checkbox promises to hide "death", not only tragedies. Romanian now matchessicri(u)/coșciug, which catches the reported article by title alone.LLM prompt (
article_simplification.py) — theDISTURBING_CONTENTquestion now flags death/burial imagery and themes (corpses, coffins, being buried, funerary/mortuary practices, medical gore) in addition to tragic events, with an explicit example that a novelty/wellness piece whose subject is death/burial isYES. Incidental mentions and purely historical/educational treatment remainNO.Decouple classification from simplification (
article_downloader.py) — persist the keyword-basedDISTURBINGflag immediately after detection, before the daily simplification-cap early-return, so the flag is set even when simplification is skipped/capped/errored. Extracted a_save_classificationshelper;find_or_createkeeps the later LLM save idempotent.Verification
Notes
🤖 Generated with Claude Code