Downloads · 30 days
18
11% of all-time downloads
thejosango/nuha-ajp-trinary
nuha-ajp-trinary is a text classification model from thejosango. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as apache-2.0.
nuha-ajp-trinary is an Arabic text classifier that categorises Jordanian social media comments into three classes based on the NUHA methodology for online gender-based violence (OGBV). It fine-tunes nuha-ajp-mlm — a d…
Downloads · 30 days
18
11% of all-time downloads
All-time downloads
168
Public
Parameters
135M
5.8 GB on disk
Likes
0
Public
Click a slice to open those files.
.bin541 MB · 50%
From the Hugging Face model README
nuha-ajp-trinary is an Arabic text classifier that categorises Jordanian social media comments into three classes based on the NUHA methodology for online gender-based violence (OGBV). It fine-tunes nuha-ajp-mlm — a domain-adapted Arabic BERT — and outputs one of:
| Label | Meaning |
|---|---|
Not Online Violence | Comments that are not hate speech |
Offensive Language | Hate speech characterised by irony or sarcasm |
Gender Based Violence | Direct hate speech targeting gender — the primary focus of NUHA |
This model was developed as part of a pilot proof-of-concept for the NUHA project by the Jordan Open Source Association (JOSA). It is the production model behind the NUHA analysis platform.
A lightweight, ONNX-optimised 4-layer classifier trained on the same task is available at thejosango/nuha-ajp-trinary-onnx.
For a simpler binary classifier (hate speech / non-hate speech), see nuha-ajp-binary.
Classifying Arabic social media comments for online gender-based violence, particularly for Jordanian Arabic content from Facebook and X (Twitter).
from transformers import pipeline
classifier = pipeline(
"text-classification",
model="thejosango/nuha-ajp-trinary",
tokenizer="thejosango/nuha-ajp-trinary",
)
result = classifier("اخرسي يا غبية")
print(result)
# [{'label': 'Gender Based Violence', 'score': ...}]
For batch inference:
comments = ["يعطيكم العافية", "أنتِ ساحرة", "اخرسي يا غبية"]
results = classifier(comments)
for comment, result in zip(comments, results):
print(f"{result['label']} ({result['score']:.2f}): {comment}")
For faster CPU inference, use the ONNX export:
from optimum.onnxruntime import ORTModelForSequenceClassification
from transformers import AutoTokenizer, pipeline
model = ORTModelForSequenceClassification.from_pretrained("thejosango/nuha-ajp-trinary-onnx")
tokenizer = AutoTokenizer.from_pretrained("thejosango/nuha-ajp-trinary-onnx")
classifier = pipeline("text-classification", model=model, tokenizer=tokenizer)
Offensive Language from Gender Based Violence is a genuinely difficult subtask. The Offensive Language class is small (≈2% of training data) and the model may struggle with it.Not Online Violence (≈59%), with Offensive Language being very sparse (≈2%). Data augmentation was applied but class imbalance remains a factor.Fine-tuned on the methodology configuration of thejosango/nuha-ajp-dataset, which applies the three-class NUHA categorisation scheme to the original annotations.
At training and inference time, the following normalisation is applied to input text (in addition to the dataset-level Arabic-only filtering):
[رابط] token[مستخدم] token[بريد] token| Parameter | Value |
|---|---|
| Base model | thejosango/nuha-ajp-mlm |
| Hidden layers | 12 (full depth) |
| Learning rate | 5e-5 |
| LR schedule | Constant |
| Batch size | 64 |
| Epochs | 5 |
| Weight decay | 0.0 |
| Label smoothing | 0.1 |
| Weighted loss | No |
| Data augmentation | Yes (contextual word substitution, ratio 0.75) |
| Framework | Transformers 4.32.1, PyTorch 2.0.1 |
Evaluated on the validation split of thejosango/nuha-ajp-dataset (methodology configuration):
| Metric | Value |
|---|---|
| F1 (macro) | 0.5363 |
| Precision | 0.6660 |
| Recall | 0.5188 |
| Loss | 0.7126 |
The lower recall relative to precision suggests the model is conservative — it tends to under-predict Gender Based Violence rather than over-predict it. This reflects both the difficulty of the three-class task and the limited size of the pilot training corpus.
This model was developed as part of an initial pilot study. Performance metrics reflect the complexity of the task and the proof-of-concept nature of this system.