--- language: - en license: mit tags: - text-classification - naive-bayes - tf-idf - english-nlp - spam-detection pipeline_tag: text-classification metrics: - accuracy model-index: - name: Spam Detection — English (Naive Bayes) results: - task: type: text-classification name: Text Classification dataset: name: English Spam Dataset type: custom metrics: - type: accuracy value: 0.994 name: Accuracy --- # Spam Detection — English (Naive Bayes) A lightweight spam/ham text classifier for English messages, built with a custom preprocessing pipeline (tokenization, stopword removal, lemmatization) and TF-IDF features feeding into a Multinomial Naive Bayes classifier. ## Model Details - **Architecture:** TF-IDF + Multinomial Naive Bayes (scikit-learn Pipeline) - **Preprocessing:** Custom transformer — hashtag/punctuation removal, tokenization (NLTK), stopword removal, lemmatization (WordNet) - **Hyperparameters:** Tuned via GridSearchCV (alpha smoothing) - **Accuracy:** 99.4% on held-out test set ## Intended Use Binary spam classification for English text messages/emails. Part of a multilingual spam detection system that automatically routes text to a language-specific model (English or Arabic) based on detected language. ## How to Use ```python import joblib model = joblib.load("spam_eng_nb.joblib") prediction = model.predict(["Congratulations! You've won a free prize, click here now"]) print(prediction) # 1 = spam, 0 = ham