import json
import numpy as np
from typing import Tuple
import pandas as pd

def load_prompts(path: str = "data/prompts.json") -> dict:
    with open(path, "r", encoding="utf-8") as f:
        return json.load(f)

def normalize_series(arr: np.ndarray) -> np.ndarray:
    """Zero‑mean, unit‑variance."""
    return (arr - arr.mean()) / arr.std()

def train_test_split(df: pd.DataFrame, test_size: float = 0.2, random_state: int = 42) -> Tuple[pd.DataFrame, pd.DataFrame]:
    return df.sample(frac=1 - test_size, random_state=random_state), \
           df.drop(df.sample(frac=1 - test_size, random_state=random_state).index)
