import os
import joblib
from fusion.fused_classifier import FusedClassifier
from rules.narrative_rules import narrative_rule

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


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

    fused = FusedClassifier(
        model=model,
        rule_fn=narrative_rule,
        alpha=0.6,
        threshold=0.5
    )

    tests = [
        "First we discussed the plan, then we executed it.",
        "After the meeting ended, we went home.",
        "This document explains the system architecture.",
        "The report describes the methodology used."
    ]

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


if __name__ == "__main__":
    main()
