Files
saksham 1a4c80958f Initial commit: CI Agent competitive-intelligence monitoring app
FastAPI + Celery + Next.js + Postgres/Redis app with company monitoring,
source collection, LLM-based change analysis, enrichment, and account
security (Turnstile, escalating lockout, email verification).
2026-08-05 10:48:20 -04:00

26 lines
953 B
Python

"""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 ""))