diff --git a/src/feeds/rss_parser.py b/src/feeds/rss_parser.py index e4aaefb..5e756f4 100644 --- a/src/feeds/rss_parser.py +++ b/src/feeds/rss_parser.py @@ -155,8 +155,16 @@ class RSSParser: summary = entry.get("summary", "") text = f"{title} {summary}".lower() - # Flexibles Keyword-Matching: mindestens die Hälfte der Suchworte muss vorkommen (aufgerundet) - min_matches = min(2, max(1, (len(search_words) + 1) // 2)) + # Adaptive Match-Schwelle: + # - Bei mindestens einem spezifischen Keyword (>=7 Zeichen) im Text reicht 1 Treffer. + # Verhindert, dass Headlines mit nur einem starken Keyword wie "buckelwal" + # rausfallen, wenn die Lage thematisch eng ist (Bug 1, vom User dokumentiert). + # - Sonst: alte Heuristik (mindestens halb der Wörter, max. 2). + specific_in_text = any(w in text for w in search_words if len(w) >= 7) + if specific_in_text: + min_matches = 1 + else: + min_matches = min(2, max(1, (len(search_words) + 1) // 2)) match_count = sum(1 for word in search_words if word in text) if match_count >= min_matches: