File size: 4,382 Bytes
f648a97
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
---
language:
- ar
license: apache-2.0
base_model: thejosango/nuha-mlm
tags:
- bert
- text-classification
- hate-speech
- gender-based-violence
- arabic
- multiclass-classification
- onnx
- pilot
datasets:
- thejosango/nuha-dataset
metrics:
- f1
- precision
- recall
model-index:
- name: nuha
  results:
  - task:
      type: text-classification
      name: Text Classification
    dataset:
      name: Jordanian NUHA Dataset
      type: thejosango/nuha-dataset
      config: methodology
      split: validation
    metrics:
    - type: f1
      value: 0.5363
      name: F1
    - type: precision
      value: 0.6660
      name: Precision
    - type: recall
      value: 0.5188
      name: Recall
---

# nuha

## Model Summary

`nuha` is a **lightweight, ONNX-optimised** 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-mlm`](https://huggingface.co/thejosango/nuha-mlm) — a domain-adapted Arabic BERT — with a reduced 4-layer architecture for efficient CPU inference, and is exported to ONNX. It shares the same classification task and labels as [`nuha-multiclass`](https://huggingface.co/thejosango/nuha-multiclass) but is optimised for production deployment. This is the model powering the NUHA analysis platform.

| 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)](https://josa.ngo).

For the full-depth (12-layer) version of this classifier, see [`nuha-multiclass`](https://huggingface.co/thejosango/nuha-multiclass).

## Uses

### Direct Use

```python
from optimum.onnxruntime import ORTModelForSequenceClassification
from transformers import AutoTokenizer, pipeline

model = ORTModelForSequenceClassification.from_pretrained("thejosango/nuha")
tokenizer = AutoTokenizer.from_pretrained("thejosango/nuha")
classifier = pipeline("text-classification", model=model, tokenizer=tokenizer)

result = classifier("اخرسي يا غبية")
print(result)
# [{'label': 'Gender Based Violence', 'score': ...}]
```

For batch inference:

```python
comments = ["يعطيكم العافية", "أنتِ ساحرة", "اخرسي يا غبية"]
results = classifier(comments)
for comment, result in zip(comments, results):
    print(f"{result['label']} ({result['score']:.2f}): {comment}")
```

### Using the PyTorch Version

If you need the full PyTorch model (for fine-tuning or non-ONNX inference), use [`nuha-multiclass`](https://huggingface.co/thejosango/nuha-multiclass) directly.

### Out-of-Scope Use

- **Other Arabic dialects**: The model was trained primarily on Jordanian Arabic. Performance on Egyptian, Gulf, or Modern Standard Arabic is not validated.
- **Other hate speech targets**: NUHA is calibrated for online gender-based violence. It is not designed to detect hate speech targeting race, religion, or other demographics.
- **High-stakes automated decisions**: Given the moderate performance (F1 ≈ 0.54) and pilot nature of this work, the model should not be used as the sole decision-maker in content moderation systems without human review.

## Preprocessing

At inference time, apply the following normalisation to input text before passing it to the model:

1. URLs replaced with `[رابط]` token
2. @mentions replaced with `[مستخدم]` token
3. Email addresses replaced with `[بريد]` token
4. Numbers removed
5. Punctuation removed
6. Arabic diacritics (harakat) removed
7. Whitespace normalised

## Evaluation Results

Evaluated on the validation split of [`thejosango/nuha-dataset`](https://huggingface.co/datasets/thejosango/nuha-dataset) (methodology configuration):

| Metric | Value |
|---|---|
| F1 (macro) | 0.5363 |
| Precision | 0.6660 |
| Recall | 0.5188 |

See [`nuha-multiclass`](https://huggingface.co/thejosango/nuha-multiclass) for full training details and evaluation discussion.

---

*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.*