def extract_context_signals(article: dict, mention_span: tuple) -> dict: window = article["text"][max(0, mention_span[0]-200):mention_span[1]+200] return { "mentioned_with": extract_entity_mentions(window), "sector_keywords": extract_sector_terms(window), "article_category": article.get("category", "unknown"), }