Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

Remove dead _categorize_news() function from news_analyzer.py

LearningCircuitc64e386ec0af
diff --git a/src/local_deep_research/news/core/news_analyzer.py b/src/local_deep_research/news/core/news_analyzer.py
index 6e48763f45..787f28eb78 100644
--- a/src/local_deep_research/news/core/news_analyzer.py
+++ b/src/local_deep_research/news/core/news_analyzer.py
@@ -86,8 +86,8 @@ class NewsAnalyzer:
)
return components
- except Exception as e:
- logger.error(f"Error analyzing news: {e}")
+ except Exception:
+ logger.exception("Error analyzing news")
return self._empty_analysis()
def extract_news_items(
@@ -159,8 +159,8 @@ Focus on genuinely newsworthy stories.
return valid_items
- except Exception as e:
- logger.error(f"Error extracting news items: {e}")
+ except Exception:
+ logger.exception("Error extracting news items")
return []
@@ -203,8 +203,8 @@ THE BIG PICTURE:"""
else str(response)
)
return content.strip()
- except Exception as e:
- logger.error(f"Error generating big picture: {e}")
+ except Exception:
+ logger.exception("Error generating big picture")
return ""
def generate_watch_for(self, news_items: List[Dict[str, Any]]) -> List[str]:
@@ -265,8 +265,8 @@ WATCH FOR:
return watch_items[:5]
- except Exception as e:
- logger.error(f"Error generating watch items: {e}")
+ except Exception:
+ logger.exception("Error generating watch items")
return []
def generate_patterns(self, news_items: List[Dict[str, Any]]) -> str:
@@ -315,8 +315,8 @@ PATTERN RECOGNITION (1-2 sentences):"""
else str(response)
)
return content.strip()
- except Exception as e:
- logger.error(f"Error generating patterns: {e}")
+ except Exception:
+ logger.exception("Error generating patterns")
return ""
def extract_topics(
@@ -444,112 +444,3 @@ PATTERN RECOGNITION (1-2 sentences):"""
"impact_summary": {"average": 0, "high_impact_count": 0},
"timestamp": datetime.now(timezone.utc).isoformat(),
}
-
- def _categorize_news(self, headline: str, content: str = "") -> str:
- """
- Categorize a news item based on headline and content.
-
- Args:
- headline: News headline
- content: Optional news content
-
- Returns:
- Category name
- """
- # Simple keyword-based categorization
- combined_text = (headline + " " + content).lower()
-
- # Category keywords
- categories = {
- "Technology": [
- "tech",
- "software",
- "ai",
- "computer",
- "digital",
- "internet",
- "app",
- "iphone",
- "android",
- "google",
- "apple",
- "microsoft",
- ],
- "Economy": [
- "economy",
- "market",
- "stock",
- "finance",
- "trade",
- "business",
- "gdp",
- "inflation",
- "recession",
- "bank",
- "dollar",
- "crypto",
- ],
- "Health": [
- "health",
- "covid",
- "virus",
- "vaccine",
- "medical",
- "disease",
- "hospital",
- "doctor",
- "patient",
- "pandemic",
- "treatment",
- ],
- "Politics": [
- "president",
- "government",
- "election",
- "congress",
- "senate",
- "policy",
- "law",
- "bill",
- "vote",
- "political",
- "minister",
- ],
- "Science": [
- "research",
- "study",
- "scientist",
- "discovery",
- "experiment",
- "climate",
- "space",
- "nasa",
- "physics",
- "biology",
- ],
- "Sports": [
- "sport",
- "game",
- "player",
- "team",
- "win",
- "championship",
- "football",
- "basketball",
- "soccer",
- "olympic",
- ],
- }
-
- # Count keyword matches
- category_scores = {}
- for category, keywords in categories.items():
- score = sum(1 for keyword in keywords if keyword in combined_text)
- if score > 0:
- category_scores[category] = score
-
- # Return highest scoring category
- if category_scores:
- return max(category_scores.items(), key=lambda x: x[1])[0]
-
- return "General"