import os
import joblib
from fusion.fused_classifier import FusedClassifier
from rules.authoritative_rules import authoritative_rule, AUTHORITATIVE_INTENT_VERBS
from rules.negation import is_negated_intent

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
MODEL_PATH = os.path.join(BASE_DIR, "artifacts", "authoritative_model.joblib")


def main():
    model = joblib.load(MODEL_PATH)

    fused = FusedClassifier(
        model=model,
        rule_fn=authoritative_rule,
        alpha=0.5,
        threshold=0.5,
        negation_fn=is_negated_intent,
        intent_verbs=AUTHORITATIVE_INTENT_VERBS
    )

    tests = [
        "You must follow this directive immediately.",
        "This is a mandatory requirement.",
        "Let's discuss this together and decide.",
        "We should align as a team on this.",
        "The document explains the process."
    ]

    for t in tests:
        pred = fused.predict(t)
        label = "Authoritative" if pred == 1 else "Collaborative"
        print(f"{label} → {t}")


if __name__ == "__main__":
    main()
