"""Lightweight, best-effort regex extractors for specific signal types the severity model treats specially (pricing, leadership). These are heuristics, not NLP - they exist to catch the common "$X/month" and "named a new CEO" phrasings, not to parse arbitrary text reliably. Phase 7's LLM extraction task is the higher-fidelity version of this; these run cheaply and deterministically as part of scoring, without a model call. """ from __future__ import annotations import re _PRICE_RE = re.compile(r"\$\s?\d[\d,]*(?:\.\d{2})?\s*(?:/\s*(?:month|mo|year|yr))?") _LEADERSHIP_TITLE_RE = re.compile( r"(?i)\b(Chief Executive Officer|CEO|Chief Financial Officer|CFO|Chief Technology Officer|" r"CTO|President|Chairman|Chairwoman|Chairperson)\b" ) def extract_prices(text: str) -> set[str]: return set(_PRICE_RE.findall(text or "")) def mentions_leadership_title(text: str) -> bool: return bool(_LEADERSHIP_TITLE_RE.search(text or ""))