AI summaries¶
The functions of threats_watcher.summary_manager, taken from their docstrings.
threats_watcher.summary_manager
¶
The AI summaries of the articles: the prompts, the call to the AI connector and the local fallback.
sanitize_summary_html(text)
¶
The summary with nothing but the markup Watcher writes; what it holds as text stays text.
normalize_text(text)
¶
Normalize text for comparison: lowercase, collapse whitespace, remove punctuation.
extract_and_normalize_cves(text)
¶
Extract and validate CVE identifiers (CVE-YYYY-NNNNN format, year 1999-2030).
clean_text_and_metadata(text)
¶
Clean text from attribution phrases, metadata, and invalid CVEs.
deduplicate_titles(titles)
¶
Remove duplicate titles using normalized comparison.
get_article_title_or_summary(posturl_obj)
¶
Extract article content from PostUrl using multiple fallback strategies.
fetch_article_texts(posturls, max_texts, max_workers=5, urls=None)
¶
Fetch article texts in parallel, most recent first, and return up to max_texts unique texts.
Articles are fetched in batches of max_workers, so fetching stops as soon as enough unique texts are found.
If urls is given, it receives the address of each text (text -> url).
extract_entities_and_threats(title)
¶
Extract entities and threats from title using NER model.
generate_weekly_summary(notify=True)
¶
Generate and send weekly threat summary (top-5 trending topics).
analyze_threat_with_llm(keyword, corpus)
¶
Uses LiteLLM to extract the summary, enriched entities, and the alert score in a single pass. Returns a dictionary (JSON) or None on failure.
generate_breaking_news(trendy_word, notify=True)
¶
Generate a breaking-news style alert for a TrendyWord using multi-LLM abstraction with local fallback.
generate_keyword_summary_from_posturls(keyword, posturls)
¶
Generate/update keyword summary from a list of PostUrl objects.
generate_trendy_word_summary(trendy_word_id)
¶
Generate AI summary for a specific TrendyWord.