importance.py 399 B

1234567891011
  1. from __future__ import annotations
  2. from typing import Any, Dict
  3. def compute_importance(cluster: Dict[str, Any]) -> float:
  4. # v1 heuristic: more sources/number of articles => higher importance; capped.
  5. sources = len(set(cluster.get("sources", [])))
  6. article_count = len(cluster.get("articles", []))
  7. score = 0.15 * sources + 0.02 * article_count
  8. return min(0.99, round(score, 2))