spam_filter_ar / README.md
BluSerK's picture
Update README.md
ec8fc87 verified
|
Raw
History Blame Contribute Delete
1.6 kB
metadata
language:
  - ar
license: mit
tags:
  - text-classification
  - naive-bayes
  - tf-idf
  - arabic-nlp
  - spam-detection
pipeline_tag: text-classification
metrics:
  - accuracy
model-index:
  - name: Spam Detection  Arabic (Naive Bayes)
    results:
      - task:
          type: text-classification
          name: Text Classification
        dataset:
          name: Arabic Spam Dataset
          type: custom
        metrics:
          - type: accuracy
            value: 0.976
            name: Accuracy

Spam Detection — Arabic (Naive Bayes)

A spam/ham text classifier for Arabic messages, built with a custom Arabic-aware preprocessing pipeline (tatweel/tashkeel stripping, tokenization, stopword removal) 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, tatweel (تطويل) and tashkeel (تشكيل) stripping via pyarabic, tokenization, Arabic stopword removal
  • Hyperparameters: Tuned via GridSearchCV (alpha smoothing)
  • Accuracy: 97.6% on held-out test set

Intended Use

Binary spam classification for Arabic 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 (via langdetect).

How to Use

import joblib

model = joblib.load("spam_ar_nb.joblib") 
prediction = model.predict(["مبروك! لقد ربحت جائزة مجانية، اضغط هنا الآن"]) 
print(prediction) # 1 = spam, 0 = ham