nahiar commited on
Commit
2d2810b
·
verified ·
1 Parent(s): 546d251

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +275 -3
README.md CHANGED
@@ -1,3 +1,275 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ task_categories:
4
+ - text-classification
5
+ language:
6
+ - id
7
+ tags:
8
+ - hate-speech-detection
9
+ - abusive-language
10
+ - text-classification
11
+ - indonesian
12
+ - social-media
13
+ - nlp
14
+ - content-moderation
15
+ - multi-label-classification
16
+ size_categories:
17
+ - 10K<n<100K
18
+ ---
19
+
20
+ # Indonesian Hate Speech Detection Dataset
21
+
22
+ ## Dataset Summary
23
+
24
+ This dataset contains **13,169 Indonesian tweets** annotated for hate speech detection and abusive language classification. The dataset provides comprehensive multi-label annotations covering different types of hate speech, target categories, and intensity levels, making it valuable for building robust content moderation systems for Indonesian social media.
25
+
26
+ ## Dataset Details
27
+
28
+ - **Total Samples**: 13,169 Indonesian tweets
29
+ - **Language**: Indonesian (Bahasa Indonesia)
30
+ - **Annotation Type**: Multi-label binary classification
31
+ - **Labels**: 12 different hate speech and abusive language categories
32
+ - **Format**: CSV file
33
+ - **Text Length**: 4-561 characters (average: 114 characters)
34
+
35
+ ## Label Categories
36
+
37
+ ### Primary Classifications
38
+ | Label | Description | Positive Cases | Percentage |
39
+ |-------|-------------|----------------|------------|
40
+ | `HS` | **Hate Speech** - General hate speech detection | 5,561 | 42.2% |
41
+ | `Abusive` | **Abusive Language** - Offensive or abusive content | 5,043 | 38.3% |
42
+
43
+ ### Target-Based Classifications
44
+ | Label | Description | Positive Cases | Percentage |
45
+ |-------|-------------|----------------|------------|
46
+ | `HS_Individual` | Hate speech targeting specific individuals | 3,575 | 27.1% |
47
+ | `HS_Group` | Hate speech targeting groups/communities | 1,986 | 15.1% |
48
+ | `HS_Religion` | Religious hate speech | 793 | 6.0% |
49
+ | `HS_Race` | Racial/ethnic hate speech | 566 | 4.3% |
50
+ | `HS_Physical` | Physical appearance-based hate speech | 323 | 2.5% |
51
+ | `HS_Gender` | Gender-based hate speech | 306 | 2.3% |
52
+ | `HS_Other` | Other types of hate speech | 3,740 | 28.4% |
53
+
54
+ ### Intensity Classifications
55
+ | Label | Description | Positive Cases | Percentage |
56
+ |-------|-------------|----------------|------------|
57
+ | `HS_Weak` | Weak/mild hate speech | 3,383 | 25.7% |
58
+ | `HS_Moderate` | Moderate hate speech | 1,705 | 12.9% |
59
+ | `HS_Strong` | Strong/severe hate speech | 473 | 3.6% |
60
+
61
+ ## Key Statistics
62
+
63
+ **Text Characteristics:**
64
+ - **Average tweet length**: 114 characters
65
+ - **Shortest tweet**: 4 characters
66
+ - **Longest tweet**: 561 characters
67
+ - **Language**: Indonesian (Bahasa Indonesia)
68
+
69
+ **Label Distribution:**
70
+ - **Balanced primary labels**: ~42% hate speech, ~38% abusive
71
+ - **Imbalanced target categories**: Physical (2.5%) to Individual (27.1%)
72
+ - **Severity pyramid**: Weak (25.7%) > Moderate (12.9%) > Strong (3.6%)
73
+
74
+ ## Use Cases
75
+
76
+ This dataset is ideal for:
77
+
78
+ - **Multi-label Text Classification**: Train models to detect multiple types of hate speech
79
+ - **Indonesian NLP**: Develop language-specific content moderation systems
80
+ - **Social Media Monitoring**: Build automated detection for Indonesian platforms
81
+ - **Severity Assessment**: Create models that classify hate speech intensity
82
+ - **Target Analysis**: Understand different targets of hate speech
83
+ - **Content Moderation**: Deploy real-time filtering systems
84
+ - **Research**: Study hate speech patterns in Indonesian social media
85
+
86
+ ## Quick Start
87
+
88
+ ```python
89
+ import pandas as pd
90
+ from sklearn.model_selection import train_test_split
91
+ from sklearn.feature_extraction.text import TfidfVectorizer
92
+ from sklearn.multioutput import MultiOutputClassifier
93
+ from sklearn.linear_model import LogisticRegression
94
+ from sklearn.metrics import classification_report
95
+
96
+ # Load dataset
97
+ df = pd.read_csv('data.csv')
98
+
99
+ # Prepare features and targets
100
+ X = df['Tweet']
101
+ y = df[['HS', 'Abusive', 'HS_Individual', 'HS_Group', 'HS_Religion',
102
+ 'HS_Race', 'HS_Physical', 'HS_Gender', 'HS_Other']]
103
+
104
+ # Split data
105
+ X_train, X_test, y_train, y_test = train_test_split(
106
+ X, y, test_size=0.2, random_state=42
107
+ )
108
+
109
+ # Vectorize text
110
+ vectorizer = TfidfVectorizer(max_features=10000, ngram_range=(1, 2))
111
+ X_train_vec = vectorizer.fit_transform(X_train)
112
+ X_test_vec = vectorizer.transform(X_test)
113
+
114
+ # Train multi-label classifier
115
+ classifier = MultiOutputClassifier(LogisticRegression(random_state=42))
116
+ classifier.fit(X_train_vec, y_train)
117
+
118
+ # Evaluate
119
+ y_pred = classifier.predict(X_test_vec)
120
+ print("Multi-label Classification Report:")
121
+ for i, label in enumerate(y.columns):
122
+ print(f"\n{label}:")
123
+ print(classification_report(y_test.iloc[:, i], y_pred[:, i]))
124
+ ```
125
+
126
+ ## Advanced Usage Examples
127
+
128
+ ### Intensity-Based Classification
129
+ ```python
130
+ # Focus on hate speech intensity levels
131
+ intensity_labels = ['HS_Weak', 'HS_Moderate', 'HS_Strong']
132
+ hate_speech_data = df[df['HS'] == 1] # Only hate speech samples
133
+
134
+ # Multi-class intensity classification
135
+ y_intensity = hate_speech_data[intensity_labels]
136
+ ```
137
+
138
+ ### Target-Specific Models
139
+ ```python
140
+ # Build specialized models for different targets
141
+ target_labels = ['HS_Individual', 'HS_Group', 'HS_Religion', 'HS_Race',
142
+ 'HS_Physical', 'HS_Gender', 'HS_Other']
143
+
144
+ # Train target-specific classifiers
145
+ for target in target_labels:
146
+ # Create binary classifier for each target type
147
+ pass
148
+ ```
149
+
150
+ ### Indonesian Text Preprocessing
151
+ ```python
152
+ import re
153
+
154
+ def preprocess_indonesian_text(text):
155
+ # Convert to lowercase
156
+ text = text.lower()
157
+
158
+ # Remove URLs
159
+ text = re.sub(r'http\S+|www\S+|https\S+', '', text, flags=re.MULTILINE)
160
+
161
+ # Remove user mentions and RT
162
+ text = re.sub(r'@\w+|rt\s+', '', text)
163
+
164
+ # Remove extra whitespace
165
+ text = re.sub(r'\s+', ' ', text).strip()
166
+
167
+ return text
168
+
169
+ # Apply preprocessing
170
+ df['Tweet_processed'] = df['Tweet'].apply(preprocess_indonesian_text)
171
+ ```
172
+
173
+ ## Model Architecture Suggestions
174
+
175
+ ### Traditional ML
176
+ - **TF-IDF + Logistic Regression**: Baseline multi-label classifier
177
+ - **TF-IDF + SVM**: Better performance on imbalanced classes
178
+ - **Ensemble Methods**: Random Forest or Gradient Boosting
179
+
180
+ ### Deep Learning
181
+ - **BERT-based Models**: Use Indonesian BERT (IndoBERT) for better performance
182
+ - **Multilingual Models**: mBERT or XLM-R for cross-lingual transfer
183
+ - **Custom Architecture**: BiLSTM + Attention for sequence modeling
184
+
185
+ ### Multi-task Learning
186
+ ```python
187
+ # Hierarchical classification approach
188
+ # 1. First classify: Normal vs Abusive vs Hate Speech
189
+ # 2. If Hate Speech: Classify target and intensity
190
+ # 3. Multi-task loss combining all objectives
191
+ ```
192
+
193
+ ## Evaluation Metrics
194
+
195
+ Given the multi-label and imbalanced nature:
196
+
197
+ ### Primary Metrics
198
+ - **F1-Score**: Macro and micro averages
199
+ - **AUC-ROC**: For each label separately
200
+ - **Hamming Loss**: Multi-label specific metric
201
+ - **Precision/Recall**: Per-label analysis
202
+
203
+ ### Specialized Metrics
204
+ ```python
205
+ from sklearn.metrics import multilabel_confusion_matrix, jaccard_score
206
+
207
+ # Multi-label specific metrics
208
+ jaccard = jaccard_score(y_true, y_pred, average='macro')
209
+ hamming = hamming_loss(y_true, y_pred)
210
+ ```
211
+
212
+ ## Data Quality & Considerations
213
+
214
+ ### Strengths
215
+ - ✅ **Comprehensive Labeling**: Multiple dimensions of hate speech
216
+ - ✅ **Large Scale**: 13K+ samples for robust training
217
+ - ✅ **Real-world Data**: Actual Indonesian tweets
218
+ - ✅ **Intensity Levels**: Enables nuanced classification
219
+ - ✅ **Multiple Targets**: Covers various hate speech types
220
+
221
+ ### Limitations
222
+ - ⚠️ **Class Imbalance**: Some categories <5% positive samples
223
+ - ⚠️ **Language Specific**: Limited to Indonesian context
224
+ - ⚠️ **Temporal Bias**: Tweet collection timeframe not specified
225
+ - ⚠️ **Cultural Context**: May not generalize across Indonesian regions
226
+
227
+ ## Ethical Considerations
228
+
229
+ **Content Warning**: This dataset contains hate speech and abusive language examples.
230
+
231
+ ### Responsible Use
232
+ - **Research Purpose**: Intended for academic and safety research
233
+ - **Content Moderation**: Building protective systems
234
+ - **Bias Awareness**: Monitor for demographic biases in predictions
235
+ - **Privacy**: Tweets should be handled according to platform policies
236
+
237
+ ### Not Suitable For
238
+ - Training generative models that could amplify hate speech
239
+ - Creating offensive content detection without human oversight
240
+ - Commercial use without proper ethical review
241
+
242
+ ## Related Work & Benchmarks
243
+
244
+ ### Indonesian NLP Resources
245
+ - **IndoBERT**: Pre-trained Indonesian BERT model
246
+ - **Indonesian Sentiment**: Related sentiment analysis datasets
247
+ - **Multilingual Models**: Cross-lingual hate speech detection
248
+
249
+ ### Benchmark Performance
250
+ Consider comparing against:
251
+ - Traditional ML baselines (TF-IDF + SVM)
252
+ - Pre-trained language models (mBERT, IndoBERT)
253
+ - Multi-task learning approaches
254
+
255
+ ## Citation
256
+
257
+ ```bibtex
258
+ @dataset{indonesian_hate_speech_2025,
259
+ title={Indonesian Hate Speech Detection Dataset},
260
+ year={2025},
261
+ publisher={Dataset From Kaggle},
262
+ url={https://huggingface.co/datasets/nahiar/indonesian-hate-speech},
263
+ note={Multi-label hate speech and abusive language detection for Indonesian social media}
264
+ }
265
+ ```
266
+
267
+ ## Acknowledgments
268
+
269
+ This dataset contributes to safer Indonesian social media environments and supports research in:
270
+ - Multilingual content moderation
271
+ - Southeast Asian NLP
272
+ - Cross-cultural hate speech patterns
273
+ - Social media safety systems
274
+
275
+ **Note**: Handle this sensitive content responsibly and in accordance with ethical AI principles.