import os
import joblib
from fusion.fused_classifier import FusedClassifier
from rules.formal_rules import formal_rule

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


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

    # Lower alpha than questioning
    fused = FusedClassifier(
        model=model,
        rule_fn=formal_rule,
        alpha=0.4,
        threshold=0.5
    )

    tests = [
        "Please review the attached document.",
        "I kindly request your feedback.",
        "Hey, can you check this out?",
        "yeah this looks cool",
        "The report describes the methodology."
    ]

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


if __name__ == "__main__":
    main()
