BluSerK commited on
Commit
ea6cb13
·
verified ·
1 Parent(s): 9206cff

Upload spam_ar_nb_976.joblib

Browse files

# 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
\```python
import joblib

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

## Limitations
- Arabic NLP tooling is less mature than English; preprocessing uses
stemming/normalization rather than full lemmatization
- Trained on a specific dataset distribution; performance may vary on
dialectal Arabic vs. Modern Standard Arabic
- Naive Bayes assumes word independence — does not capture context or word order

Files changed (1) hide show
  1. spam_ar_nb_976.joblib +3 -0
spam_ar_nb_976.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ec59890df44fd6387be84ab9748b1ab54e9fe851ec4a595f1a22a8a5b9e3d6fd
3
+ size 540213