Update README.md
Browse files
README.md
CHANGED
|
@@ -1,35 +1,47 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
preprocessing pipeline (tatweel/tashkeel stripping, tokenization, stopword
|
| 5 |
-
removal) and TF-IDF features feeding into a Multinomial Naive Bayes classifier.
|
| 6 |
|
| 7 |
## Model Details
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
- **Hyperparameters:** Tuned via GridSearchCV (alpha smoothing)
|
| 13 |
-
- **Accuracy:** 97.6% on held-out test set
|
| 14 |
|
| 15 |
## Intended Use
|
| 16 |
-
Binary spam classification for Arabic text messages/emails. Part of a
|
| 17 |
-
multilingual spam detection system that automatically routes text to a
|
| 18 |
-
language-specific model (English or Arabic) based on detected language
|
| 19 |
-
(via `langdetect`).
|
| 20 |
|
| 21 |
## How to Use
|
| 22 |
-
|
| 23 |
import joblib
|
| 24 |
|
| 25 |
-
model = joblib.load("spam_ar_nb.joblib")
|
| 26 |
-
prediction = model.predict(["مبروك! لقد ربحت جائزة مجانية، اضغط هنا الآن"])
|
| 27 |
-
print(prediction)
|
| 28 |
-
\```
|
| 29 |
-
|
| 30 |
-
## Limitations
|
| 31 |
-
- Arabic NLP tooling is less mature than English; preprocessing uses
|
| 32 |
-
stemming/normalization rather than full lemmatization
|
| 33 |
-
- Trained on a specific dataset distribution; performance may vary on
|
| 34 |
-
dialectal Arabic vs. Modern Standard Arabic
|
| 35 |
-
- Naive Bayes assumes word independence — does not capture context or word order
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- ar
|
| 4 |
+
license: mit
|
| 5 |
+
tags:
|
| 6 |
+
- text-classification
|
| 7 |
+
- naive-bayes
|
| 8 |
+
- tf-idf
|
| 9 |
+
- arabic-nlp
|
| 10 |
+
- spam-detection
|
| 11 |
+
pipeline_tag: text-classification
|
| 12 |
+
metrics:
|
| 13 |
+
- accuracy
|
| 14 |
+
model-index:
|
| 15 |
+
- name: Spam Detection — Arabic (Naive Bayes)
|
| 16 |
+
results:
|
| 17 |
+
- task:
|
| 18 |
+
type: text-classification
|
| 19 |
+
name: Text Classification
|
| 20 |
+
dataset:
|
| 21 |
+
name: Arabic Spam Dataset
|
| 22 |
+
type: custom
|
| 23 |
+
metrics:
|
| 24 |
+
- type: accuracy
|
| 25 |
+
value: 0.976
|
| 26 |
+
name: Accuracy
|
| 27 |
+
---
|
| 28 |
|
| 29 |
+
# Spam Detection — Arabic (Naive Bayes)
|
| 30 |
+
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.
|
|
|
|
| 31 |
|
| 32 |
## Model Details
|
| 33 |
+
* **Architecture:** TF-IDF + Multinomial Naive Bayes (scikit-learn Pipeline)
|
| 34 |
+
* **Preprocessing:** Custom transformer — hashtag/punctuation removal, tatweel (تطويل) and tashkeel (تشكيل) stripping via pyarabic, tokenization, Arabic stopword removal
|
| 35 |
+
* **Hyperparameters:** Tuned via GridSearchCV (alpha smoothing)
|
| 36 |
+
* **Accuracy:** 97.6% on held-out test set
|
|
|
|
|
|
|
| 37 |
|
| 38 |
## Intended Use
|
| 39 |
+
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`).
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
## How to Use
|
| 42 |
+
```python
|
| 43 |
import joblib
|
| 44 |
|
| 45 |
+
model = joblib.load("spam_ar_nb.joblib")
|
| 46 |
+
prediction = model.predict(["مبروك! لقد ربحت جائزة مجانية، اضغط هنا الآن"])
|
| 47 |
+
print(prediction) # 1 = spam, 0 = ham
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|