This commit is contained in:
@@ -58,6 +58,7 @@ def generate_match_commentary(package: Dict[str, Any]) -> Dict[str, Any]:
|
||||
summary = _build_summary(
|
||||
action, main_pick, market_board, v27_engine,
|
||||
score_pred, risk, data_quality, home, away,
|
||||
match_info=match_info,
|
||||
)
|
||||
|
||||
# ── Quick notes ───────────────────────────────────────────────
|
||||
@@ -117,22 +118,35 @@ def _build_summary(
|
||||
data_quality: Dict[str, Any],
|
||||
home: str,
|
||||
away: str,
|
||||
match_info: Optional[Dict[str, Any]] = None,
|
||||
) -> str:
|
||||
parts: List[str] = []
|
||||
|
||||
# C-2: live-aware preamble — if the match is in play, lead with current score
|
||||
# vs the pre-match read so users immediately see how the prediction is faring.
|
||||
match_info = match_info or {}
|
||||
if match_info.get("is_live"):
|
||||
cur_home = match_info.get("current_score_home")
|
||||
cur_away = match_info.get("current_score_away")
|
||||
if cur_home is not None and cur_away is not None:
|
||||
parts.append(
|
||||
f"🔴 CANLI: {home} {cur_home} - {cur_away} {away} "
|
||||
f"(aşağıdaki analiz maç öncesi tahmindir)"
|
||||
)
|
||||
|
||||
# Who is the favourite?
|
||||
ms_board = market_board.get("MS") or {}
|
||||
ms_pick = ms_board.get("pick", "")
|
||||
ms_conf = float(ms_board.get("confidence", 50) or 50)
|
||||
|
||||
if ms_pick == "1" and ms_conf > 45:
|
||||
parts.append(f"{home} hafif favori görünüyor")
|
||||
elif ms_pick == "1" and ms_conf > 55:
|
||||
if ms_pick == "1" and ms_conf > 55:
|
||||
parts.append(f"{home} net favori")
|
||||
elif ms_pick == "2" and ms_conf > 45:
|
||||
parts.append(f"{away} hafif favori görünüyor")
|
||||
elif ms_pick == "1" and ms_conf > 45:
|
||||
parts.append(f"{home} hafif favori görünüyor")
|
||||
elif ms_pick == "2" and ms_conf > 55:
|
||||
parts.append(f"{away} net favori")
|
||||
elif ms_pick == "2" and ms_conf > 45:
|
||||
parts.append(f"{away} hafif favori görünüyor")
|
||||
else:
|
||||
parts.append("İki takım da birbirine yakın güçte")
|
||||
|
||||
@@ -262,6 +276,26 @@ def _detect_contradictions(
|
||||
triple_value = v27_engine.get("triple_value") or {}
|
||||
predictions = v27_engine.get("predictions") or {}
|
||||
|
||||
# C-2 live-vs-prediction mismatch
|
||||
match_info = package.get("match_info") or {}
|
||||
if match_info.get("is_live"):
|
||||
cur_h = match_info.get("current_score_home")
|
||||
cur_a = match_info.get("current_score_away")
|
||||
ms_board_live = market_board.get("MS") or {}
|
||||
predicted_pick = str(ms_board_live.get("pick") or "")
|
||||
if cur_h is not None and cur_a is not None:
|
||||
actual_pick: Optional[str] = None
|
||||
if cur_h > cur_a:
|
||||
actual_pick = "1"
|
||||
elif cur_a > cur_h:
|
||||
actual_pick = "2"
|
||||
else:
|
||||
actual_pick = "X"
|
||||
if predicted_pick and actual_pick and predicted_pick != actual_pick:
|
||||
contradictions.append(
|
||||
"Canlı durum maç öncesi tahmin ile çelişiyor — sürpriz GERÇEKLEŞİYOR"
|
||||
)
|
||||
|
||||
# MS contradiction: model says home but triple_value says away has value
|
||||
ms_preds = predictions.get("ms") or {}
|
||||
ms_home = float(ms_preds.get("home", 0) or 0)
|
||||
|
||||
Reference in New Issue
Block a user