T0KII's picture
Update README.md
a883f38 verified
|
Raw
History Blame Contribute Delete
5.63 kB
---
language:
- ar
license: cc-by-nc-4.0
tags:
- egyptian-arabic
- arabic
- sentiment-analysis
- sarcasm-detection
- emotion-recognition
- multi-task-learning
size_categories:
- 100K<n<1M
pretty_name: MASRISET V4 Downstream Split
task_categories:
- text-classification
---
# MASRISET-V4-DOWNSTREAM-SPLIT
## Dataset Description
**MASRISET-V4-DOWNSTREAM-SPLIT** is a multi-task dataset for Egyptian Arabic natural language understanding. It combines three complementary tasks:
| Task | Classes | Label Schema |
|------|---------|--------------|
| **Sentiment** | 3 | 0=Negative, 1=Neutral, 2=Positive |
| **Emotion** | 4 | 0=Anger, 1=Joy, 2=Neutral, 3=Sadness |
| **Sarcasm** | 2 | 0=Literal, 1=Sarcastic |
This dataset is specifically designed for **multi-task fine-tuning** of language models, enabling simultaneous training on all three tasks with zero cross-task leakage.
## Data Sources
| Source | Task | Size | Notes |
|--------|------|------|-------|
| Egyptian Fake Reviews | Sentiment + Toxicity | ~50K | E-commerce reviews with sentiment labels |
| Egyptian Sentiment Analysis | Sentiment | ~40K | Social media sentiment |
| ASTD / ArSAS | Sentiment | ~15K | General Arabic sentiment |
| ArSarcasm / iSarcasm | Sarcasm | ~23K | Sarcasm detection in Arabic tweets |
| Emotone-AR | Emotion | ~17K | 8-class emotion mapped to 4-class schema |
| Arabic Hate Speech / Offenseval | Toxicity | ~12K | Injected as Negative Sentiment + Anger/Sadness |
## Label Mapping for Emotion
The original Emotone-AR 8-class schema was mapped to a 4-class schema:
| Original | Mapped | Notes |
|----------|--------|-------|
| Anger (0) | Anger (0) | Direct |
| Fear/Disgust (1) | Sadness (3) | Negative valence |
| Joy (2) | Joy (1) | Direct |
| Neutral (3) | Neutral (2) | Direct |
| Sadness (4) | Sadness (3) | Direct |
| Surprise (5) | Neutral (2) | Ambiguous |
| Love (6) | Joy (1) | Positive valence |
| Sympathy (7) | Neutral (2) | Mixed |
## Toxicity Injection
Hate speech, offensive language, and toxic comments were injected with:
- **Sentiment**: Label = 0 (Negative)
- **Emotion**: Randomly assigned to Anger (0) or Sadness (3)
This ensures the model learns to recognize negative/aggressive language without needing a separate toxicity head.
## Dataset Construction
1. **Loading**: All datasets loaded from Hugging Face Hub and standardized
2. **Cleaning**: `clean_text_v4()` applied uniformly (removes Latin, diacritics, URLs, etc.)
3. **Deduplication**: Conflicting labels resolved via text deduplication
4. **Augmentation**:
- Sarcasm: Over-sampled minority class (2x)
- Sentiment: Downsampled for balance
- Emotion: Augmented 4x using word operations
5. **Leakage Prevention**: Validation and test sets rigorously purged of train-set texts
6. **Global Split**: 70/15/15 train/validation/test split
## Dataset Statistics
| Split | Size | Contains Tasks |
|-------|------|----------------|
| Train | 84,795 | Sentiment (100%), Sarcasm (22K), Emotion (39K) |
| Validation | 18,171 | All three |
| Test | 18,171 | All three |
| **Total** | **121,137** | |
### Class Distributions
**Sentiment** (Train):
- 2=Positive (42,871)
- 0=Negative (24,326)
- 1=Neutral (20,733)
**Sarcasm** (Train):
- 0=Literal (19,791)
- 1=Sarcastic (4,010)
**Emotion** (Train): Balanced across 4 classes (~9.8K each)
## Data Format
```json
{
"text": "الخدمة دى وحشة جدا مش هتعامل معاكم تانى",
"sentiment": 0,
"emotion": 0,
"sarcasm": 0
}
```
**Note**: Some entries may have missing labels (NaN) for certain tasks – this is intended for multi-task learning.
## Usage
### Loading the Dataset
```python
from datasets import load_dataset
dataset = load_dataset("T0KII/MASRISET-V4-DOWNSTREAM-SPLIT")
# Access splits
train = dataset["train"]
validation = dataset["validation"]
test = dataset["test"]
# Example with multi-task training
for example in train:
text = example["text"]
sentiment_label = example["sentiment"]
emotion_label = example["emotion"]
sarcasm_label = example["sarcasm"]
```
### For Multi-Task Fine-Tuning
```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch.nn as nn
class MultiTaskHead(nn.Module):
def __init__(self, base_model, num_sentiment=3, num_emotion=4, num_sarcasm=2):
super().__init__()
self.base = base_model
hidden_size = base_model.config.hidden_size
self.sentiment_head = nn.Linear(hidden_size, num_sentiment)
self.emotion_head = nn.Linear(hidden_size, num_emotion)
self.sarcasm_head = nn.Linear(hidden_size, num_sarcasm)
def forward(self, input_ids, attention_mask):
outputs = self.base(input_ids, attention_mask, output_hidden_states=True)
pooled = outputs.last_hidden_state[:, 0]
sentiment_logits = self.sentiment_head(pooled)
emotion_logits = self.emotion_head(pooled)
sarcasm_logits = self.sarcasm_head(pooled)
return sentiment_logits, emotion_logits, sarcasm_logits
```
## License
CC-BY-NC-4.0
## Citation
```bibtex
@misc{masriset-v4-downstream,
author = {T0KII},
title = {MASRISET-V4-DOWNSTREAM-SPLIT: A Multi-Task Egyptian Arabic Dataset for Sentiment, Emotion, and Sarcasm},
year = {2026},
publisher = {Hugging Face},
url = {https://huggingface.co/datasets/T0KII/MASRISET-V4-DOWNSTREAM-SPLIT}
}
```
## Acknowledgements
- IbrahimAmin for Egyptian fake reviews and hate speech datasets
- ehab215 for Egyptian sentiment dataset
- ArbML team for ASTD, ArSAS, TEAD, and iSarcasm
- Emotone-AR team for the emotion dataset
- NoraAlt for sarcasm dataset