class FusedClassifier:
    def __init__(
        self,
        model,
        rule_fn,
        alpha=0.7,
        threshold=0.5,
        negation_fn=None,
        intent_verbs=None
    ):
        """
        model: trained axis-specific classifier
        rule_fn: deterministic rule function (returns 0 or 1)
        alpha: rule weight
        threshold: decision threshold
        negation_fn: optional negation detector
        intent_verbs: verbs relevant for negation detection
        """
        self.model = model
        self.rule_fn = rule_fn
        self.alpha = alpha
        self.threshold = threshold
        self.negation_fn = negation_fn
        self.intent_verbs = intent_verbs or []

    def predict(self, text: str) -> int:
        # Step 1: rule signal
        R = self.rule_fn(text)

        # Step 2: negation suppression (optional)
        if (
            R == 1
            and self.negation_fn is not None
            and self.intent_verbs
            and self.negation_fn(text, self.intent_verbs)
        ):
            R = 0

        # Step 3: model probability
        X = self.model.vectorizer.transform([text])
        M = self.model.model.predict_proba(X)[0][1]

        # Step 4: fusion
        S = self.alpha * R + (1 - self.alpha) * M

        return int(S >= self.threshold)
