fr3on commited on
Commit
5cc5f9e
·
verified ·
1 Parent(s): c19cfa1

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +481 -0
README.md CHANGED
@@ -23,3 +23,484 @@ configs:
23
  - split: train
24
  path: data/train-*
25
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  - split: train
24
  path: data/train-*
25
  ---
26
+
27
+ # Arabic Feedback Corpus
28
+
29
+ ## Dataset Description
30
+
31
+ This dataset contains **1,504 Arabic customer feedback entries** for sentiment analysis and quality assessment in the logistics domain. The data consists of real customer reviews about delivery services, courier performance, and order fulfillment experiences in Egyptian Arabic and Modern Standard Arabic.
32
+
33
+ ### Languages
34
+
35
+ * **Primary**: Egyptian Arabic (العامية المصرية)
36
+ * **Secondary**: Modern Standard Arabic (MSA)
37
+ * **Code**: ar, ar_EG
38
+
39
+ ## Dataset Summary
40
+
41
+ Customer feedback is crucial for service improvement and quality assurance. This dataset provides:
42
+
43
+ * Authentic customer reviews from logistics services
44
+ * Binary sentiment labels (positive/negative)
45
+ * Quality scores (1-5 scale)
46
+ * Conflict detection flags for quality control
47
+ * Real-world colloquial Egyptian Arabic expressions
48
+
49
+ ## Dataset Structure
50
+
51
+ ### Data Format
52
+
53
+ Each entry contains:
54
+
55
+ ```json
56
+ {
57
+ "text": "المندوب محترم جدا وسريع في التوصيل",
58
+ "label": "positive",
59
+ "score": 5.0,
60
+ "domain": "logistics",
61
+ "is_conflict": false
62
+ }
63
+ ```
64
+
65
+ ### Data Fields
66
+
67
+ | Field | Type | Description |
68
+ | --- | --- | --- |
69
+ | `text` | string | Customer feedback text in Arabic |
70
+ | `label` | string | Sentiment label ("positive" or "negative") |
71
+ | `score` | float | Quality rating (1.0 to 5.0) |
72
+ | `domain` | string | Content domain (always "logistics") |
73
+ | `is_conflict` | bool | Flag for label-score conflicts |
74
+
75
+ ### Field Details
76
+
77
+ #### `text`
78
+ Customer feedback ranging from 3 to 75 characters, containing:
79
+ - Delivery experience descriptions
80
+ - Courier behavior comments
81
+ - Service quality assessments
82
+ - Product condition feedback
83
+ - Timing and professionalism complaints/praise
84
+
85
+ #### `label`
86
+ Binary sentiment classification:
87
+ - **positive**: Satisfied customers, good experiences
88
+ - **negative**: Complaints, dissatisfaction, problems
89
+
90
+ #### `score`
91
+ Numerical rating on 1-5 scale:
92
+ - **5.0**: Excellent service
93
+ - **4.0**: Good service
94
+ - **3.0**: Average service
95
+ - **2.0**: Below average
96
+ - **1.0**: Poor service
97
+
98
+ #### `is_conflict`
99
+ Quality control flag indicating mismatch between label and score:
100
+ - **false**: Label and score are consistent
101
+ - **true**: Conflict detected (e.g., positive label with score 1.0)
102
+
103
+ ## Dataset Statistics
104
+
105
+ ### Overview
106
+
107
+ * **Total Entries**: 1,504
108
+ * **Positive Reviews**: ~35%
109
+ * **Negative Reviews**: ~65%
110
+ * **Conflicted Labels**: ~2%
111
+ * **Average Text Length**: 38.5 characters
112
+ * **Domain**: Logistics only
113
+
114
+ ### Label Distribution
115
+
116
+ | Label | Count | Percentage |
117
+ | --- | --- | --- |
118
+ | negative | ~978 | 65% |
119
+ | positive | ~526 | 35% |
120
+
121
+ ### Score Distribution
122
+
123
+ | Score | Count | Typical Label |
124
+ | --- | --- | --- |
125
+ | 1.0 | ~1,450 | negative |
126
+ | 5.0 | ~50 | positive |
127
+ | 2.0-4.0 | ~4 | varies |
128
+
129
+ ### Conflict Examples
130
+
131
+ Conflicted entries (where label contradicts score):
132
+
133
+ ```python
134
+ {
135
+ "text": "ممتاز وسرعة في الاداء",
136
+ "label": "positive",
137
+ "score": 1.0, # ← Conflict!
138
+ "is_conflict": true
139
+ }
140
+
141
+ {
142
+ "text": "المندوب بيبلغ بوقت وبيجي بعديها ب ٧ ساعات",
143
+ "label": "positive", # ← Conflict!
144
+ "score": 1.0,
145
+ "is_conflict": true
146
+ }
147
+ ```
148
+
149
+ ## Common Feedback Themes
150
+
151
+ ### Positive Feedback Topics
152
+ - ✅ Professional and respectful couriers
153
+ - ✅ Fast delivery
154
+ - ✅ Good communication
155
+ - ✅ Helpful service
156
+ - ✅ On-time arrival
157
+
158
+ ### Negative Feedback Topics
159
+ - ❌ Rude or unprofessional behavior
160
+ - ❌ Delivery delays
161
+ - ❌ Courier refusing to come upstairs
162
+ - ❌ Extra charges/tips demanded
163
+ - ❌ Not answering calls
164
+ - ❌ Poor product condition
165
+ - ❌ Wrong items delivered
166
+ - ❌ Courier attitude problems
167
+
168
+ ## Use Cases
169
+
170
+ ### ✅ Recommended Use Cases
171
+
172
+ * **Sentiment Analysis**: Train Arabic sentiment classifiers
173
+ * **Quality Assessment**: Predict service quality scores
174
+ * **Conflict Detection**: Identify inconsistent reviews
175
+ * **Egyptian Arabic NLP**: Understand colloquial expressions
176
+ * **Customer Service AI**: Build chatbots understanding complaints
177
+ * **Logistics Analytics**: Analyze delivery service quality
178
+ * **Multi-Task Learning**: Joint sentiment + score prediction
179
+ * **Data Quality Models**: Detect annotation inconsistencies
180
+
181
+ ### ⚠️ Limitations
182
+
183
+ * **Domain Specificity**: Limited to logistics/delivery domain
184
+ * **Geographic Scope**: Primarily Egyptian context
185
+ * **Label Noise**: Contains ~2% conflicted labels
186
+ * **Imbalanced Data**: 65% negative vs 35% positive
187
+ * **Size**: 1,504 entries (medium-sized dataset)
188
+ * **Score Distribution**: Heavily skewed toward 1.0 and 5.0
189
+
190
+ ## Loading the Dataset
191
+
192
+ ### Using Hugging Face Datasets
193
+
194
+ ```python
195
+ from datasets import load_dataset
196
+
197
+ # Load the dataset
198
+ dataset = load_dataset("fr3on/arabic-feedback-corpus")
199
+
200
+ # Access the data
201
+ print(dataset['train'][0])
202
+
203
+ # Filter by sentiment
204
+ positive_reviews = dataset['train'].filter(lambda x: x['label'] == 'positive')
205
+ negative_reviews = dataset['train'].filter(lambda x: x['label'] == 'negative')
206
+
207
+ # Filter clean data (no conflicts)
208
+ clean_data = dataset['train'].filter(lambda x: x['is_conflict'] == False)
209
+
210
+ # Filter by score
211
+ excellent_service = dataset['train'].filter(lambda x: x['score'] == 5.0)
212
+ poor_service = dataset['train'].filter(lambda x: x['score'] == 1.0)
213
+ ```
214
+
215
+ ### Using Pandas
216
+
217
+ ```python
218
+ import pandas as pd
219
+
220
+ # Load Parquet file directly
221
+ df = pd.read_parquet("hf://datasets/fr3on/arabic-feedback-corpus/data/train-00000-of-00001.parquet")
222
+
223
+ # Analyze sentiment distribution
224
+ print(df['label'].value_counts())
225
+
226
+ # Check for conflicts
227
+ conflicts = df[df['is_conflict'] == True]
228
+ print(f"Conflicted entries: {len(conflicts)}")
229
+
230
+ # Score statistics
231
+ print(df['score'].describe())
232
+
233
+ # Export filtered data
234
+ positive_df = df[df['label'] == 'positive']
235
+ positive_df.to_csv('positive_feedback.csv', index=False)
236
+ ```
237
+
238
+ ## Training Examples
239
+
240
+ ### Sentiment Classification
241
+
242
+ ```python
243
+ from datasets import load_dataset
244
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification, Trainer
245
+
246
+ # Load dataset
247
+ dataset = load_dataset("fr3on/arabic-feedback-corpus")
248
+
249
+ # Remove conflicted samples for clean training
250
+ clean_dataset = dataset['train'].filter(lambda x: not x['is_conflict'])
251
+
252
+ # Load Arabic BERT model
253
+ model_name = "asafaya/bert-base-arabic"
254
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
255
+ model = AutoModelForSequenceClassification.from_pretrained(
256
+ model_name,
257
+ num_labels=2 # positive/negative
258
+ )
259
+
260
+ # Tokenize
261
+ def preprocess(examples):
262
+ return tokenizer(
263
+ examples['text'],
264
+ truncation=True,
265
+ max_length=128,
266
+ padding='max_length'
267
+ )
268
+
269
+ tokenized = clean_dataset.map(preprocess, batched=True)
270
+
271
+ # Convert labels to numbers
272
+ label_map = {'negative': 0, 'positive': 1}
273
+ tokenized = tokenized.map(lambda x: {'label': label_map[x['label']]})
274
+
275
+ # Train
276
+ trainer = Trainer(
277
+ model=model,
278
+ train_dataset=tokenized,
279
+ )
280
+ trainer.train()
281
+ ```
282
+
283
+ ### Multi-Task Learning (Sentiment + Score)
284
+
285
+ ```python
286
+ from datasets import load_dataset
287
+ import torch.nn as nn
288
+
289
+ dataset = load_dataset("fr3on/arabic-feedback-corpus")
290
+ clean_data = dataset['train'].filter(lambda x: not x['is_conflict'])
291
+
292
+ # Multi-task model architecture
293
+ class MultiTaskModel(nn.Module):
294
+ def __init__(self, base_model):
295
+ super().__init__()
296
+ self.base = base_model
297
+ self.sentiment_head = nn.Linear(768, 2) # positive/negative
298
+ self.score_head = nn.Linear(768, 1) # score prediction
299
+
300
+ def forward(self, input_ids, attention_mask):
301
+ outputs = self.base(input_ids, attention_mask)
302
+ pooled = outputs.last_hidden_state[:, 0] # CLS token
303
+
304
+ sentiment = self.sentiment_head(pooled)
305
+ score = self.score_head(pooled)
306
+
307
+ return sentiment, score
308
+
309
+ # Train with both objectives
310
+ # sentiment_loss = CrossEntropyLoss()
311
+ # score_loss = MSELoss()
312
+ # total_loss = sentiment_loss + score_loss
313
+ ```
314
+
315
+ ### Conflict Detection
316
+
317
+ ```python
318
+ from datasets import load_dataset
319
+
320
+ dataset = load_dataset("fr3on/arabic-feedback-corpus")
321
+
322
+ # Train a model to detect annotation conflicts
323
+ # Features: text + predicted_label + predicted_score
324
+ # Target: is_conflict flag
325
+
326
+ def extract_features(example):
327
+ return {
328
+ 'text': example['text'],
329
+ 'label': example['label'],
330
+ 'score': example['score'],
331
+ 'target': example['is_conflict']
332
+ }
333
+
334
+ conflict_dataset = dataset['train'].map(extract_features)
335
+
336
+ # This can help identify:
337
+ # - Annotation errors
338
+ # - Sarcastic comments
339
+ # - Ambiguous feedback
340
+ ```
341
+
342
+ ## Data Collection & Processing
343
+
344
+ ### Source
345
+
346
+ * **Origin**: Real customer feedback from logistics services
347
+ * **Language**: Primarily Egyptian Arabic (colloquial)
348
+ * **Quality**: Authentic user-generated content
349
+
350
+ ### Annotation Process
351
+
352
+ 1. **Text Collection**: Customer reviews and feedback
353
+ 2. **Labeling**: Binary sentiment annotation (positive/negative)
354
+ 3. **Scoring**: Quality ratings on 1-5 scale
355
+ 4. **Conflict Detection**: Automated flag for label-score mismatches
356
+ 5. **Validation**: Quality checks and consistency reviews
357
+
358
+ ### Data Quality
359
+
360
+ * ✅ Real customer feedback (not synthetic)
361
+ * ⚠️ Contains ~2% label-score conflicts
362
+ * ✅ Text lengths validated (3-75 characters)
363
+ * ✅ Domain consistency (all logistics)
364
+ * ⚠️ Class imbalance (65% negative)
365
+
366
+ ## Considerations for Using the Data
367
+
368
+ ### Egyptian Arabic Characteristics
369
+
370
+ This dataset contains colloquial Egyptian expressions:
371
+
372
+ * **Informal spelling**: مش instead of ليس
373
+ * **Egyptian vocabulary**: مندوب، اوردر، شحنة
374
+ * **Mixed language**: Some English words (أوردر = order)
375
+ * **Abbreviated words**: ج for جنيه (Egyptian pound)
376
+
377
+ ### Handling Conflicts
378
+
379
+ The `is_conflict` flag identifies potential issues:
380
+
381
+ ```python
382
+ # Option 1: Exclude conflicts
383
+ clean_data = dataset.filter(lambda x: not x['is_conflict'])
384
+
385
+ # Option 2: Use conflicts for quality control training
386
+ conflicts = dataset.filter(lambda x: x['is_conflict'])
387
+
388
+ # Option 3: Manually review and correct
389
+ for item in conflicts:
390
+ # Review and fix annotations
391
+ pass
392
+ ```
393
+
394
+ ### Recommended Training Approaches
395
+
396
+ 1. **Balance the dataset** using oversampling or class weights
397
+ 2. **Remove conflicts** for cleaner training
398
+ 3. **Use Arabic-specific models** (AraBERT, MARBERT)
399
+ 4. **Consider dialectal variations** in preprocessing
400
+ 5. **Apply data augmentation** to address class imbalance
401
+
402
+ ### Ethical Considerations
403
+
404
+ * **Privacy**: Customer names and personal info removed
405
+ * **Bias**: Dataset reflects real customer experiences
406
+ * **Negativity bias**: More complaints than praise (common in feedback data)
407
+ * **Cultural context**: Egyptian service expectations and norms
408
+
409
+ ## Applications
410
+
411
+ ### Customer Service Automation
412
+
413
+ ```python
414
+ # Real-time sentiment analysis for support tickets
415
+ def analyze_feedback(text):
416
+ sentiment = model.predict(text)
417
+ if sentiment == 'negative' and score < 3.0:
418
+ # Escalate to human agent
419
+ priority = "high"
420
+ return sentiment, score, priority
421
+ ```
422
+
423
+ ### Quality Monitoring
424
+
425
+ ```python
426
+ # Track service quality trends
427
+ import pandas as pd
428
+
429
+ df = pd.read_parquet("data.parquet")
430
+ daily_scores = df.groupby('date')['score'].mean()
431
+
432
+ # Alert on quality drops
433
+ if daily_scores.last() < 3.0:
434
+ send_alert("Service quality declining")
435
+ ```
436
+
437
+ ### Training Data Annotation
438
+
439
+ ```python
440
+ # Use model to pre-annotate new data
441
+ new_feedback = ["المندوب كان ممتاز"]
442
+ predicted_label = model.predict(new_feedback)
443
+ # Human reviews and corrects predictions
444
+ ```
445
+
446
+ ## Common Arabic Tokens
447
+
448
+ **Positive indicators**:
449
+ - ممتاز (excellent)
450
+ - محترم (respectful)
451
+ - سريع (fast)
452
+ - كويس (good)
453
+ - شكرا (thanks)
454
+
455
+ **Negative indicators**:
456
+ - سيء (bad)
457
+ - اتأخر (delayed)
458
+ - قليل الذوق (rude, lit. "little taste")
459
+ - وحش (bad/ugly)
460
+ - مش (not)
461
+ - رفض (refused)
462
+
463
+ **Neutral/Context-dependent**:
464
+ - المندوب (the courier)
465
+ - الاوردر (the order)
466
+ - الشحنة (the shipment)
467
+ - وصل (arrived)
468
+
469
+ ## License
470
+
471
+ This dataset is released under the **Apache 2.0 License**.
472
+
473
+ ## Citation
474
+
475
+ If you use this dataset in your research, please cite:
476
+
477
+ ```bibtex
478
+ @dataset{arabic_feedback_corpus,
479
+ title={Arabic Feedback Corpus: Logistics Domain Sentiment Analysis},
480
+ author={fr3on},
481
+ year={2026},
482
+ publisher={Hugging Face},
483
+ url={https://huggingface.co/datasets/fr3on/arabic-feedback-corpus}
484
+ }
485
+ ```
486
+
487
+ ## Acknowledgments
488
+
489
+ * Source: Customer feedback from logistics services
490
+ * Annotation: Sentiment labels and quality scores
491
+ * Format: Parquet for efficient storage and loading
492
+
493
+ ## Version History
494
+
495
+ * **v1.0.0** (2025-01-06): Initial release
496
+ + 1,504 entries
497
+ + Binary sentiment labels
498
+ + 1-5 quality scores
499
+ + Conflict detection flags
500
+ + Parquet format
501
+
502
+ ---
503
+
504
+ **Keywords**: Arabic NLP, sentiment analysis, customer feedback, logistics, Egyptian Arabic, colloquial Arabic, quality assessment, conflict detection, delivery services
505
+
506
+ **Dataset Size**: 1,504 examples | **Format**: Parquet | **License**: Apache 2.0