hassoudi commited on
Commit
f018687
·
verified ·
1 Parent(s): f3af552

Add model card

Browse files
Files changed (1) hide show
  1. README.md +216 -164
README.md CHANGED
@@ -1,199 +1,251 @@
1
  ---
 
 
 
 
2
  library_name: transformers
3
- tags: []
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  ---
5
 
6
- # Model Card for Model ID
7
 
8
- <!-- Provide a quick summary of what the model is/does. -->
9
 
 
10
 
 
11
 
12
  ## Model Details
13
 
14
- ### Model Description
15
-
16
- <!-- Provide a longer summary of what this model is. -->
17
-
18
- This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
19
-
20
- - **Developed by:** [More Information Needed]
21
- - **Funded by [optional]:** [More Information Needed]
22
- - **Shared by [optional]:** [More Information Needed]
23
- - **Model type:** [More Information Needed]
24
- - **Language(s) (NLP):** [More Information Needed]
25
- - **License:** [More Information Needed]
26
- - **Finetuned from model [optional]:** [More Information Needed]
27
-
28
- ### Model Sources [optional]
29
-
30
- <!-- Provide the basic links for the model. -->
31
-
32
- - **Repository:** [More Information Needed]
33
- - **Paper [optional]:** [More Information Needed]
34
- - **Demo [optional]:** [More Information Needed]
35
-
36
- ## Uses
37
-
38
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
-
40
- ### Direct Use
41
-
42
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
-
44
- [More Information Needed]
45
-
46
- ### Downstream Use [optional]
47
-
48
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
-
50
- [More Information Needed]
51
-
52
- ### Out-of-Scope Use
53
-
54
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
-
56
- [More Information Needed]
57
-
58
- ## Bias, Risks, and Limitations
59
-
60
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
-
62
- [More Information Needed]
63
-
64
- ### Recommendations
65
-
66
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
-
68
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
-
70
- ## How to Get Started with the Model
71
-
72
- Use the code below to get started with the model.
73
-
74
- [More Information Needed]
75
-
76
- ## Training Details
77
-
78
- ### Training Data
79
-
80
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
-
82
- [More Information Needed]
83
-
84
- ### Training Procedure
85
-
86
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
-
88
- #### Preprocessing [optional]
89
-
90
- [More Information Needed]
91
-
92
-
93
- #### Training Hyperparameters
94
-
95
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
-
97
- #### Speeds, Sizes, Times [optional]
98
-
99
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
-
101
- [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
 
103
  ## Evaluation
104
 
105
- <!-- This section describes the evaluation protocols and provides the results. -->
106
-
107
- ### Testing Data, Factors & Metrics
108
-
109
- #### Testing Data
110
-
111
- <!-- This should link to a Dataset Card if possible. -->
112
-
113
- [More Information Needed]
114
-
115
- #### Factors
116
-
117
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
-
119
- [More Information Needed]
120
-
121
- #### Metrics
122
-
123
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
-
125
- [More Information Needed]
126
-
127
- ### Results
128
-
129
- [More Information Needed]
130
-
131
- #### Summary
132
-
133
-
134
-
135
- ## Model Examination [optional]
136
-
137
- <!-- Relevant interpretability work for the model goes here -->
138
-
139
- [More Information Needed]
140
-
141
- ## Environmental Impact
142
-
143
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
-
145
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
-
147
- - **Hardware Type:** [More Information Needed]
148
- - **Hours used:** [More Information Needed]
149
- - **Cloud Provider:** [More Information Needed]
150
- - **Compute Region:** [More Information Needed]
151
- - **Carbon Emitted:** [More Information Needed]
152
-
153
- ## Technical Specifications [optional]
154
-
155
- ### Model Architecture and Objective
156
 
157
- [More Information Needed]
158
 
159
- ### Compute Infrastructure
 
 
 
 
 
160
 
161
- [More Information Needed]
162
 
163
- #### Hardware
164
 
165
- [More Information Needed]
166
 
167
- #### Software
168
 
169
- [More Information Needed]
 
 
 
 
 
 
 
170
 
171
- ## Citation [optional]
172
 
173
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
 
 
 
 
 
 
174
 
175
- **BibTeX:**
176
 
177
- [More Information Needed]
178
 
179
- **APA:**
180
 
181
- [More Information Needed]
 
 
 
 
 
 
182
 
183
- ## Glossary [optional]
184
 
185
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
 
187
- [More Information Needed]
 
 
 
 
 
 
 
 
 
 
188
 
189
- ## More Information [optional]
190
 
191
- [More Information Needed]
 
 
 
 
 
 
 
 
192
 
193
- ## Model Card Authors [optional]
194
 
195
- [More Information Needed]
 
196
 
197
- ## Model Card Contact
198
 
199
- [More Information Needed]
 
 
 
1
  ---
2
+ language:
3
+ - ary
4
+ - ar
5
+ license: cc-by-nc-4.0
6
  library_name: transformers
7
+ pipeline_tag: token-classification
8
+ base_model: SI2M-Lab/DarijaBERT
9
+ tags:
10
+ - part-of-speech
11
+ - pos-tagging
12
+ - token-classification
13
+ - moroccan-darija
14
+ - darija
15
+ - low-resource-languages
16
+ - bert
17
+ metrics:
18
+ - precision
19
+ - recall
20
+ - f1
21
+ - accuracy
22
+ model-index:
23
+ - name: DarijaPOSTagger v0.1 (preliminary)
24
+ results:
25
+ - task:
26
+ type: token-classification
27
+ name: Part-of-Speech Tagging
28
+ dataset:
29
+ name: Darija POS corpus (validation split, dev+test merged)
30
+ type: darija-pos-corpus
31
+ metrics:
32
+ - type: f1
33
+ value: 0.9999
34
+ name: Seqeval F1 (validation)
35
+ - type: accuracy
36
+ value: 0.9999
37
+ name: Token accuracy (validation)
38
+ widget:
39
+ - text: "شربت أتاي مع صحابي"
40
+ example_title: "Simple sentence (verb + nouns)"
41
+ - text: "غادي نمشي للسوق غدا"
42
+ example_title: "Future (غادي + verb)"
43
+ - text: "ما عند ي ش الفلوس"
44
+ example_title: "Negation, clitic-segmented (ما … ش)"
45
  ---
46
 
47
+ # DarijaPOSTagger (v0.1) — Part-of-Speech Tagging for Moroccan Darija
48
 
49
+ > 🚧 **Preliminary release (v0.1) — for education & research.** This model was trained on a small corpus (1,225 sentences) and released early, with its limitations openly documented, as a teaching artifact and a baseline for the Darija NLP community. Read the [Preliminary Validation](#preliminary-validation-july-2026) and [Known Limitations](#known-limitations--bias) sections before using it. Not intended for production use.
50
 
51
+ **DarijaPOSTagger** is a BERT-based token classification model that assigns **part-of-speech (POS) tags** to **Moroccan Darija** text (Moroccan Arabic dialect, Arabic script). It is fine-tuned from [SI2M-Lab/DarijaBERT](https://huggingface.co/SI2M-Lab/DarijaBERT) on a manually POS-annotated Darija corpus, using a 15-tag tagset adapted to Darija morphology — including dialect-specific particles such as the progressive **كي** (`PROG_PART`), the future marker **غادي** (`FUT_PART`), and the discontinuous negation **ما … ش** (`NEG_PART`).
52
 
53
+ The model is released by [Typica.ai](https://typica.ai) as part of its applied research on **culturally localized AI for underserved languages**, and is **open-sourced for educational and research purposes**. It complements Typica.ai's Darija NLP suite (NER, sentiment, toxicity detection).
54
 
55
  ## Model Details
56
 
57
+ | | |
58
+ |---|---|
59
+ | **Developed by** | Hicham Assoudi Typica.ai |
60
+ | **Model type** | BERT-based token classification (POS tagging) |
61
+ | **Language** | Moroccan Darija (`ary`), Arabic script |
62
+ | **Base model** | [SI2M-Lab/DarijaBERT](https://huggingface.co/SI2M-Lab/DarijaBERT) |
63
+ | **License** | CC BY-NC 4.0 (non-commercial — education & research) |
64
+ | **Version** | v0.1 (preliminary) |
65
+ | **Released** | July 2026 |
66
+ | **Contact** | assoudi@typica.ai |
67
+
68
+ ### Tagset (15 tags)
69
+
70
+ | Tag | Meaning | Example (Darija) |
71
+ |-----|---------|------------------|
72
+ | `NOUN` | Noun | الولد، السوق، الفلوس |
73
+ | `V` | Verb | مشيت، كيلعب، نمشي |
74
+ | `ADJ` | Adjective | زوين، كبير |
75
+ | `ADV` | Adverb | غدا، بزاف، دابا |
76
+ | `PRON` | Pronoun | هو، ديالي، ها |
77
+ | `DET` | Determiner | ال، هاد، واحد |
78
+ | `PREP` | Preposition | ف، ل، على، من |
79
+ | `CONJ` | Conjunction | و، ولكن، حيت |
80
+ | `PART` | Particle (general) | را، واش |
81
+ | `PROG_PART` | Progressive/aspectual particle | كي، تا (كيلعب) |
82
+ | `FUT_PART` | Future particle | غادي، غا (غادي نمشي) |
83
+ | `NEG_PART` | Negation particle | ما، ش (ما عندي ش) |
84
+ | `NSUFF` | Noun suffix (inflection) | ة، ات، ين |
85
+ | `CASE` | Case marker | |
86
+ | `O` | Other (punctuation, numbers, URLs, mentions, emoticons, foreign tokens) | — |
87
+
88
+ ## Intended Uses
89
+
90
+ **Direct intended uses:**
91
+ - Research on morphosyntactic analysis of Moroccan Darija and Arabic dialects.
92
+ - Education: teaching token classification, subword/label alignment, and fine-tuning for low-resource languages.
93
+ - Preprocessing component in Darija NLP pipelines (e.g., feature extraction, chunking, linguistic annotation, corpus building).
94
+
95
+ **Out-of-scope uses:**
96
+ - ❌ Commercial deployment without a separate agreement with Typica.ai (license is non-commercial).
97
+ - Latin-script Darija (Arabizi), French, or English text: non-Arabic tokens were cleaned from training data.
98
+ - ❌ Modern Standard Arabic or other Arabic dialects — the tagset and training data are Darija-specific.
99
+
100
+ ## How to Use
101
+
102
+ ```python
103
+ from transformers import pipeline
104
+
105
+ pos_tagger = pipeline(
106
+ "token-classification",
107
+ model="TypicaAI/DarijaPOSTagger",
108
+ aggregation_strategy="first",
109
+ ignore_labels=[], # important: show 'O' predictions too (POS NER every word needs a tag)
110
+ )
111
+
112
+ sentences = [
113
+ "غادي نمشي للسوق غدا", # I will go to the market tomorrow
114
+ "شربت أتاي مع صحابي", # I drank tea with my friends
115
+ "ما عنديش الفلوس", # I don't have money
116
+ ]
117
+
118
+ for sentence in sentences:
119
+ print(f"\n{sentence}")
120
+ for token in pos_tagger(sentence):
121
+ print(f" {token['word']:<15} {token['entity_group']:<10} ({token['score']:.3f})")
122
+ ```
123
+
124
+ > ℹ️ **Input format matters.** The training corpus is *morpheme-segmented* (clitics like ال، ف، كي، ش appear as separate tokens), while raw Darija text fuses them into surface words (فالزنقة، عنديش). The model is noticeably more reliable on clitic-segmented input; on raw text, expect degraded accuracy on fused forms (see Preliminary Validation below). Also note that `aggregation_strategy` may merge adjacent same-label words into one span — for strict one-tag-per-word output, tokenize with `is_split_into_words=True` and read per-word predictions directly.
125
+
126
+ ## Training Data
127
+
128
+ The model was trained on a manually POS-annotated Moroccan Darija corpus in CoNLL-style format (one `token tag` pair per line, sentences separated by `EOS` markers).
129
+
130
+ **Preprocessing:**
131
+ - Tokens were cleaned with a character filter keeping Arabic script, digits, and basic punctuation.
132
+ - The original 22-tag scheme was simplified to 15 tags: formatting and non-linguistic tags (`WB`, `TB`, `EMOT`, `HASH`, `FOREIGN`, `MENTION`, `PUNC`, `URL`, `NUM`) were collapsed into a single `O` class, keeping the tagset focused on linguistically meaningful categories.
133
+ - Subword/label alignment: only the first subword of each word receives the word's label during tokenization (WordPiece), with special tokens masked at `-100`.
134
+
135
+ ### Splits
136
+
137
+ | Split | Sentences | Used for |
138
+ |-------|----------:|----------|
139
+ | Train | 1,225 | Fine-tuning |
140
+ | Dev | 175 | — |
141
+ | Test | 350 | — |
142
+ | Validation (dev + test merged) | 525 | Evaluation during training |
143
+
144
+ ## Training Procedure
145
+
146
+ - **Base checkpoint:** `SI2M-Lab/DarijaBERT` with a freshly initialized token classification head (15 labels)
147
+ - **Objective:** token-level cross-entropy (seqeval-based evaluation)
148
+ - **Hardware:** single T4 GPU (Google Colab)
149
+
150
+ **Hyperparameters:**
151
+
152
+ | Hyperparameter | Value |
153
+ |---|---|
154
+ | Learning rate | 2e-5 |
155
+ | Epochs | 10 |
156
+ | Weight decay | 0.01 |
157
+ | Eval/save strategy | per epoch |
158
+ | Data collator | `DataCollatorForTokenClassification` (dynamic padding) |
159
 
160
  ## Evaluation
161
 
162
+ ### Quantitative (in-corpus)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
 
164
+ On the validation split (525 sentences, dev + test merged), the model converges to near-perfect seqeval scores:
165
 
166
+ | Metric | Score |
167
+ |---|---:|
168
+ | Precision | ≈ 0.9999 |
169
+ | Recall | ≈ 0.9999 |
170
+ | F1 | ≈ 0.9999 |
171
+ | Token accuracy | ≈ 0.9999 |
172
 
173
+ > ⚠️ **Interpret with care.** The validation set is small, merges the original dev and test splits, and was used for checkpoint selection during training — it is not a clean held-out test set. Near-perfect scores reflect in-corpus fit on a small, homogeneous, morpheme-segmented corpus — not expected real-world accuracy. The qualitative validation below gives a more realistic picture.
174
 
175
+ ### Preliminary Validation (July 2026)
176
 
177
+ Manual spot-checks on **raw (unsegmented) everyday Darija sentences** — a harder condition than the segmented training data — showed a consistent pattern:
178
 
179
+ **What works well** — open-class words in canonical surface forms are tagged reliably, typically at ≥ 0.99 confidence:
180
 
181
+ | Word | Predicted | Confidence |
182
+ |---|---|---:|
183
+ | كيلعب | V | 1.000 |
184
+ | نمشي | V | 1.000 |
185
+ | شربت | V | 1.000 |
186
+ | غدا | ADV | 0.989 |
187
+ | الفلوس | NOUN | 0.998 |
188
+ | للسوق | NOUN | 0.999 |
189
 
190
+ **Known error patterns on raw text:**
191
 
192
+ | Input | Predicted | Expected | Likely cause |
193
+ |---|---|---|---|
194
+ | الولد | O (0.512) | DET+NOUN | Fused article ال unseen as one token |
195
+ | عنديش | ADV (0.582) | PREP+PRON+NEG_PART | Fused clitics (عند+ي+ش) unseen as one token |
196
+ | فالزنقة | (merged into NOUN span) | PREP+DET+NOUN | Fused preposition ف lost |
197
+ | غادي | PART (0.988) | FUT_PART | Closed-class near-miss |
198
+ | مع | CONJ (0.996) | PREP | Closed-class confusion, confidently wrong |
199
 
200
+ **Root cause:** a train/inference input mismatch. The corpus is morpheme-segmented (clitics as separate tokens — hence the `NSUFF` tag and clitic-level `NEG_PART`), so fused surface words are out-of-distribution at inference. Low confidence (≈ 0.5) on fused forms is a useful signal of this. Note also that closed-class errors (مع → CONJ) can be high-confidence, so confidence alone is not a reliability guarantee.
201
 
202
+ **Planned for v0.2:** an independent held-out evaluation on raw text, and either a paired rule-based clitic segmenter or retraining on de-segmented surface-word data.
203
 
204
+ ## Known Limitations & Bias
205
 
206
+ - **Preliminary release:** v0.1 is an educational baseline, not a production tagger. Error patterns above are documented, not yet fixed.
207
+ - **Segmentation mismatch:** best results require clitic-segmented input; raw text degrades accuracy on fused forms (fused articles, prepositions, and negation clitics).
208
+ - **Small training corpus:** 1,225 training sentences; limited coverage of rare constructions, regional sub-dialects, and domain vocabulary.
209
+ - **In-corpus evaluation:** the quantitative metrics overestimate real-world performance (see Evaluation).
210
+ - **Closed-class confusions:** some function words (e.g., مع، غادي) can be tagged incorrectly with high confidence.
211
+ - **Script coverage:** Arabic script only; Arabizi/Latin-script Darija is out of scope.
212
+ - **Tag granularity:** numbers, punctuation, URLs, mentions, and foreign words are collapsed into `O`.
213
 
214
+ ## Citation
215
 
216
+ No dedicated paper accompanies this model yet. If you use it, please cite the model directly:
217
 
218
+ ```bibtex
219
+ @misc{assoudi2026darijapostagger,
220
+ title = {DarijaPOSTagger v0.1: Part-of-Speech Tagging for Moroccan Darija (Preliminary Release)},
221
+ author = {Assoudi, Hicham},
222
+ year = {2026},
223
+ month = {July},
224
+ publisher = {Hugging Face},
225
+ organization = {Typica.ai},
226
+ url = {https://huggingface.co/TypicaAI/DarijaPOSTagger}
227
+ }
228
+ ```
229
 
230
+ Please also cite the base model:
231
 
232
+ ```bibtex
233
+ @article{gaanoun2023darijabert,
234
+ title = {DarijaBERT: a step forward in NLP for the written Moroccan dialect},
235
+ author = {Gaanoun, Kamel and Naira, Abdou Mohamed and Allak, Anass and Benelallam, Imade},
236
+ journal = {International Journal of Data Science and Analytics},
237
+ year = {2023},
238
+ doi = {10.1007/s41060-023-00498-2}
239
+ }
240
+ ```
241
 
242
+ ## Related Models by Typica.ai
243
 
244
+ - [MAGBERT-NER](https://huggingface.co/TypicaAI/magbert-ner) Named Entity Recognition for Moroccan Darija/French
245
+ - Darija Toxicity Detection — culturally grounded content moderation (see [arXiv:2505.04640](https://arxiv.org/abs/2505.04640))
246
 
247
+ ## Contact
248
 
249
+ **Hicham Assoudi** — Founder & Applied AI Researcher, Typica.ai · PhD (AI/NLP)
250
+ *Typica.ai* — Independent applied research initiative
251
+ 📧 assoudi@typica.ai · [Linkedin](https://www.linkedin.com/in/assoudi) . 🌐 [typica.ai](https://typica.ai) · 🤗 [TypicaAI on Hugging Face](https://huggingface.co/TypicaAI)