Skip to content

Broaden disturbing-content filter to catch death/burial themes#677

Merged
mircealungu merged 1 commit into
masterfrom
broaden-disturbing-content-filter
Jul 14, 2026
Merged

Broaden disturbing-content filter to catch death/burial themes#677
mircealungu merged 1 commit into
masterfrom
broaden-disturbing-content-filter

Conversation

@mircealungu

Copy link
Copy Markdown
Member

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:

  • Keyword pass — the per-language lists are all hard-news death/violence vocabulary (ucis, cadavru, atentat, prăbușire…). None of the article's actual words (sicriu, coșciug, îngropați, terapie) were present.
  • LLM pass — the prompt asked whether the primary focus is a current disturbing event, so a novelty wellness story reasonably came back 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

  1. 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 matches sicri(u) / coșciug, which catches the reported article by title alone.

  2. LLM prompt (article_simplification.py) — 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 example that a novelty/wellness piece whose subject is death/burial is YES. Incidental mentions and purely historical/educational treatment remain NO.

  3. Decouple classification from simplification (article_downloader.py) — persist the keyword-based DISTURBING flag 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_classifications helper; find_or_create keeps the later LLM save idempotent.

Verification

RO article:        (True, 'Disturbing content keywords: sicri, coșciug')
EN coffin:         (True, 'Disturbing content keywords: buried alive, coffin')
Neutral RO control:(False, '')
Neutral EN control:(False, '')

Notes

  • Affects newly crawled articles only — already-indexed articles won't be reflagged without a backfill. Happy to add a one-off tool to re-run keyword detection over recent articles if we want the fix applied retroactively.
  • No existing tests cover this detection; can add a unit test for the keyword lists in a follow-up if desired.

🤖 Generated with Claude Code

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>
@github-actions

Copy link
Copy Markdown

ArchLens - No architecturally relevant changes to the existing views

@mircealungu
mircealungu merged commit 3473ac9 into master Jul 14, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant