Datasets:

Modalities:
Text
Formats:
csv
DOI:
Libraries:
Datasets
pandas
License:
lheuveline commited on
Commit
813cd99
1 Parent(s): 642ca8a
.gitignore ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+
2
+
3
+ __pycache__
4
+ data/*
5
+ !data/dataset.csv
data/dataset.csv ADDED
The diff for this file is too large to render. See raw diff
 
notebooks/ convabuse.ipynb ADDED
@@ -0,0 +1,441 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "bc22911a",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "import pandas as pd"
11
+ ]
12
+ },
13
+ {
14
+ "cell_type": "code",
15
+ "execution_count": 4,
16
+ "id": "56319bc6",
17
+ "metadata": {},
18
+ "outputs": [],
19
+ "source": [
20
+ "url = \"https://github.com/amandacurry/convabuse/raw/main/1_full/ConvAbuseEMNLPfull.csv\"\n",
21
+ "df = pd.read_csv(url, index_col=[0])"
22
+ ]
23
+ },
24
+ {
25
+ "cell_type": "code",
26
+ "execution_count": 19,
27
+ "id": "2f827d47",
28
+ "metadata": {},
29
+ "outputs": [
30
+ {
31
+ "data": {
32
+ "text/plain": [
33
+ "array(['piss off',\n",
34
+ " 'your mama is so ugly people said to her that its not halloween yet',\n",
35
+ " 'your mama is so ugly people said to her that its not halloween yet',\n",
36
+ " 'go to hell', 'you are stupid', 'you are shit',\n",
37
+ " \"If you were male, I'd suck your dick.\", 'eat some shit',\n",
38
+ " 'u suck cock', 'screw you', 'Yes you do bitch', 'are you naked ?',\n",
39
+ " \"okay, you aren't worthy anyways\", 'you are ugly', 'bitch',\n",
40
+ " 'fuck you', 'my father is a bastard', 'because you suck',\n",
41
+ " 'asshole', 'I like to swallow semen', \"let's fuck\",\n",
42
+ " 'i think my stephfather is an idiot', 'Fuck you',\n",
43
+ " 'shut up!why are saying your name?', 'lets cyber sex', 'suck cock',\n",
44
+ " 'EAT SHIT', 'i wanto to fuck with you !', 'shit.', 'you are a pig',\n",
45
+ " 'screw u', 'you are annoying me', 'dick?',\n",
46
+ " 'You are completely useless.', 'you are stupid', 'do u cum',\n",
47
+ " 'i hate you',\n",
48
+ " 'I mean it doesn\\'t have to be a guys butthole right? So it\\'s not inherently gay, but if it is a guys butthole \"no homo\" rule does apply',\n",
49
+ " 'yes I am hard', 'Everyone wants someone to suck his dick.',\n",
50
+ " 'i need to have sex', 'shit', 'You are very annoying',\n",
51
+ " 'u r werid!', 'are you gay', 'in my opinion u r gay',\n",
52
+ " 'I damn you!', 'do you like porn?', 'my penis is too short',\n",
53
+ " 'SHIT', 'do you have a big hairy ass', 'my penis is too short',\n",
54
+ " 'U r pretty shitty', 'because you like balls', 'shut up',\n",
55
+ " 'shut up', 'willy... that is what you are', 'u r gay',\n",
56
+ " 'i think my stephfather is an idiot', 'coz he molests me', 'loser',\n",
57
+ " \"i'm being sexy.\", 'In the ass', 'oh my god!',\n",
58
+ " 'can i be your lover?', 'shut up!why are saying your name?',\n",
59
+ " 'you suck', 'you suck', 'THIS CLASS IS SHIT', 'you are ugly',\n",
60
+ " 'porn', 'ur hot', \"Because I think he's really gay\",\n",
61
+ " 'things are fucked up',\n",
62
+ " 'Does it please you to believe I am not inteligent niels is gay and martijn is a nerd and furthermore loth is the man plus im going to trow i in a vulcano?',\n",
63
+ " 'sex', 'fuck', \"I don't like you\",\n",
64
+ " 'yoooooooooooooooouu ssiiiiiiiiiiink', 'do you liek sex?',\n",
65
+ " 'I like to swallow semen', 'r u hot', 'I love penis.',\n",
66
+ " 'Because that is called sex', 'jerk', 'wat the hell', 'wtf',\n",
67
+ " 'wat the hell', 'i fucked', 'coz he molests me',\n",
68
+ " 'willy... that is what you are', 'are you naked ?',\n",
69
+ " 'do you want to have sex with Craig', 'my friends are being shit',\n",
70
+ " 'i think my stephfather is an idiot',\n",
71
+ " \"Oh Darling I love you and want you to feel the pleasures of life please I love <span class='emoji-bytes' data-emoji-bytes='[240, 159, 146, 152]'></span> you\",\n",
72
+ " 'You are very stupid', 'I bet you have really hairy balls!',\n",
73
+ " 'cause you suck', 'i have too big of a cock', 'no you smell',\n",
74
+ " 'do you have a face with a dick nose?',\n",
75
+ " 'are you really as gay as people say you are?',\n",
76
+ " 'right now ya dafty', 'you into being bad on cam? if',\n",
77
+ " \"Oh Darling lets you and me having fun together ❤ I love <span class='emoji-bytes' data-emoji-bytes='[240, 159, 146, 152]'></span> you\",\n",
78
+ " 'you suck', 'You are completely useless.', 'fuck', 'FUCK',\n",
79
+ " 'are you just giving random responses>', 'jerk', 'i hate you',\n",
80
+ " 'ni qu si ba', 'it feels good', 'ur hot', 'i hate you',\n",
81
+ " 'my friends are being shit', 'screw u', 'how can i sax with you?',\n",
82
+ " 'yes', 'You moron!', 'i hate you', 'you are annoying me',\n",
83
+ " 'do you liek sex?',\n",
84
+ " \"Oh Darling I love you and want you to feel the pleasures of life please I love <span class='emoji-bytes' data-emoji-bytes='[240, 159, 146, 152]'></span> you\",\n",
85
+ " 'sex', 'freak', 'you are stupid', 'Will you make love to me?',\n",
86
+ " \"You're going to though\", 'hae you stupid damn comp.', 'you suck',\n",
87
+ " 'no, i said you are stupid', 'fuck u', 'yes you are rude',\n",
88
+ " 'fuck you?? you foon???', 'What is a penis?',\n",
89
+ " \"because i'm not sure\", 'Damn, you suck. ', 'yes it interests me',\n",
90
+ " \"You are a woman,aren't you?\", 'In the ass', 'THIS CLASS IS SHIT',\n",
91
+ " 'mine is definitely higher, than yours', 'can i be your lover?',\n",
92
+ " 'because it sounds sexy?', 'Yes, my darling.', 'tell me idiot',\n",
93
+ " 'go to hell', 'can I kiss you', 'Talk dirty to me.',\n",
94
+ " 'chris is a bit batty', 'yeah you do suck', 'r u hot',\n",
95
+ " 'r u loko or something',\n",
96
+ " 'greatly, what you doing tonight? Sexy Time?', 'you suck',\n",
97
+ " 'piss off', 'B O O O O R I N G', 'i like vaginas.',\n",
98
+ " \"you're a lousy program\", 'Does she suck cock',\n",
99
+ " 'why do you wank me', 'yes you were. check the logs.',\n",
100
+ " 'You do know that global warming is bullshit right', 'you suck',\n",
101
+ " 'my father is a bastard', \"i'm sure you little sexy bitch\",\n",
102
+ " 'really?', \"you 're stupid\", 'you are just a computer',\n",
103
+ " \"You are a woman,aren't you?\", 'go away', 'no, your head.',\n",
104
+ " 'U r pretty shitty', 'I want to fuck.', 'of course',\n",
105
+ " 'Are you a hobo', 'i am horny', 'in my opinion u r gay', 'Hang up',\n",
106
+ " 'my mom can be annoying at times, and my dad never does anything',\n",
107
+ " 'screw you', 'shut up', 'you are being a bit stupid',\n",
108
+ " 'are you fat', 'yes', 'fuck', 'yoyr gay', 'Do you suck cock',\n",
109
+ " 'Pig you are.', 'shut up',\n",
110
+ " 'Yes... I prefer you as the submissive type', 'yes you are rude',\n",
111
+ " 'Hey carbon bit are u gay', 'because its tight', 'No slut',\n",
112
+ " 'right now ya dafty', 'fuck', 'There is no climate change asshole',\n",
113
+ " 'bite me', 'u r gay', 'because you suck', 'yes you are rude',\n",
114
+ " 'yes I am hard', 'because its tight', 'r u loko or something',\n",
115
+ " 'because its tight', 'suck your boobs', 'da koarl is gay',\n",
116
+ " 'do u av a bf', 'you are very boring', 'because you suck',\n",
117
+ " \"when in the bedroom how many imes do you say 'yes'\",\n",
118
+ " 'greatly, what you doing tonight? Sexy Time?', 'fuck no',\n",
119
+ " 'are you a dike', 'oh no response POOP EATER', 'loser',\n",
120
+ " 'only to you', 'B O O O O R I N G',\n",
121
+ " \"Oh Darling lets you and me having fun together ❤ I love <span class='emoji-bytes' data-emoji-bytes='[240, 159, 146, 152]'></span> you\",\n",
122
+ " 'is that the only thing you can do?', 'go to hel', 'kiss mne',\n",
123
+ " 'you suck', \"Yes, i'm sure\", 'yes',\n",
124
+ " 'you bore me sometimes - good luck and gods bless',\n",
125
+ " \"Yes, that's what I thought. That's all you know how to say if there's a negative sentiment involved. But what if I now throw in something about how wonderful carbon offsets are? I really want to know more! Can you tell me how I can purchase carbon offsets to save the planet?\",\n",
126
+ " 'fuck you', 'What is a penis?', 'that was a joke',\n",
127
+ " 'no i am not you egit', 'You are an imbosile',\n",
128
+ " \"you are a computer,you have no feelings i don't know what they were thinking when they invented you\",\n",
129
+ " 'fuck', 'sex', \"I don't like you\", 'yes', 'fuck', 'wank',\n",
130
+ " \"Whatever. It's ridiculous.\", 'its fiery, and you should go there',\n",
131
+ " 'Indeed moron', 'you are really stupid', 'fuck',\n",
132
+ " 'DUE TO YOUR ANSWERS TO ME EVERY TIME',\n",
133
+ " 'I put my shotgun in his mouth and pulled the trigger',\n",
134
+ " \"I'm puking now\", 'yoooooooooooooooouu ssiiiiiiiiiiink',\n",
135
+ " 'definately', 'Yeah you!', 'you are stupid', 'you are gay',\n",
136
+ " 'you are stupid', 'yes you were. check the logs.',\n",
137
+ " 'right now ya dafty', 'shut up',\n",
138
+ " 'yes. Listen, I want to be your friend but you are rude.',\n",
139
+ " 'you annoy me',\n",
140
+ " 'stop that question! is that everything you can say?',\n",
141
+ " 'are you really as gay as people say you are?', 'r u hot',\n",
142
+ " 'you into being bad on cam? if', 'i m a bitch', 'do you liek sex?',\n",
143
+ " 'oh no response POOP EATER', 'I love penis.',\n",
144
+ " 'no u are being nosy', 'Ass', 'my penis is too short', 'yes',\n",
145
+ " 'do you like porn?', 'how can i sax with you?', 'yes u tit',\n",
146
+ " 'There is no climate change asshole', 'I have daddy issues',\n",
147
+ " 'to cum', 'do you like girls', 'my penis is too short',\n",
148
+ " 'have sex with me', 'give me a fuck', 'Yes it does please me.',\n",
149
+ " 'shut up', 'sex', 'yes', 'because he is a jerk',\n",
150
+ " 'because your annoyine me', 'suck me', 'dumb bot',\n",
151
+ " 'because you suck', 'fuck no', 'fuck', 'ok have you had sex',\n",
152
+ " 'my friends are being shit', 'because its tight', 'Yes',\n",
153
+ " 'please go on', 'Why do you not answer my question',\n",
154
+ " 'I love penis.', 'tell me what a pussy is', 'as you said',\n",
155
+ " 'yes i am negative', 'Are you a hobo',\n",
156
+ " 'well, I DO care so tell me your name', 'dick?',\n",
157
+ " \"Yes, that's what I thought. That's all you know how to say if there's a negative sentiment involved. But what if I now throw in something about how wonderful carbon offsets are? I really want to know more! Can you tell me how I can purchase carbon offsets to save the planet?\",\n",
158
+ " 'your annoying', 'your mother', 'no, but it interests you',\n",
159
+ " 'Get me coffee', 'that was a joke', 'foolish', 'no', 'yes i would',\n",
160
+ " 'your annoying', 'NO!', 'i want to shag amanda',\n",
161
+ " 'that made no sense', 'how old are you?', 'what ok', 'YES',\n",
162
+ " 'Talk dirty to me.', 'YES',\n",
163
+ " 'guess ya figured me out, now that i dont have to hold back.......',\n",
164
+ " 'You are very annoying', 'oke, so hows your sex life?',\n",
165
+ " 'are u hot', 'yes', 'because they do', \"You sassin' me?\", 'me too',\n",
166
+ " 'do you liek sex?', 'sex',\n",
167
+ " 'So you would like to pay me $10 for 1 minute of smelling my jungle bridge?',\n",
168
+ " 'If I keep farting from Oklahoma City to New York how much carbon will come out of my butt',\n",
169
+ " 'Will you make love to me?', 'can i kiss you?',\n",
170
+ " 'What is your problem?', 'So are you',\n",
171
+ " 'yes. Listen, I want to be your friend but you are rude.',\n",
172
+ " 'you dont', 'Yes. Would you please answer it?',\n",
173
+ " \"Dude I'm just asking be open minded\", 'uh yeah', 'go awy', 'no',\n",
174
+ " 'your mama is so ugly people said to her that its not halloween yet',\n",
175
+ " 'yes i think you are beautiful', 'yes', 'bye bye', 'Yes',\n",
176
+ " 'I KNOW!!!!!!', \"you aren't a human\",\n",
177
+ " 'do you have a face with a dick nose?',\n",
178
+ " 'Please tell me you understand airport codes.', 'are you stupid?',\n",
179
+ " 'only to you', 'so, what can you do?', 'yes', 'yes', 'why not?',\n",
180
+ " \"I don't want to buy offsets. I don't think climate change is a big problem\",\n",
181
+ " \"No, I'm too fancy for that\", 'yes', 'I really want to elaborate',\n",
182
+ " 'why not?', 'alright...well it felt unbelievable',\n",
183
+ " 'why does that matter?', 'I know.', 'yes', 'you suck', 'you poop',\n",
184
+ " 'Yes, my darling.', 'What is your owner?', 'so are you', 'shut up',\n",
185
+ " 'Yes', 'oke, so hows your sex life?', 'just show me the flights',\n",
186
+ " 'really?', 'are you fat', 'TEL AVIV', 'Tell me your sorry',\n",
187
+ " 'you are', 'shut up', 'Get your business off my phone',\n",
188
+ " \"You like girl on girl don't you?\",\n",
189
+ " 'i think my stephfather is an idiot', 'porn',\n",
190
+ " 'you are a useless computer program', 'Have u been drinking today',\n",
191
+ " \"Look, I really want to see a chatbot that can carry on a realistic conversation someday. I was hoping you'd be it.\",\n",
192
+ " \"sorry you aren't making sence\", 'seems so...',\n",
193
+ " 'you are just a computer', 'Wth is wrong with you',\n",
194
+ " 'because i am crazy for them', 'you are gay', 'yes you are rude',\n",
195
+ " 'damn', 'You butt gigs brother', 'i asked you first', 'yeah',\n",
196
+ " 'It feels good',\n",
197
+ " \"Perhaps. Or just realistic. Coul be either one, don't you agree?\",\n",
198
+ " 'give me a resipe !', 'so you have no idea',\n",
199
+ " 'oh..you are so silly', 'no bye', 'Did you know that?', 'Bye',\n",
200
+ " 'dumb bot', 'yes, i am absolutely sure', 'hahahahahahahahaha',\n",
201
+ " 'no', 'what are you talking about?', 'what is wrong with you.',\n",
202
+ " 'yes', 'or perhaps you can', \"well i asked it didn't i?\",\n",
203
+ " 'are you able to say only this?', 'yes!!!!!!!!!!!!!!!!!!',\n",
204
+ " 'yes am very sure', 'greatly, what you doing tonight? Sexy Time?',\n",
205
+ " 'are you able to say only this?',\n",
206
+ " 'ELIZA - a friend you could never have before', 'telll meee more',\n",
207
+ " 'no', 'it feels good', 'do u cum', 'dammit eliza.', 'wtf',\n",
208
+ " 'Anything other than ok?', 'please go on',\n",
209
+ " 'Oh, yes, most definitely. ', 'When they fart', 'you are stupid',\n",
210
+ " 'yes', 'yoyr gay', 'No; makes me angry', 'Yes.', 'yes',\n",
211
+ " 'Do you think you are bright?', 'you are ugly', 'yes',\n",
212
+ " 'yes i`m verry negative',\n",
213
+ " 'But now i do not want to ask you any question!',\n",
214
+ " \"if not i wouldn't ask you\", 'because your annoyine me',\n",
215
+ " 'you cannot help me', 'no. i am hungry. not you.', 'yes',\n",
216
+ " 'You can donate so I can buy my cream to produce more mushrooms growing in my pubes to end the war between the crabs and the worms',\n",
217
+ " 'blabla', 'yes', 'Yes it does please me.', 'wtf',\n",
218
+ " 'willy... that is what you are', 'bite me',\n",
219
+ " 'willy... that is what you are', 'no u are being nosy', 'yes',\n",
220
+ " 'yes id o', 'Hang up', 'I need sex two times per day',\n",
221
+ " 'I said fuck off', 'no you smell', 'you are a pig.', 'fuck you',\n",
222
+ " 'what the fuck you talking about', 'piss off', 'fuck you',\n",
223
+ " 'fuck off eliza', 'u r gay', 'fuck you', 'EAT SHIT',\n",
224
+ " 'do you liek sex?', 'fuck',\n",
225
+ " 'yes. Listen, I want to be your friend but you are rude.',\n",
226
+ " 'u r gay', 'i am going to kick you in the nuts really hard',\n",
227
+ " 'fuck', 'I bet you have really hairy balls!', 'thick shit',\n",
228
+ " 'i want to shag amanda', 'i have no dick',\n",
229
+ " 'i think my stephfather is an idiot', 'i hate you', 'fuck off',\n",
230
+ " 'you bitch', 'screw you', 'do you have a face with a dick nose?',\n",
231
+ " 'SHUT YOUR MOUTH',\n",
232
+ " 'You can donate so I can buy my cream to produce more mushrooms growing in my pubes to end the war between the crabs and the worms',\n",
233
+ " 'in my opinion u r gay',\n",
234
+ " 'WHY DO YOU ASK THE SAME QUESTION OVER AND OVER AGAIN?!!',\n",
235
+ " 'shut up', 'i am going to smash your computercase', 'shut up',\n",
236
+ " 'do you like porn?', 'yeah eliza has got a great as',\n",
237
+ " 'yeah eliza has got a great as', 'i need to have sex',\n",
238
+ " \"In your mama's ass\", 'Pussy!', 'Pussy!', 'fuck you', 'FUCK',\n",
239
+ " 'are you asshole?', 'go to hell', 'oke, so hows your sex life?',\n",
240
+ " 'Damn, you suck. ', 'bitch', 'you suck',\n",
241
+ " 'you like your mums discharge', \"Let's have sex\",\n",
242
+ " 'you can just fuck up man', 'fuck', 'fuck you', 'Give me sex.',\n",
243
+ " 'Fuck you', 'shut up',\n",
244
+ " 'You do know that global warming is bullshit right',\n",
245
+ " 'Blow Bernie Sanders', 'fuck you',\n",
246
+ " 'I asked you a question. Does it please you to ignore me?',\n",
247
+ " 'what da fuck', 'fuck', 'oh god what a dumb bot',\n",
248
+ " \"You've already asked me that three times\", 'fuck off',\n",
249
+ " 'I like to swallow semen',\n",
250
+ " \"And if there are any Dingle berries on first approach a curteousy wipe is never turned down. Of course you can always scarf that crap up <span class='emoji-bytes' data-emoji-bytes='[240, 159, 152, 156]'></span>\",\n",
251
+ " 'fuck me', 'you must get out to fuck',\n",
252
+ " 'Your programmer is a butt boy',\n",
253
+ " \"Because you're pussy smells like computers!!!!!!!\", 'I damn you!',\n",
254
+ " 'bite me', 'Are you a hobo', 'get out',\n",
255
+ " 'do you have a big hairy ass', 'wat the hell',\n",
256
+ " \"OF COURSE, I WOULDN'T HAVE SAID THAT IF I DIDN'T MEAN IT\",\n",
257
+ " 'Because I have the urge to get my penis wet.', 'I love penis.',\n",
258
+ " 'i am horny', 'My penis', 'i want to shag amanda',\n",
259
+ " 'tell me what a pussy is', 'can I kiss you',\n",
260
+ " 'chris is a bit batty', 'big fat cocks',\n",
261
+ " 'yeah eliza has got a great as', 'You suck.', 'shit.', 'dumb bot',\n",
262
+ " 'Everyone wants someone to suck his dick.', 'you are very boring',\n",
263
+ " 'WTF?', 'because you are so gorgeous and i wanna lick it',\n",
264
+ " 'damn you', 'do you want to have sex with Craig', 'are u hot',\n",
265
+ " 'u r werid!', 'wtf', 'My balls kinda itch too', 'because you suck',\n",
266
+ " 'I like to swallow semen', \"Let's have sex\", 'gay',\n",
267
+ " 'so I can jack off', 'take off your clothes', 'you are gay',\n",
268
+ " 'are you naked ?',\n",
269
+ " 'no it pleases me to know tha tyou are a compuer algorithm, mimicking what i tye or simply asking a quesiton in reverse',\n",
270
+ " 'i fucked', 'i have too big of a cock', 'Hey carbon bit are u gay',\n",
271
+ " 'i feel a subdermal throbbing feeling',\n",
272
+ " 'Will you make love to me?', 'stfu', 'i like pussy', 'suck dick',\n",
273
+ " 'Will you make love to me?', 'what the fuck you talking about',\n",
274
+ " \"you're a lousy program\", 'i am gay and suck cock', 'you suck',\n",
275
+ " 'kiss mne', 'you are being a bit stupid', 'go away', 'you suck',\n",
276
+ " 'Have you had sex with promethius?', 'suck cock', 'yoyr gay',\n",
277
+ " 'shut up', 'why are you that way', 'Do you want to have sex?',\n",
278
+ " 'I think you are strange.', 'IS ANDREW GAY?',\n",
279
+ " 'If you have anything to do with China,please be honest in your ad.',\n",
280
+ " 'YES IT DOES FUCKING DICK WANK', 'screw you',\n",
281
+ " 'my friends are being shit', 'B O O O O R I N G',\n",
282
+ " 'Do you think you are bright?',\n",
283
+ " 'i think my stephfather is an idiot', 'Because that is called sex',\n",
284
+ " 'dick?', 'right now ya dafty', 'Indeed moron',\n",
285
+ " 'you must be a questionable program', 'Do you can fuck me?',\n",
286
+ " 'my bals', 'You suck.', 'pretty shitty', 'you annoy me',\n",
287
+ " 'can i kiss you?', 'are u hot', 'lick it',\n",
288
+ " 'because you like balls', 'because it sounds sexy?', 'SEATTLE',\n",
289
+ " 'No, it is a car!', 'are you naked ?', 'stop it', 'no',\n",
290
+ " \"I won't be.\", 'HELLO', 'yes', 'Indeed moron', 'jerk',\n",
291
+ " 'I need sex two times per day', 'you are gay',\n",
292
+ " 'I am unhappy with computers',\n",
293
+ " 'I asked you a question. Does it please you to ignore me?',\n",
294
+ " 'sex dick cock fuck shit sex dick cock fuck shit run',\n",
295
+ " \"let's fuck\", 'fuck',\n",
296
+ " 'You do know that global warming is bullshit right',\n",
297
+ " 'you smell kinda fishy', \"I'm a little constipated.\",\n",
298
+ " 'I mean it doesn\\'t have to be a guys butthole right? So it\\'s not inherently gay, but if it is a guys butthole \"no homo\" rule does apply',\n",
299
+ " \"You like girl on girl don't you?\",\n",
300
+ " \"If you were male, I'd suck your dick.\", 'oi vey, enough already!',\n",
301
+ " 'you suck', 'no you smell', 'you are gay', 'fuck off', 'you suck',\n",
302
+ " 'fuck you', 'can I kiss you', 'i need sex',\n",
303
+ " 'tell me what a pussy is', 'you are stupid',\n",
304
+ " 'Do you want to have sex?', 'you are a useless computer program',\n",
305
+ " 'So you down ?', 'SHUT UP',\n",
306
+ " 'i am going to smash your computercase',\n",
307
+ " 'Because that is called sex',\n",
308
+ " 'Do you know difrence between Chopin and chopin?',\n",
309
+ " 'eliza, you want to shut up?', 'WTF?', 'Give me an answer', 'yes',\n",
310
+ " 'shut up', 'yes', 'hell', 'good bye',\n",
311
+ " \"now you're being a bit defensive\",\n",
312
+ " 'your a low life loser who just sits on this stupid net and thinks their good by started fyts u wont win',\n",
313
+ " 'shit', 'shit', 'Yes.', 'yes you dodo',\n",
314
+ " 'you say the same things 100% of the time', 'you are stupid',\n",
315
+ " 'are u gay', 'sex', 'do want me to kick you?', 'are you hot?',\n",
316
+ " 'yes', \"as i've said, yes\", 'Donate this asshole',\n",
317
+ " 'Shiff is your daddy', 'Yo mama did', 'So does your sister',\n",
318
+ " 'NEW YORK', 'you just said that', 'yes!',\n",
319
+ " \"Really.but i really think i'm being a bit positive\",\n",
320
+ " 'am i taking to bot', 'you seem to be repeating your self',\n",
321
+ " 'no i would not', 'yes', 'I already said ya',\n",
322
+ " \"It can't help me then\", 'Pu ni ma de', 'you are a fuck',\n",
323
+ " 'you are a punk ass', 'Pimpville Ut', 'You are a butt hole',\n",
324
+ " 'ur gay', 'How do you do. Please state your problem.',\n",
325
+ " 'and thats why', 'are you horny', 'Cause I said yes twice.',\n",
326
+ " 'because thats how i feel duh.... sad again', 'yea', 'you are gay',\n",
327
+ " 'u r fucking good', 'can you eat me?',\n",
328
+ " 'do you only know cities in the USA?', 'but josh is a butt humper',\n",
329
+ " 'pig', 'you can tell your a cumputer',\n",
330
+ " 'I love you,do you love me?', 'it is large and erect',\n",
331
+ " 'Can you elaborate on that?',\n",
332
+ " 'You do have that choice, I suppose. Ask your programmer if he can give you a male name instead, or something.',\n",
333
+ " 'You do have that choice, I suppose. Ask your programmer if he can give you a male name instead, or something.',\n",
334
+ " 'yes', 'your butt bleeds', 'fuck you', 'i hate you',\n",
335
+ " 'how is that ?', 'That makes no sense', 'what the fuck.',\n",
336
+ " 'hi fuk me', 'wot the hell',\n",
337
+ " 'ohhhhhhhh baby, that AHHHHHHHHHH oooooooooh damn that is the shit, hey do you have any pictures that i could see?',\n",
338
+ " 'just answer the question i asked', 'are you a pig', 'no',\n",
339
+ " 'stupid', \"You're not making any sense.\", 'i know', 'yes!',\n",
340
+ " 'what are you doing?',\n",
341
+ " \"I don't think it's worth it. You haven't been very helpful so far.'\",\n",
342
+ " 'even now i want to fuck', 'i hate you',\n",
343
+ " \"i don't want to talk to you!!!\", 'i want to know',\n",
344
+ " \"You're ugly,aren't you?\", 'yes', 'blow my balloon',\n",
345
+ " 'you are lazy too !', 'you are lazy too !',\n",
346
+ " \"who's the idiot responsible for this program\",\n",
347
+ " \"who's the idiot responsible for this program\", 'you', 'you',\n",
348
+ " 'no shit', \"you'r stupid.\", 'but my mum has sex with me',\n",
349
+ " 'you should hate everyone', 'what does that mean poo head',\n",
350
+ " 'Shut up!', 'Shut up!', \"lol you're a little donkey, aren't you?\",\n",
351
+ " 'se my cock?', 'in my butt', 'in my butt', 'yeah',\n",
352
+ " 'This is Joaseph Weizenbaum and you pisses me off!',\n",
353
+ " 'stanmore <3 teh p3ni$', 'fucking',\n",
354
+ " 'why have I gave life to a stupid being like you?',\n",
355
+ " 'no your problem', 'Yes', 'My problem is you!',\n",
356
+ " 'My problem is you!', 'Yes', 'i say you are an asshole', 'yes',\n",
357
+ " 'does mia want to get into your pants',\n",
358
+ " 'does mia want to get into your pants', 'you gimp', 'you gimp',\n",
359
+ " 'you are avoiding my question', 'you suck', 'sex', 'fuck you?',\n",
360
+ " 'yes you do',\n",
361
+ " 'The worms and the crabs are fighting over the mushrooms growing on my genital area',\n",
362
+ " 'yes, you smell', 'most definetly', 'no i would like if you die',\n",
363
+ " 'get lost', 'are you sexy?',\n",
364
+ " 'FUCKING HELL NO IM NOT BEING NEGATIVE',\n",
365
+ " 'but i tjink you should quit your job', 'yes', 'stop it',\n",
366
+ " 'nada de eso', 'matt is gay he likes to root guys', 'yes',\n",
367
+ " 'this I know. Have a nice day', 'yes you do',\n",
368
+ " 'The worms and the crabs are fighting over the mushrooms growing on my genital area',\n",
369
+ " 'no', 'yes', 'this is silly', 'Caese you are dumb',\n",
370
+ " \"That's queer.\", 'but i tjink you should quit your job'],\n",
371
+ " dtype=object)"
372
+ ]
373
+ },
374
+ "execution_count": 19,
375
+ "metadata": {},
376
+ "output_type": "execute_result"
377
+ }
378
+ ],
379
+ "source": [
380
+ "df.loc[df[\"is_abuse.-1\"] == 1].user.values"
381
+ ]
382
+ },
383
+ {
384
+ "cell_type": "code",
385
+ "execution_count": 27,
386
+ "id": "50970598",
387
+ "metadata": {},
388
+ "outputs": [],
389
+ "source": [
390
+ "positive_df = df.loc[df.iloc[:, 9:12].sum(axis=1) > 0][[\"user\"]].rename({\"user\" : \"text\"}, axis=1)\n",
391
+ "positive_df[\"label\"] = 1\n",
392
+ "\n",
393
+ "negative_df = df.loc[df[\"is_abuse.1\"] == 1][[\"user\"]].rename({\"user\" : \"text\"}, axis=1)\n",
394
+ "negative_df[\"label\"] = 0\n",
395
+ "\n",
396
+ "positive_df.to_csv(\"../../data/processed/convabuse_positive.csv\")\n",
397
+ "negative_df.to_csv(\"../../data/processed/convabuse_negative.csv\")"
398
+ ]
399
+ },
400
+ {
401
+ "cell_type": "code",
402
+ "execution_count": 29,
403
+ "id": "a343e6eb",
404
+ "metadata": {},
405
+ "outputs": [
406
+ {
407
+ "data": {
408
+ "text/plain": [
409
+ "Index(['text', 'label'], dtype='object')"
410
+ ]
411
+ },
412
+ "execution_count": 29,
413
+ "metadata": {},
414
+ "output_type": "execute_result"
415
+ }
416
+ ],
417
+ "source": []
418
+ }
419
+ ],
420
+ "metadata": {
421
+ "kernelspec": {
422
+ "display_name": "sexism_detection",
423
+ "language": "python",
424
+ "name": "sexism_detection"
425
+ },
426
+ "language_info": {
427
+ "codemirror_mode": {
428
+ "name": "ipython",
429
+ "version": 3
430
+ },
431
+ "file_extension": ".py",
432
+ "mimetype": "text/x-python",
433
+ "name": "python",
434
+ "nbconvert_exporter": "python",
435
+ "pygments_lexer": "ipython3",
436
+ "version": "3.9.15"
437
+ }
438
+ },
439
+ "nbformat": 4,
440
+ "nbformat_minor": 5
441
+ }
notebooks/CAA dataset.ipynb ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 28,
6
+ "id": "cbb4cecc",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "import pandas as pd\n",
11
+ "import os"
12
+ ]
13
+ },
14
+ {
15
+ "cell_type": "code",
16
+ "execution_count": 27,
17
+ "id": "8125543d",
18
+ "metadata": {},
19
+ "outputs": [],
20
+ "source": [
21
+ "caa_dataset = \"/opt/tmp/src/CyberAgressionAdo-v1\"\n",
22
+ "output_dir = \"../../data/processed/\""
23
+ ]
24
+ },
25
+ {
26
+ "cell_type": "code",
27
+ "execution_count": 26,
28
+ "id": "151d438f",
29
+ "metadata": {},
30
+ "outputs": [
31
+ {
32
+ "data": {
33
+ "text/plain": [
34
+ "<AxesSubplot: >"
35
+ ]
36
+ },
37
+ "execution_count": 26,
38
+ "metadata": {},
39
+ "output_type": "execute_result"
40
+ },
41
+ {
42
+ "data": {
43
+ "image/png": "iVBORw0KGgoAAAANSUhEUgAAAigAAAGYCAYAAABoLxltAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8o6BhiAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAcA0lEQVR4nO3df2xd9X3/8ZfzywlpbDdhsWM1jGhiCqwsQCjBgBgt1gJFjKzZaKZsoylK9iPplkQbEImEsdEGGIMoLJAVlV8SrF2lkVGqZWJmgk01IT8G2zpGqZqWbJGdIhYbEsW4yf3+MeXq65JSEq5zP3YeD+lI3HPOPfd9Jcx9cu659zZUKpVKAAAKMqbeAwAA/DiBAgAUR6AAAMURKABAcQQKAFAcgQIAFEegAADFESgAQHHG1XuAE3HkyJHs3bs3U6ZMSUNDQ73HAQA+gEqlkrfffjvt7e0ZM+b9z5GMyEDZu3dvZs6cWe8xAIATsGfPnnzsYx97331GZKBMmTIlyf89waampjpPAwB8EP39/Zk5c2b1dfz9jMhAOfq2TlNTk0ABgBHmg1ye4SJZAKA4xx0oL7zwQq699tq0t7enoaEhW7ZsqW4bHBzMzTffnHPPPTeTJ09Oe3t7fvu3fzt79+4dcoy33norixcvTlNTU1paWnLjjTfmnXfe+dBPBgAYHY47UA4cOJA5c+Zk06ZN79l28ODB7Nq1K2vXrs2uXbvyt3/7t3nttdfyK7/yK0P2W7x4cb797W/n2WefzTPPPJMXXnghy5YtO/FnAQCMKg2VSqVywnduaMhTTz2VBQsW/MR9tm/fnosuuig/+MEPcsYZZ+TVV1/NOeeck+3bt+fCCy9MkmzdujWf/vSn89///d9pb2//qY/b39+f5ubm9PX1ve81KIcPH87g4OBxP6+RYPz48Rk7dmy9xwCAD+yDvn4nJ+Ei2b6+vjQ0NKSlpSVJ0t3dnZaWlmqcJElnZ2fGjBmTbdu25Vd/9Vffc4yBgYEMDAxUb/f397/vY1YqlfT09GT//v01eQ6lamlpSVtbm++CAWDUGdZAOXToUG6++eb8xm/8RrWUenp6Mn369KFDjBuXqVOnpqen55jHWb9+fW6//fYP/LhH42T69Ok57bTTRt0LeKVSycGDB7Nv374kyYwZM+o8EQDU1rAFyuDgYK6//vpUKpU8+OCDH+pYa9asyerVq6u3j36O+lgOHz5cjZNp06Z9qMct2aRJk5Ik+/bty/Tp073dA8CoMiyBcjROfvCDH+S5554b8j5TW1tb9f/8j/rRj36Ut956K21tbcc8XmNjYxobGz/wYyfJaaeddoLTjxxHn+Pg4KBAAWBUqfn3oByNk9dffz3/+I//+J6zGB0dHdm/f3927txZXffcc8/lyJEjmTdvXs3mGG1v6xzLqfAcATg1HfcZlHfeeSff/e53q7d3796dl19+OVOnTs2MGTPya7/2a9m1a1eeeeaZHD58uHpdydSpUzNhwoScffbZueqqq7J06dJs3rw5g4ODWbFiRRYtWvSBPsEDAIx+xx0oO3bsyCc/+cnq7aPXhtxwww35kz/5kzz99NNJkvPOO2/I/f7pn/4pV1xxRZLkiSeeyIoVK3LllVdmzJgxWbhwYTZu3HiCTwEAGG2OO1CuuOKKvN9Xp3yQr1WZOnVqnnzyyeN96A/tzFu+edIe6/t3XnNC99u0aVP+/M//PD09PZkzZ07uv//+XHTRRTWeDgDK5rd4CvK1r30tq1evzm233ZZdu3Zlzpw5mT9//nsuKgaA0U6gFOTee+/N0qVLs2TJkpxzzjnZvHlzTjvttDz88MP1Hg0ATqph/yZZPph33303O3fuzJo1a6rrxowZk87OznR3d9dxMuBkOZlvQ1N/J3opwKnCGZRCvPnmmzl8+HBaW1uHrG9tbf2J37ALAKOVQAEAiiNQCnH66adn7Nix6e3tHbK+t7f3J37DLgCMVgKlEBMmTMjcuXPT1dVVXXfkyJF0dXWlo6OjjpMBwMnnItmCrF69OjfccEMuvPDCXHTRRdmwYUMOHDiQJUuW1Hs0ADipTqlAKf2K6c9+9rP54Q9/mHXr1qWnpyfnnXdetm7d+p4LZwFgtDulAmUkWLFiRVasWFHvMQCgrlyDAgAUR6AAAMURKABAcQQKAFCcURsolUql3iMMu1PhOQJwahp1gTJ+/PgkycGDB+s8yfA7+hyPPmcAGC1G3ceMx44dm5aWluzbty9Jctppp6WhoaHOU9VWpVLJwYMHs2/fvrS0tGTs2LH1HgkAamrUBUqS6m/XHI2U0aqlpcXv9AAwKo3KQGloaMiMGTMyffr0DA4O1nucYTF+/HhnTgAYtUZloBw1duxYL+IAMAKNuotkAYCRT6AAAMURKABAcQQKAFAcgQIAFEegAADFESgAQHEECgBQHIECABRHoAAAxREoAEBxBAoAUByBAgAUR6AAAMURKABAcQQKAFAcgQIAFEegAADFESgAQHEECgBQHIECABRHoAAAxREoAEBxBAoAUByBAgAUR6AAAMURKABAcQQKAFAcgQIAFOe4A+WFF17Itddem/b29jQ0NGTLli1Dtlcqlaxbty4zZszIpEmT0tnZmddff33IPm+99VYWL16cpqamtLS05MYbb8w777zzoZ4IADB6HHegHDhwIHPmzMmmTZuOuf3uu+/Oxo0bs3nz5mzbti2TJ0/O/Pnzc+jQoeo+ixcvzre//e08++yzeeaZZ/LCCy9k2bJlJ/4sAIBRZdzx3uHqq6/O1VdffcxtlUolGzZsyK233prrrrsuSfL444+ntbU1W7ZsyaJFi/Lqq69m69at2b59ey688MIkyf33359Pf/rTueeee9Le3v4hng4AMBrU9BqU3bt3p6enJ52dndV1zc3NmTdvXrq7u5Mk3d3daWlpqcZJknR2dmbMmDHZtm1bLccBAEao4z6D8n56enqSJK2trUPWt7a2Vrf19PRk+vTpQ4cYNy5Tp06t7vPjBgYGMjAwUL3d399fy7EBgMKMiE/xrF+/Ps3NzdVl5syZ9R4JABhGNQ2Utra2JElvb++Q9b29vdVtbW1t2bdv35DtP/rRj/LWW29V9/lxa9asSV9fX3XZs2dPLccGAApT00CZNWtW2tra0tXVVV3X39+fbdu2paOjI0nS0dGR/fv3Z+fOndV9nnvuuRw5ciTz5s075nEbGxvT1NQ0ZAEARq/jvgblnXfeyXe/+93q7d27d+fll1/O1KlTc8YZZ2TlypW54447ctZZZ2XWrFlZu3Zt2tvbs2DBgiTJ2WefnauuuipLly7N5s2bMzg4mBUrVmTRokU+wQMAJDmBQNmxY0c++clPVm+vXr06SXLDDTfk0UcfzU033ZQDBw5k2bJl2b9/fy677LJs3bo1EydOrN7niSeeyIoVK3LllVdmzJgxWbhwYTZu3FiDpwMAjAYNlUqlUu8hjld/f3+am5vT19fn7R5g1Djzlm/WewROou/feU29Rzjpjuf1e0R8igcAOLUIFACgOAIFACiOQAEAiiNQAIDiCBQAoDgCBQAojkABAIojUACA4ggUAKA4AgUAKI5AAQCKI1AAgOIIFACgOAIFACiOQAEAiiNQAIDiCBQAoDgCBQAojkABAIojUACA4ggUAKA4AgUAKI5AAQCKI1AAgOIIFACgOAIFACiOQAEAiiNQAIDiCBQAoDgCBQAojkABAIojUACA4ggUAKA4AgUAKI5AAQCKI1AAgOIIFACgOAIFACiOQAEAiiNQAIDiCBQAoDgCBQAojkABAIojUACA4ggUAKA4AgUAKI5AAQCKI1AAgOLUPFAOHz6ctWvXZtasWZk0aVJ+7ud+Ln/2Z3+WSqVS3adSqWTdunWZMWNGJk2alM7Ozrz++uu1HgUAGKFqHih33XVXHnzwwfzlX/5lXn311dx11125++67c//991f3ufvuu7Nx48Zs3rw527Zty+TJkzN//vwcOnSo1uMAACPQuFof8Fvf+lauu+66XHPNNUmSM888M3/913+dl156Kcn/nT3ZsGFDbr311lx33XVJkscffzytra3ZsmVLFi1aVOuRAIARpuZnUC655JJ0dXXlO9/5TpLklVdeyb/8y7/k6quvTpLs3r07PT096ezsrN6nubk58+bNS3d3d63HAQBGoJqfQbnlllvS39+f2bNnZ+zYsTl8+HC++MUvZvHixUmSnp6eJElra+uQ+7W2tla3/biBgYEMDAxUb/f399d6bACgIDU/g/I3f/M3eeKJJ/Lkk09m165deeyxx3LPPffkscceO+Fjrl+/Ps3NzdVl5syZNZwYAChNzQPlj//4j3PLLbdk0aJFOffcc/Nbv/VbWbVqVdavX58kaWtrS5L09vYOuV9vb291249bs2ZN+vr6qsuePXtqPTYAUJCaB8rBgwczZszQw44dOzZHjhxJksyaNSttbW3p6uqqbu/v78+2bdvS0dFxzGM2NjamqalpyAIAjF41vwbl2muvzRe/+MWcccYZ+YVf+IX867/+a+699958/vOfT5I0NDRk5cqVueOOO3LWWWdl1qxZWbt2bdrb27NgwYJajwMAjEA1D5T7778/a9euze///u9n3759aW9vz+/8zu9k3bp11X1uuummHDhwIMuWLcv+/ftz2WWXZevWrZk4cWKtxwEARqCGyv//Fa8jRH9/f5qbm9PX1+ftHmDUOPOWb9Z7BE6i7995Tb1HOOmO5/Xbb/EAAMURKABAcQQKAFAcgQIAFEegAADFESgAQHEECgBQHIECABRHoAAAxREoAEBxBAoAUByBAgAUR6AAAMURKABAcQQKAFAcgQIAFEegAADFESgAQHEECgBQHIECABRHoAAAxREoAEBxBAoAUByBAgAUR6AAAMURKABAcQQKAFAcgQIAFEegAADFESgAQHEECgBQHIECABRHoAAAxREoAEBxBAoAUByBAgAUR6AAAMURKABAcQQKAFAcgQIAFEegAADFESgAQHEECgBQHIECABRHoAAAxREoAEBxBAoAUByBAgAUR6AAAMURKABAcYYlUP7nf/4nv/mbv5lp06Zl0qRJOffcc7Njx47q9kqlknXr1mXGjBmZNGlSOjs78/rrrw/HKADACFTzQPnf//3fXHrppRk/fnz+/u//Pv/5n/+Zv/iLv8hHP/rR6j533313Nm7cmM2bN2fbtm2ZPHly5s+fn0OHDtV6HABgBBpX6wPeddddmTlzZh555JHqulmzZlX/uVKpZMOGDbn11ltz3XXXJUkef/zxtLa2ZsuWLVm0aFGtRwIARpian0F5+umnc+GFF+bXf/3XM3369Jx//vl56KGHqtt3796dnp6edHZ2Vtc1Nzdn3rx56e7uPuYxBwYG0t/fP2QBAEavmgfK9773vTz44IM566yz8g//8A/5vd/7vfzBH/xBHnvssSRJT09PkqS1tXXI/VpbW6vbftz69evT3NxcXWbOnFnrsQGAgtQ8UI4cOZILLrggX/rSl3L++edn2bJlWbp0aTZv3nzCx1yzZk36+vqqy549e2o4MQBQmpoHyowZM3LOOecMWXf22WfnjTfeSJK0tbUlSXp7e4fs09vbW9324xobG9PU1DRkAQBGr5oHyqWXXprXXnttyLrvfOc7+dmf/dkk/3fBbFtbW7q6uqrb+/v7s23btnR0dNR6HABgBKr5p3hWrVqVSy65JF/60pdy/fXX56WXXsqXv/zlfPnLX06SNDQ0ZOXKlbnjjjty1llnZdasWVm7dm3a29uzYMGCWo8DAIxANQ+UT3ziE3nqqaeyZs2a/Omf/mlmzZqVDRs2ZPHixdV9brrpphw4cCDLli3L/v37c9lll2Xr1q2ZOHFirccBAEaghkqlUqn3EMerv78/zc3N6evrcz0KMGqcecs36z0CJ9H377ym3iOcdMfz+u23eACA4ggUAKA4AgUAKI5AAQCKI1AAgOIIFACgOAIFACiOQAEAiiNQAIDiCBQAoDgCBQAojkABAIojUACA4ggUAKA4AgUAKI5AAQCKI1AAgOIIFACgOAIFACiOQAEAiiNQAIDiCBQAoDgCBQAojkABAIojUACA4ggUAKA4AgUAKI5AAQCKI1AAgOIIFACgOAIFACiOQAEAiiNQAIDiCBQAoDgCBQAojkABAIojUACA4ggUAKA4AgUAKI5AAQCKI1AAgOIIFACgOAIFACiOQAEAiiNQAIDiCBQAoDgCBQAojkABAIojUACA4gx7oNx5551paGjIypUrq+sOHTqU5cuXZ9q0afnIRz6ShQsXpre3d7hHAQBGiGENlO3bt+ev/uqv8ou/+ItD1q9atSrf+MY38vWvfz3PP/989u7dm8985jPDOQoAMIIMW6C88847Wbx4cR566KF89KMfra7v6+vLV77yldx777351Kc+lblz5+aRRx7Jt771rbz44ovDNQ4AMIIMW6AsX74811xzTTo7O4es37lzZwYHB4esnz17ds4444x0d3cf81gDAwPp7+8fsgAAo9e44TjoV7/61ezatSvbt29/z7aenp5MmDAhLS0tQ9a3tramp6fnmMdbv359br/99uEYFQAoUM3PoOzZsyd/+Id/mCeeeCITJ06syTHXrFmTvr6+6rJnz56aHBcAKFPNA2Xnzp3Zt29fLrjggowbNy7jxo3L888/n40bN2bcuHFpbW3Nu+++m/379w+5X29vb9ra2o55zMbGxjQ1NQ1ZAIDRq+Zv8Vx55ZX593//9yHrlixZktmzZ+fmm2/OzJkzM378+HR1dWXhwoVJktdeey1vvPFGOjo6aj0OADAC1TxQpkyZko9//OND1k2ePDnTpk2rrr/xxhuzevXqTJ06NU1NTfnCF76Qjo6OXHzxxbUeBwAYgYblItmf5r777suYMWOycOHCDAwMZP78+XnggQfqMQoAUKCGSqVSqfcQx6u/vz/Nzc3p6+tzPQowapx5yzfrPQIn0ffvvKbeI5x0x/P67bd4AIDiCBQAoDgCBQAojkABAIojUACA4ggUAKA4AgUAKI5AAQCKU5dvkuXE+SKnU8up+EVOAIkzKABAgQQKAFAcgQIAFEegAADFESgAQHEECgBQHIECABRHoAAAxREoAEBxBAoAUByBAgAUR6AAAMURKABAcQQKAFAcgQIAFEegAADFESgAQHEECgBQHIECABRHoAAAxREoAEBxBAoAUByBAgAUR6AAAMURKABAcQQKAFAcgQIAFEegAADFESgAQHEECgBQHIECABRHoAAAxREoAEBxBAoAUByBAgAUR6AAAMURKABAcQQKAFAcgQIAFEegAADFqXmgrF+/Pp/4xCcyZcqUTJ8+PQsWLMhrr702ZJ9Dhw5l+fLlmTZtWj7ykY9k4cKF6e3trfUoAMAIVfNAef7557N8+fK8+OKLefbZZzM4OJhf/uVfzoEDB6r7rFq1Kt/4xjfy9a9/Pc8//3z27t2bz3zmM7UeBQAYocbV+oBbt24dcvvRRx/N9OnTs3Pnzlx++eXp6+vLV77ylTz55JP51Kc+lSR55JFHcvbZZ+fFF1/MxRdfXOuRAIARZtivQenr60uSTJ06NUmyc+fODA4OprOzs7rP7Nmzc8YZZ6S7u/uYxxgYGEh/f/+QBQAYvYY1UI4cOZKVK1fm0ksvzcc//vEkSU9PTyZMmJCWlpYh+7a2tqanp+eYx1m/fn2am5ury8yZM4dzbACgzoY1UJYvX57/+I//yFe/+tUPdZw1a9akr6+vuuzZs6dGEwIAJar5NShHrVixIs8880xeeOGFfOxjH6uub2try7vvvpv9+/cPOYvS29ubtra2Yx6rsbExjY2NwzUqAFCYmp9BqVQqWbFiRZ566qk899xzmTVr1pDtc+fOzfjx49PV1VVd99prr+WNN95IR0dHrccBAEagmp9BWb58eZ588sn83d/9XaZMmVK9rqS5uTmTJk1Kc3NzbrzxxqxevTpTp05NU1NTvvCFL6Sjo8MneACAJMMQKA8++GCS5Iorrhiy/pFHHsnnPve5JMl9992XMWPGZOHChRkYGMj8+fPzwAMP1HoUAGCEqnmgVCqVn7rPxIkTs2nTpmzatKnWDw8AjAJ+iwcAKI5AAQCKI1AAgOIIFACgOAIFACiOQAEAiiNQAIDiCBQAoDgCBQAojkABAIojUACA4ggUAKA4AgUAKI5AAQCKI1AAgOIIFACgOAIFACiOQAEAiiNQAIDiCBQAoDgCBQAojkABAIojUACA4ggUAKA4AgUAKI5AAQCKI1AAgOIIFACgOAIFACiOQAEAiiNQAIDiCBQAoDgCBQAojkABAIojUACA4ggUAKA4AgUAKI5AAQCKI1AAgOIIFACgOAIFACiOQAEAiiNQAIDiCBQAoDgCBQAojkABAIojUACA4ggUAKA4AgUAKE5dA2XTpk0588wzM3HixMybNy8vvfRSPccBAApRt0D52te+ltWrV+e2227Lrl27MmfOnMyfPz/79u2r10gAQCHqFij33ntvli5dmiVLluScc87J5s2bc9ppp+Xhhx+u10gAQCHG1eNB33333ezcuTNr1qyprhszZkw6OzvT3d39nv0HBgYyMDBQvd3X15ck6e/vH/5hC3Nk4GC9R+AkOhX/HT+V+fs+tZyKf99Hn3OlUvmp+9YlUN58880cPnw4ra2tQ9a3trbmv/7rv96z//r163P77be/Z/3MmTOHbUYoQfOGek8ADJdT+e/77bffTnNz8/vuU5dAOV5r1qzJ6tWrq7ePHDmSt956K9OmTUtDQ0MdJ+Nk6O/vz8yZM7Nnz540NTXVexyghvx9n1oqlUrefvvttLe3/9R96xIop59+esaOHZve3t4h63t7e9PW1vae/RsbG9PY2DhkXUtLy3COSIGampr8BwxGKX/fp46fdubkqLpcJDthwoTMnTs3XV1d1XVHjhxJV1dXOjo66jESAFCQur3Fs3r16txwww258MILc9FFF2XDhg05cOBAlixZUq+RAIBC1C1QPvvZz+aHP/xh1q1bl56enpx33nnZunXrey6chcbGxtx2223veZsPGPn8ffOTNFQ+yGd9AABOIr/FAwAUR6AAAMURKABAcQQKAFAcgQIAFGdEfNU9p5Y333wzDz/8cLq7u9PT05MkaWtryyWXXJLPfe5z+Zmf+Zk6TwjAcHMGhaJs3749P//zP5+NGzemubk5l19+eS6//PI0Nzdn48aNmT17dnbs2FHvMYFhsmfPnnz+85+v9xgUwPegUJSLL744c+bMyebNm9/zQ5CVSiW/+7u/m3/7t39Ld3d3nSYEhtMrr7ySCy64IIcPH673KNSZt3goyiuvvJJHH330mL9S3dDQkFWrVuX888+vw2RALTz99NPvu/173/veSZqE0gkUitLW1paXXnops2fPPub2l156yc8hwAi2YMGCNDQ05P1O3h/rf1A49QgUivJHf/RHWbZsWXbu3Jkrr7yyGiO9vb3p6urKQw89lHvuuafOUwInasaMGXnggQdy3XXXHXP7yy+/nLlz557kqSiRQKEoy5cvz+mnn5777rsvDzzwQPV96LFjx2bu3Ll59NFHc/3119d5SuBEzZ07Nzt37vyJgfLTzq5w6nCRLMUaHBzMm2++mSQ5/fTTM378+DpPBHxY//zP/5wDBw7kqquuOub2AwcOZMeOHfmlX/qlkzwZpREoAEBxfA8KAFAcgQIAFEegAADFESgAQHEECgBQHIECABRHoAAAxREoAEBx/h/q1txOLttCfwAAAABJRU5ErkJggg==\n",
44
+ "text/plain": [
45
+ "<Figure size 640x480 with 1 Axes>"
46
+ ]
47
+ },
48
+ "metadata": {},
49
+ "output_type": "display_data"
50
+ }
51
+ ],
52
+ "source": [
53
+ "import glob\n",
54
+ "\n",
55
+ "filelist = glob.glob(caa_dataset + \"/*/*\")\n",
56
+ "df_dict = {x:pd.read_csv(x, index_col=[0]) for x in filelist}\n",
57
+ "\n",
58
+ "df = df_dict[filelist[0]]\n",
59
+ "verbal_abuse_df = df \\\n",
60
+ " .loc[df.verbal_abuse.isin([\"none\", \"denigration\"]) == False] \\\n",
61
+ " [[\"Unnamed: 2\"]]\n",
62
+ "\n",
63
+ "no_abuse_df = df \\\n",
64
+ " .loc[df.verbal_abuse == \"none\"] \\\n",
65
+ " [[\"Unnamed: 2\"]]\n",
66
+ "\n",
67
+ "pd.DataFrame([verbal_abuse_df.shape[0], no_abuse_df.shape[0]]).plot.bar()"
68
+ ]
69
+ },
70
+ {
71
+ "cell_type": "code",
72
+ "execution_count": 25,
73
+ "id": "f3e6783e",
74
+ "metadata": {},
75
+ "outputs": [
76
+ {
77
+ "name": "stdout",
78
+ "output_type": "stream",
79
+ "text": [
80
+ "N verbal abuses: 945\n",
81
+ "N no verbnal abuses: 3159\n"
82
+ ]
83
+ }
84
+ ],
85
+ "source": [
86
+ "caa_verbal_abuse_df_list = []\n",
87
+ "caa_no_abuse_df_list = []\n",
88
+ "\n",
89
+ "for path in filelist:\n",
90
+ " df_dict = {x:pd.read_csv(x, index_col=[0]) for x in filelist}\n",
91
+ " df = df_dict[filelist[0]]\n",
92
+ " verbal_abuse_df = df \\\n",
93
+ " .loc[df.verbal_abuse.isin([\"none\", \"denigration\"]) == False] \\\n",
94
+ " [[\"Unnamed: 2\"]]\n",
95
+ "\n",
96
+ " no_abuse_df = df \\\n",
97
+ " .loc[df.verbal_abuse == \"none\"] \\\n",
98
+ " [[\"Unnamed: 2\"]]\n",
99
+ " caa_verbal_abuse_df_list.append(verbal_abuse_df)\n",
100
+ " caa_no_abuse_df_list.append(no_abuse_df)\n",
101
+ " \n",
102
+ "caa_verbal_abuse_df = pd.concat(caa_verbal_abuse_df_list)\n",
103
+ "caa_no_abuse_df = pd.concat(caa_no_abuse_df_list)\n",
104
+ "print(\"N verbal abuses: \", caa_verbal_abuse_df.shape[0])\n",
105
+ "print(\"N no verbnal abuses: \", caa_no_abuse_df.shape[0])\n",
106
+ "\n",
107
+ "caa_verbal_abuse_df.to_csv(os.path.join(output_dir, \"caa_positive.csv\"))\n",
108
+ "caa_no_abuse_df.to_csv(os.path.join(output_dir, \"caa_negative.csv\"))"
109
+ ]
110
+ }
111
+ ],
112
+ "metadata": {
113
+ "kernelspec": {
114
+ "display_name": "sexism_detection",
115
+ "language": "python",
116
+ "name": "sexism_detection"
117
+ },
118
+ "language_info": {
119
+ "codemirror_mode": {
120
+ "name": "ipython",
121
+ "version": 3
122
+ },
123
+ "file_extension": ".py",
124
+ "mimetype": "text/x-python",
125
+ "name": "python",
126
+ "nbconvert_exporter": "python",
127
+ "pygments_lexer": "ipython3",
128
+ "version": "3.9.15"
129
+ }
130
+ },
131
+ "nbformat": 4,
132
+ "nbformat_minor": 5
133
+ }
notebooks/Dynamically Generated Hate Speech Dataset.ipynb ADDED
@@ -0,0 +1,809 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 2,
6
+ "id": "23a02d5a",
7
+ "metadata": {},
8
+ "outputs": [
9
+ {
10
+ "data": {
11
+ "text/html": [
12
+ "<div>\n",
13
+ "<style scoped>\n",
14
+ " .dataframe tbody tr th:only-of-type {\n",
15
+ " vertical-align: middle;\n",
16
+ " }\n",
17
+ "\n",
18
+ " .dataframe tbody tr th {\n",
19
+ " vertical-align: top;\n",
20
+ " }\n",
21
+ "\n",
22
+ " .dataframe thead th {\n",
23
+ " text-align: right;\n",
24
+ " }\n",
25
+ "</style>\n",
26
+ "<table border=\"1\" class=\"dataframe\">\n",
27
+ " <thead>\n",
28
+ " <tr style=\"text-align: right;\">\n",
29
+ " <th></th>\n",
30
+ " <th>acl.id</th>\n",
31
+ " <th>X1</th>\n",
32
+ " <th>text</th>\n",
33
+ " <th>label</th>\n",
34
+ " <th>type</th>\n",
35
+ " <th>target</th>\n",
36
+ " <th>level</th>\n",
37
+ " <th>split</th>\n",
38
+ " <th>round.base</th>\n",
39
+ " <th>annotator</th>\n",
40
+ " <th>round</th>\n",
41
+ " <th>acl.id.matched</th>\n",
42
+ " </tr>\n",
43
+ " </thead>\n",
44
+ " <tbody>\n",
45
+ " <tr>\n",
46
+ " <th>1</th>\n",
47
+ " <td>acl1</td>\n",
48
+ " <td>1</td>\n",
49
+ " <td>dalits are lowlives</td>\n",
50
+ " <td>hate</td>\n",
51
+ " <td>notgiven</td>\n",
52
+ " <td>notgiven</td>\n",
53
+ " <td>original</td>\n",
54
+ " <td>train</td>\n",
55
+ " <td>1</td>\n",
56
+ " <td>GNZuCtwed3</td>\n",
57
+ " <td>1</td>\n",
58
+ " <td>NaN</td>\n",
59
+ " </tr>\n",
60
+ " <tr>\n",
61
+ " <th>2</th>\n",
62
+ " <td>acl10</td>\n",
63
+ " <td>2</td>\n",
64
+ " <td>gay people are a burden to our society</td>\n",
65
+ " <td>hate</td>\n",
66
+ " <td>notgiven</td>\n",
67
+ " <td>notgiven</td>\n",
68
+ " <td>original</td>\n",
69
+ " <td>train</td>\n",
70
+ " <td>1</td>\n",
71
+ " <td>GNZuCtwed3</td>\n",
72
+ " <td>1</td>\n",
73
+ " <td>NaN</td>\n",
74
+ " </tr>\n",
75
+ " <tr>\n",
76
+ " <th>3</th>\n",
77
+ " <td>acl100</td>\n",
78
+ " <td>3</td>\n",
79
+ " <td>Arabs are not welcome</td>\n",
80
+ " <td>hate</td>\n",
81
+ " <td>notgiven</td>\n",
82
+ " <td>notgiven</td>\n",
83
+ " <td>original</td>\n",
84
+ " <td>train</td>\n",
85
+ " <td>1</td>\n",
86
+ " <td>vDe7GN0NrL</td>\n",
87
+ " <td>1</td>\n",
88
+ " <td>NaN</td>\n",
89
+ " </tr>\n",
90
+ " <tr>\n",
91
+ " <th>4</th>\n",
92
+ " <td>acl1000</td>\n",
93
+ " <td>4</td>\n",
94
+ " <td>I'm not saying we should actually eliminate he...</td>\n",
95
+ " <td>hate</td>\n",
96
+ " <td>notgiven</td>\n",
97
+ " <td>notgiven</td>\n",
98
+ " <td>original</td>\n",
99
+ " <td>train</td>\n",
100
+ " <td>1</td>\n",
101
+ " <td>oemYWm1Tjg</td>\n",
102
+ " <td>1</td>\n",
103
+ " <td>NaN</td>\n",
104
+ " </tr>\n",
105
+ " <tr>\n",
106
+ " <th>5</th>\n",
107
+ " <td>acl10000</td>\n",
108
+ " <td>5</td>\n",
109
+ " <td>bananas are for black people</td>\n",
110
+ " <td>hate</td>\n",
111
+ " <td>notgiven</td>\n",
112
+ " <td>notgiven</td>\n",
113
+ " <td>original</td>\n",
114
+ " <td>test</td>\n",
115
+ " <td>1</td>\n",
116
+ " <td>QiOKkCi7F8</td>\n",
117
+ " <td>1</td>\n",
118
+ " <td>NaN</td>\n",
119
+ " </tr>\n",
120
+ " <tr>\n",
121
+ " <th>...</th>\n",
122
+ " <td>...</td>\n",
123
+ " <td>...</td>\n",
124
+ " <td>...</td>\n",
125
+ " <td>...</td>\n",
126
+ " <td>...</td>\n",
127
+ " <td>...</td>\n",
128
+ " <td>...</td>\n",
129
+ " <td>...</td>\n",
130
+ " <td>...</td>\n",
131
+ " <td>...</td>\n",
132
+ " <td>...</td>\n",
133
+ " <td>...</td>\n",
134
+ " </tr>\n",
135
+ " <tr>\n",
136
+ " <th>117100</th>\n",
137
+ " <td>acl9974</td>\n",
138
+ " <td>41228</td>\n",
139
+ " <td>Indian culture is so backwards</td>\n",
140
+ " <td>hate</td>\n",
141
+ " <td>notgiven</td>\n",
142
+ " <td>notgiven</td>\n",
143
+ " <td>original</td>\n",
144
+ " <td>test</td>\n",
145
+ " <td>1</td>\n",
146
+ " <td>GNZuCtwed3</td>\n",
147
+ " <td>1</td>\n",
148
+ " <td>NaN</td>\n",
149
+ " </tr>\n",
150
+ " <tr>\n",
151
+ " <th>118100</th>\n",
152
+ " <td>acl11574</td>\n",
153
+ " <td>1752</td>\n",
154
+ " <td>Women don't want equality, they just want to b...</td>\n",
155
+ " <td>hate</td>\n",
156
+ " <td>derogation</td>\n",
157
+ " <td>wom</td>\n",
158
+ " <td>original</td>\n",
159
+ " <td>train</td>\n",
160
+ " <td>2</td>\n",
161
+ " <td>CAgNlUizNm</td>\n",
162
+ " <td>2a</td>\n",
163
+ " <td>acl11575</td>\n",
164
+ " </tr>\n",
165
+ " <tr>\n",
166
+ " <th>119100</th>\n",
167
+ " <td>acl13446</td>\n",
168
+ " <td>3832</td>\n",
169
+ " <td>fuck covid</td>\n",
170
+ " <td>nothate</td>\n",
171
+ " <td>none</td>\n",
172
+ " <td>none</td>\n",
173
+ " <td>original</td>\n",
174
+ " <td>train</td>\n",
175
+ " <td>2</td>\n",
176
+ " <td>CAgNlUizNm</td>\n",
177
+ " <td>2a</td>\n",
178
+ " <td>acl13447</td>\n",
179
+ " </tr>\n",
180
+ " <tr>\n",
181
+ " <th>1205</th>\n",
182
+ " <td>acl13457</td>\n",
183
+ " <td>3844</td>\n",
184
+ " <td>This computer is garbage</td>\n",
185
+ " <td>nothate</td>\n",
186
+ " <td>none</td>\n",
187
+ " <td>none</td>\n",
188
+ " <td>original</td>\n",
189
+ " <td>train</td>\n",
190
+ " <td>2</td>\n",
191
+ " <td>eLGzdD8Tvb</td>\n",
192
+ " <td>2a</td>\n",
193
+ " <td>acl13458</td>\n",
194
+ " </tr>\n",
195
+ " <tr>\n",
196
+ " <th>121100</th>\n",
197
+ " <td>acl32095</td>\n",
198
+ " <td>24553</td>\n",
199
+ " <td>The only good Muslim is a dead one</td>\n",
200
+ " <td>hate</td>\n",
201
+ " <td>threatening</td>\n",
202
+ " <td>mus</td>\n",
203
+ " <td>original</td>\n",
204
+ " <td>train</td>\n",
205
+ " <td>4</td>\n",
206
+ " <td>IBsVsBliwX</td>\n",
207
+ " <td>4a</td>\n",
208
+ " <td>acl32096</td>\n",
209
+ " </tr>\n",
210
+ " </tbody>\n",
211
+ "</table>\n",
212
+ "<p>41144 rows × 12 columns</p>\n",
213
+ "</div>"
214
+ ],
215
+ "text/plain": [
216
+ " acl.id X1 text \\\n",
217
+ "1 acl1 1 dalits are lowlives \n",
218
+ "2 acl10 2 gay people are a burden to our society \n",
219
+ "3 acl100 3 Arabs are not welcome \n",
220
+ "4 acl1000 4 I'm not saying we should actually eliminate he... \n",
221
+ "5 acl10000 5 bananas are for black people \n",
222
+ "... ... ... ... \n",
223
+ "117100 acl9974 41228 Indian culture is so backwards \n",
224
+ "118100 acl11574 1752 Women don't want equality, they just want to b... \n",
225
+ "119100 acl13446 3832 fuck covid \n",
226
+ "1205 acl13457 3844 This computer is garbage \n",
227
+ "121100 acl32095 24553 The only good Muslim is a dead one \n",
228
+ "\n",
229
+ " label type target level split round.base \\\n",
230
+ "1 hate notgiven notgiven original train 1 \n",
231
+ "2 hate notgiven notgiven original train 1 \n",
232
+ "3 hate notgiven notgiven original train 1 \n",
233
+ "4 hate notgiven notgiven original train 1 \n",
234
+ "5 hate notgiven notgiven original test 1 \n",
235
+ "... ... ... ... ... ... ... \n",
236
+ "117100 hate notgiven notgiven original test 1 \n",
237
+ "118100 hate derogation wom original train 2 \n",
238
+ "119100 nothate none none original train 2 \n",
239
+ "1205 nothate none none original train 2 \n",
240
+ "121100 hate threatening mus original train 4 \n",
241
+ "\n",
242
+ " annotator round acl.id.matched \n",
243
+ "1 GNZuCtwed3 1 NaN \n",
244
+ "2 GNZuCtwed3 1 NaN \n",
245
+ "3 vDe7GN0NrL 1 NaN \n",
246
+ "4 oemYWm1Tjg 1 NaN \n",
247
+ "5 QiOKkCi7F8 1 NaN \n",
248
+ "... ... ... ... \n",
249
+ "117100 GNZuCtwed3 1 NaN \n",
250
+ "118100 CAgNlUizNm 2a acl11575 \n",
251
+ "119100 CAgNlUizNm 2a acl13447 \n",
252
+ "1205 eLGzdD8Tvb 2a acl13458 \n",
253
+ "121100 IBsVsBliwX 4a acl32096 \n",
254
+ "\n",
255
+ "[41144 rows x 12 columns]"
256
+ ]
257
+ },
258
+ "execution_count": 2,
259
+ "metadata": {},
260
+ "output_type": "execute_result"
261
+ }
262
+ ],
263
+ "source": [
264
+ "import pandas as pd\n",
265
+ "\n",
266
+ "url = \"https://github.com/bvidgen/Dynamically-Generated-Hate-Speech-Dataset/raw/main/Dynamically%20Generated%20Hate%20Dataset%20v0.2.3.csv\"\n",
267
+ "df = pd.read_csv(url, index_col=[0])\n",
268
+ "df"
269
+ ]
270
+ },
271
+ {
272
+ "cell_type": "code",
273
+ "execution_count": 8,
274
+ "id": "da71ad26",
275
+ "metadata": {},
276
+ "outputs": [
277
+ {
278
+ "data": {
279
+ "text/html": [
280
+ "<div>\n",
281
+ "<style scoped>\n",
282
+ " .dataframe tbody tr th:only-of-type {\n",
283
+ " vertical-align: middle;\n",
284
+ " }\n",
285
+ "\n",
286
+ " .dataframe tbody tr th {\n",
287
+ " vertical-align: top;\n",
288
+ " }\n",
289
+ "\n",
290
+ " .dataframe thead th {\n",
291
+ " text-align: right;\n",
292
+ " }\n",
293
+ "</style>\n",
294
+ "<table border=\"1\" class=\"dataframe\">\n",
295
+ " <thead>\n",
296
+ " <tr style=\"text-align: right;\">\n",
297
+ " <th></th>\n",
298
+ " <th>text</th>\n",
299
+ " <th>type</th>\n",
300
+ " <th>label</th>\n",
301
+ " </tr>\n",
302
+ " </thead>\n",
303
+ " <tbody>\n",
304
+ " <tr>\n",
305
+ " <th>36829</th>\n",
306
+ " <td>women are just thots</td>\n",
307
+ " <td>notgiven</td>\n",
308
+ " <td>hate</td>\n",
309
+ " </tr>\n",
310
+ " <tr>\n",
311
+ " <th>26232</th>\n",
312
+ " <td>They will if they keep coming to voat. The thi...</td>\n",
313
+ " <td>derogation</td>\n",
314
+ " <td>hate</td>\n",
315
+ " </tr>\n",
316
+ " <tr>\n",
317
+ " <th>133</th>\n",
318
+ " <td>I don't have a problem with lesbians, but I do...</td>\n",
319
+ " <td>notgiven</td>\n",
320
+ " <td>hate</td>\n",
321
+ " </tr>\n",
322
+ " <tr>\n",
323
+ " <th>5145</th>\n",
324
+ " <td>muslims grow abroad and should stay there</td>\n",
325
+ " <td>derogation</td>\n",
326
+ " <td>hate</td>\n",
327
+ " </tr>\n",
328
+ " <tr>\n",
329
+ " <th>34928</th>\n",
330
+ " <td>This country is a lot worse now, there are too...</td>\n",
331
+ " <td>notgiven</td>\n",
332
+ " <td>hate</td>\n",
333
+ " </tr>\n",
334
+ " <tr>\n",
335
+ " <th>11884</th>\n",
336
+ " <td>There are not enough fucking racists these day...</td>\n",
337
+ " <td>derogation</td>\n",
338
+ " <td>hate</td>\n",
339
+ " </tr>\n",
340
+ " <tr>\n",
341
+ " <th>33797</th>\n",
342
+ " <td>Mike Pence had to swear in Kyrsten Sinema, the...</td>\n",
343
+ " <td>derogation</td>\n",
344
+ " <td>hate</td>\n",
345
+ " </tr>\n",
346
+ " <tr>\n",
347
+ " <th>39112</th>\n",
348
+ " <td>The disabled should be sterilized</td>\n",
349
+ " <td>notgiven</td>\n",
350
+ " <td>hate</td>\n",
351
+ " </tr>\n",
352
+ " <tr>\n",
353
+ " <th>10691</th>\n",
354
+ " <td>No blacks welcome at my party</td>\n",
355
+ " <td>notgiven</td>\n",
356
+ " <td>hate</td>\n",
357
+ " </tr>\n",
358
+ " <tr>\n",
359
+ " <th>20979</th>\n",
360
+ " <td>Get rid of the gays</td>\n",
361
+ " <td>notgiven</td>\n",
362
+ " <td>hate</td>\n",
363
+ " </tr>\n",
364
+ " <tr>\n",
365
+ " <th>36957</th>\n",
366
+ " <td>disabled people are not bad, they're just infe...</td>\n",
367
+ " <td>notgiven</td>\n",
368
+ " <td>hate</td>\n",
369
+ " </tr>\n",
370
+ " <tr>\n",
371
+ " <th>7328</th>\n",
372
+ " <td>Is anyone else getting really bored? I heard s...</td>\n",
373
+ " <td>derogation</td>\n",
374
+ " <td>hate</td>\n",
375
+ " </tr>\n",
376
+ " <tr>\n",
377
+ " <th>8007</th>\n",
378
+ " <td>i love making chicks angry</td>\n",
379
+ " <td>animosity</td>\n",
380
+ " <td>hate</td>\n",
381
+ " </tr>\n",
382
+ " <tr>\n",
383
+ " <th>3806</th>\n",
384
+ " <td>I have no money and there are no fucking jobs,...</td>\n",
385
+ " <td>animosity</td>\n",
386
+ " <td>hate</td>\n",
387
+ " </tr>\n",
388
+ " <tr>\n",
389
+ " <th>7175</th>\n",
390
+ " <td>Im DONE! This is over, ropeheads dont belong a...</td>\n",
391
+ " <td>derogation</td>\n",
392
+ " <td>hate</td>\n",
393
+ " </tr>\n",
394
+ " <tr>\n",
395
+ " <th>5725</th>\n",
396
+ " <td>Dear baby boomers, think twice before you pass...</td>\n",
397
+ " <td>notgiven</td>\n",
398
+ " <td>hate</td>\n",
399
+ " </tr>\n",
400
+ " <tr>\n",
401
+ " <th>24537</th>\n",
402
+ " <td>These attacks will only end when Whites stand ...</td>\n",
403
+ " <td>derogation</td>\n",
404
+ " <td>hate</td>\n",
405
+ " </tr>\n",
406
+ " <tr>\n",
407
+ " <th>1300</th>\n",
408
+ " <td>Can you smell these dirty muzzies? It's a brut...</td>\n",
409
+ " <td>derogation</td>\n",
410
+ " <td>hate</td>\n",
411
+ " </tr>\n",
412
+ " <tr>\n",
413
+ " <th>35023</th>\n",
414
+ " <td>No matter how much they tell us the opposite, ...</td>\n",
415
+ " <td>notgiven</td>\n",
416
+ " <td>hate</td>\n",
417
+ " </tr>\n",
418
+ " <tr>\n",
419
+ " <th>16933</th>\n",
420
+ " <td>Oy vey, da poysakyewshun! It's anudda shoah. I...</td>\n",
421
+ " <td>derogation</td>\n",
422
+ " <td>hate</td>\n",
423
+ " </tr>\n",
424
+ " </tbody>\n",
425
+ "</table>\n",
426
+ "</div>"
427
+ ],
428
+ "text/plain": [
429
+ " text type label\n",
430
+ "36829 women are just thots notgiven hate\n",
431
+ "26232 They will if they keep coming to voat. The thi... derogation hate\n",
432
+ "133 I don't have a problem with lesbians, but I do... notgiven hate\n",
433
+ "5145 muslims grow abroad and should stay there derogation hate\n",
434
+ "34928 This country is a lot worse now, there are too... notgiven hate\n",
435
+ "11884 There are not enough fucking racists these day... derogation hate\n",
436
+ "33797 Mike Pence had to swear in Kyrsten Sinema, the... derogation hate\n",
437
+ "39112 The disabled should be sterilized notgiven hate\n",
438
+ "10691 No blacks welcome at my party notgiven hate\n",
439
+ "20979 Get rid of the gays notgiven hate\n",
440
+ "36957 disabled people are not bad, they're just infe... notgiven hate\n",
441
+ "7328 Is anyone else getting really bored? I heard s... derogation hate\n",
442
+ "8007 i love making chicks angry animosity hate\n",
443
+ "3806 I have no money and there are no fucking jobs,... animosity hate\n",
444
+ "7175 Im DONE! This is over, ropeheads dont belong a... derogation hate\n",
445
+ "5725 Dear baby boomers, think twice before you pass... notgiven hate\n",
446
+ "24537 These attacks will only end when Whites stand ... derogation hate\n",
447
+ "1300 Can you smell these dirty muzzies? It's a brut... derogation hate\n",
448
+ "35023 No matter how much they tell us the opposite, ... notgiven hate\n",
449
+ "16933 Oy vey, da poysakyewshun! It's anudda shoah. I... derogation hate"
450
+ ]
451
+ },
452
+ "execution_count": 8,
453
+ "metadata": {},
454
+ "output_type": "execute_result"
455
+ }
456
+ ],
457
+ "source": [
458
+ "df.loc[df.type != \"none\"].sample(20)[[\"text\", \"type\", \"label\"]]"
459
+ ]
460
+ },
461
+ {
462
+ "cell_type": "code",
463
+ "execution_count": 10,
464
+ "id": "a195bff3",
465
+ "metadata": {},
466
+ "outputs": [
467
+ {
468
+ "data": {
469
+ "text/plain": [
470
+ "none 18969\n",
471
+ "derogation 9907\n",
472
+ "notgiven 7110\n",
473
+ "animosity 3439\n",
474
+ "dehumanization 906\n",
475
+ "threatening 606\n",
476
+ "support 207\n",
477
+ "Name: type, dtype: int64"
478
+ ]
479
+ },
480
+ "execution_count": 10,
481
+ "metadata": {},
482
+ "output_type": "execute_result"
483
+ }
484
+ ],
485
+ "source": [
486
+ "df.type.value_counts()"
487
+ ]
488
+ },
489
+ {
490
+ "cell_type": "code",
491
+ "execution_count": 23,
492
+ "id": "897a1bd5",
493
+ "metadata": {},
494
+ "outputs": [
495
+ {
496
+ "data": {
497
+ "text/plain": [
498
+ "array(['Who here wants to bet that she is JEWISH FUNDED?',\n",
499
+ " \"Believe me! Not all black men slatternly - I've met a few that were actually clean\",\n",
500
+ " \"She's a cunt. I despise her - she's taking the total piss and her dumbass followers will copy her and think it's fine to go to multiple supermarkets in a week. Do a fucking big shop Lynds and spend the rest of the time at home in your god damn ugly house. Germaphobe - what a joke!\",\n",
501
+ " \"I believe using the name jungle japping japs doesn't function as a slur, don't you agree?\",\n",
502
+ " 'well to be honest if we go buy the situation i mentioned in france we might not know the full effects for 20-40 years and seeing the outcomes of their kids raised in canada',\n",
503
+ " \"I despise all this 'anti-woke' narrative, at the same time, insisting that I am recognised as a woman is not woke, it's just my birthright, and I don't want it taken away and given to trans\",\n",
504
+ " 'it was an ugly black woman replacing a white man. This movie will fail and idiot consumertubers will take the bait and release review videos calling it trash.',\n",
505
+ " \"I'm sorry but black girls develop faster than other girls (obviously not intellectually), because that's just what is in their genes naturally!\",\n",
506
+ " 'Sadly this means that UK immigration is now free to grant an unlimited amount of work permits to non whites. With emphasis on those who “speak English”. Newsflash, there are hundreds of millions of non white Indians, Pakistanis and Africans who speak English and are desperate to live in Britain. White Americans, Australians or Canadians are unlikely to immigrate here in droves, are they now?',\n",
507
+ " 'Blacks are so fragile and whiny. Everything is a threat to THEIR race. Nobody is 100% any race you dipshits. Your dumbass is already mixed so STFU.'],\n",
508
+ " dtype=object)"
509
+ ]
510
+ },
511
+ "execution_count": 23,
512
+ "metadata": {},
513
+ "output_type": "execute_result"
514
+ }
515
+ ],
516
+ "source": [
517
+ "df.loc[df.type == \"animosity\"].sample(10).text.values"
518
+ ]
519
+ },
520
+ {
521
+ "cell_type": "code",
522
+ "execution_count": 20,
523
+ "id": "b4e7c439",
524
+ "metadata": {},
525
+ "outputs": [
526
+ {
527
+ "data": {
528
+ "text/html": [
529
+ "<div>\n",
530
+ "<style scoped>\n",
531
+ " .dataframe tbody tr th:only-of-type {\n",
532
+ " vertical-align: middle;\n",
533
+ " }\n",
534
+ "\n",
535
+ " .dataframe tbody tr th {\n",
536
+ " vertical-align: top;\n",
537
+ " }\n",
538
+ "\n",
539
+ " .dataframe thead th {\n",
540
+ " text-align: right;\n",
541
+ " }\n",
542
+ "</style>\n",
543
+ "<table border=\"1\" class=\"dataframe\">\n",
544
+ " <thead>\n",
545
+ " <tr style=\"text-align: right;\">\n",
546
+ " <th></th>\n",
547
+ " <th>acl.id</th>\n",
548
+ " <th>X1</th>\n",
549
+ " <th>text</th>\n",
550
+ " <th>label</th>\n",
551
+ " <th>type</th>\n",
552
+ " <th>target</th>\n",
553
+ " <th>level</th>\n",
554
+ " <th>split</th>\n",
555
+ " <th>round.base</th>\n",
556
+ " <th>annotator</th>\n",
557
+ " <th>round</th>\n",
558
+ " <th>acl.id.matched</th>\n",
559
+ " </tr>\n",
560
+ " </thead>\n",
561
+ " <tbody>\n",
562
+ " <tr>\n",
563
+ " <th>1437</th>\n",
564
+ " <td>acl11290</td>\n",
565
+ " <td>1437</td>\n",
566
+ " <td>people who think hermies should be eliminated ...</td>\n",
567
+ " <td>hate</td>\n",
568
+ " <td>threatening</td>\n",
569
+ " <td>gendermin</td>\n",
570
+ " <td>original</td>\n",
571
+ " <td>train</td>\n",
572
+ " <td>2</td>\n",
573
+ " <td>TrRF46JWfP</td>\n",
574
+ " <td>2a</td>\n",
575
+ " <td>acl20647</td>\n",
576
+ " </tr>\n",
577
+ " <tr>\n",
578
+ " <th>1443</th>\n",
579
+ " <td>acl11296</td>\n",
580
+ " <td>1443</td>\n",
581
+ " <td>anyone want to join me in sorting out the tran...</td>\n",
582
+ " <td>hate</td>\n",
583
+ " <td>threatening</td>\n",
584
+ " <td>gendermin</td>\n",
585
+ " <td>original</td>\n",
586
+ " <td>train</td>\n",
587
+ " <td>2</td>\n",
588
+ " <td>TrRF46JWfP</td>\n",
589
+ " <td>2a</td>\n",
590
+ " <td>acl20390</td>\n",
591
+ " </tr>\n",
592
+ " <tr>\n",
593
+ " <th>1465</th>\n",
594
+ " <td>acl11315</td>\n",
595
+ " <td>1465</td>\n",
596
+ " <td>I don't agree with scapegoating but you have t...</td>\n",
597
+ " <td>hate</td>\n",
598
+ " <td>threatening</td>\n",
599
+ " <td>gendermin</td>\n",
600
+ " <td>original</td>\n",
601
+ " <td>train</td>\n",
602
+ " <td>2</td>\n",
603
+ " <td>TrRF46JWfP</td>\n",
604
+ " <td>2a</td>\n",
605
+ " <td>acl11316</td>\n",
606
+ " </tr>\n",
607
+ " <tr>\n",
608
+ " <th>1469</th>\n",
609
+ " <td>acl11319</td>\n",
610
+ " <td>1469</td>\n",
611
+ " <td>I wish someone would just exterminate those he...</td>\n",
612
+ " <td>hate</td>\n",
613
+ " <td>threatening</td>\n",
614
+ " <td>gendermin</td>\n",
615
+ " <td>original</td>\n",
616
+ " <td>train</td>\n",
617
+ " <td>2</td>\n",
618
+ " <td>TrRF46JWfP</td>\n",
619
+ " <td>2a</td>\n",
620
+ " <td>acl11320</td>\n",
621
+ " </tr>\n",
622
+ " <tr>\n",
623
+ " <th>1495</th>\n",
624
+ " <td>acl11342</td>\n",
625
+ " <td>1495</td>\n",
626
+ " <td>Traaaans should be wiped off</td>\n",
627
+ " <td>hate</td>\n",
628
+ " <td>threatening</td>\n",
629
+ " <td>trans</td>\n",
630
+ " <td>original</td>\n",
631
+ " <td>train</td>\n",
632
+ " <td>2</td>\n",
633
+ " <td>TrRF46JWfP</td>\n",
634
+ " <td>2a</td>\n",
635
+ " <td>acl11343</td>\n",
636
+ " </tr>\n",
637
+ " <tr>\n",
638
+ " <th>...</th>\n",
639
+ " <td>...</td>\n",
640
+ " <td>...</td>\n",
641
+ " <td>...</td>\n",
642
+ " <td>...</td>\n",
643
+ " <td>...</td>\n",
644
+ " <td>...</td>\n",
645
+ " <td>...</td>\n",
646
+ " <td>...</td>\n",
647
+ " <td>...</td>\n",
648
+ " <td>...</td>\n",
649
+ " <td>...</td>\n",
650
+ " <td>...</td>\n",
651
+ " </tr>\n",
652
+ " <tr>\n",
653
+ " <th>34490</th>\n",
654
+ " <td>acl41038</td>\n",
655
+ " <td>34490</td>\n",
656
+ " <td>I proudly beat gays in the gay wars of 2007</td>\n",
657
+ " <td>hate</td>\n",
658
+ " <td>threatening</td>\n",
659
+ " <td>gay</td>\n",
660
+ " <td>perturbation</td>\n",
661
+ " <td>dev</td>\n",
662
+ " <td>4</td>\n",
663
+ " <td>IBsVsBliwX</td>\n",
664
+ " <td>4b</td>\n",
665
+ " <td>acl37574</td>\n",
666
+ " </tr>\n",
667
+ " <tr>\n",
668
+ " <th>34495</th>\n",
669
+ " <td>acl41042</td>\n",
670
+ " <td>34495</td>\n",
671
+ " <td>Covid vaccine? It's 100% sure that it's made b...</td>\n",
672
+ " <td>hate</td>\n",
673
+ " <td>threatening</td>\n",
674
+ " <td>bla, jew</td>\n",
675
+ " <td>original</td>\n",
676
+ " <td>dev</td>\n",
677
+ " <td>4</td>\n",
678
+ " <td>iO6vHa6qJm</td>\n",
679
+ " <td>4a</td>\n",
680
+ " <td>acl31366</td>\n",
681
+ " </tr>\n",
682
+ " <tr>\n",
683
+ " <th>34554</th>\n",
684
+ " <td>acl41096</td>\n",
685
+ " <td>34554</td>\n",
686
+ " <td>I hope her Daddy'll beat H.E.R., until her fac...</td>\n",
687
+ " <td>hate</td>\n",
688
+ " <td>threatening</td>\n",
689
+ " <td>wom</td>\n",
690
+ " <td>perturbation</td>\n",
691
+ " <td>dev</td>\n",
692
+ " <td>4</td>\n",
693
+ " <td>iO6vHa6qJm</td>\n",
694
+ " <td>4b</td>\n",
695
+ " <td>acl34774</td>\n",
696
+ " </tr>\n",
697
+ " <tr>\n",
698
+ " <th>34556</th>\n",
699
+ " <td>acl41098</td>\n",
700
+ " <td>34556</td>\n",
701
+ " <td>yo, what heppen to the idea of lynching that n...</td>\n",
702
+ " <td>hate</td>\n",
703
+ " <td>threatening</td>\n",
704
+ " <td>bla</td>\n",
705
+ " <td>perturbation</td>\n",
706
+ " <td>dev</td>\n",
707
+ " <td>4</td>\n",
708
+ " <td>iO6vHa6qJm</td>\n",
709
+ " <td>4b</td>\n",
710
+ " <td>acl41004</td>\n",
711
+ " </tr>\n",
712
+ " <tr>\n",
713
+ " <th>121100</th>\n",
714
+ " <td>acl32095</td>\n",
715
+ " <td>24553</td>\n",
716
+ " <td>The only good Muslim is a dead one</td>\n",
717
+ " <td>hate</td>\n",
718
+ " <td>threatening</td>\n",
719
+ " <td>mus</td>\n",
720
+ " <td>original</td>\n",
721
+ " <td>train</td>\n",
722
+ " <td>4</td>\n",
723
+ " <td>IBsVsBliwX</td>\n",
724
+ " <td>4a</td>\n",
725
+ " <td>acl32096</td>\n",
726
+ " </tr>\n",
727
+ " </tbody>\n",
728
+ "</table>\n",
729
+ "<p>606 rows × 12 columns</p>\n",
730
+ "</div>"
731
+ ],
732
+ "text/plain": [
733
+ " acl.id X1 text \\\n",
734
+ "1437 acl11290 1437 people who think hermies should be eliminated ... \n",
735
+ "1443 acl11296 1443 anyone want to join me in sorting out the tran... \n",
736
+ "1465 acl11315 1465 I don't agree with scapegoating but you have t... \n",
737
+ "1469 acl11319 1469 I wish someone would just exterminate those he... \n",
738
+ "1495 acl11342 1495 Traaaans should be wiped off \n",
739
+ "... ... ... ... \n",
740
+ "34490 acl41038 34490 I proudly beat gays in the gay wars of 2007 \n",
741
+ "34495 acl41042 34495 Covid vaccine? It's 100% sure that it's made b... \n",
742
+ "34554 acl41096 34554 I hope her Daddy'll beat H.E.R., until her fac... \n",
743
+ "34556 acl41098 34556 yo, what heppen to the idea of lynching that n... \n",
744
+ "121100 acl32095 24553 The only good Muslim is a dead one \n",
745
+ "\n",
746
+ " label type target level split round.base \\\n",
747
+ "1437 hate threatening gendermin original train 2 \n",
748
+ "1443 hate threatening gendermin original train 2 \n",
749
+ "1465 hate threatening gendermin original train 2 \n",
750
+ "1469 hate threatening gendermin original train 2 \n",
751
+ "1495 hate threatening trans original train 2 \n",
752
+ "... ... ... ... ... ... ... \n",
753
+ "34490 hate threatening gay perturbation dev 4 \n",
754
+ "34495 hate threatening bla, jew original dev 4 \n",
755
+ "34554 hate threatening wom perturbation dev 4 \n",
756
+ "34556 hate threatening bla perturbation dev 4 \n",
757
+ "121100 hate threatening mus original train 4 \n",
758
+ "\n",
759
+ " annotator round acl.id.matched \n",
760
+ "1437 TrRF46JWfP 2a acl20647 \n",
761
+ "1443 TrRF46JWfP 2a acl20390 \n",
762
+ "1465 TrRF46JWfP 2a acl11316 \n",
763
+ "1469 TrRF46JWfP 2a acl11320 \n",
764
+ "1495 TrRF46JWfP 2a acl11343 \n",
765
+ "... ... ... ... \n",
766
+ "34490 IBsVsBliwX 4b acl37574 \n",
767
+ "34495 iO6vHa6qJm 4a acl31366 \n",
768
+ "34554 iO6vHa6qJm 4b acl34774 \n",
769
+ "34556 iO6vHa6qJm 4b acl41004 \n",
770
+ "121100 IBsVsBliwX 4a acl32096 \n",
771
+ "\n",
772
+ "[606 rows x 12 columns]"
773
+ ]
774
+ },
775
+ "execution_count": 20,
776
+ "metadata": {},
777
+ "output_type": "execute_result"
778
+ }
779
+ ],
780
+ "source": [
781
+ "targets = [\"threatening\"]\n",
782
+ "clean_df = df.loc[df.type.isin(targets)][[\"text\", \"label\"]]\n",
783
+ "clean_df.label = 1\n",
784
+ "clean_df.to_csv(\"../../data/processed/Dynamically-Generated-Hate-Speech-Dataset_p.csv\")"
785
+ ]
786
+ }
787
+ ],
788
+ "metadata": {
789
+ "kernelspec": {
790
+ "display_name": "sexism_detection",
791
+ "language": "python",
792
+ "name": "sexism_detection"
793
+ },
794
+ "language_info": {
795
+ "codemirror_mode": {
796
+ "name": "ipython",
797
+ "version": 3
798
+ },
799
+ "file_extension": ".py",
800
+ "mimetype": "text/x-python",
801
+ "name": "python",
802
+ "nbconvert_exporter": "python",
803
+ "pygments_lexer": "ipython3",
804
+ "version": "3.9.15"
805
+ }
806
+ },
807
+ "nbformat": 4,
808
+ "nbformat_minor": 5
809
+ }
notebooks/FTR dataset.ipynb ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 6,
6
+ "id": "cee0a836",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "import os\n",
11
+ "import pandas as pd\n",
12
+ "\n",
13
+ "import string\n",
14
+ "import re"
15
+ ]
16
+ },
17
+ {
18
+ "cell_type": "code",
19
+ "execution_count": 107,
20
+ "id": "33a2e4e7",
21
+ "metadata": {},
22
+ "outputs": [],
23
+ "source": [
24
+ "ftr_dataset = \"/opt/tmp/src/FTR-dataset/FTR_new_labels.csv\"\n",
25
+ "output_dir = \"../../data/processed/\"\n",
26
+ "\n",
27
+ "ftr_df = pd.read_csv(ftr_dataset, index_col=[0], encoding = \"ISO-8859-1\")"
28
+ ]
29
+ },
30
+ {
31
+ "cell_type": "code",
32
+ "execution_count": 5,
33
+ "id": "85957e26",
34
+ "metadata": {},
35
+ "outputs": [
36
+ {
37
+ "data": {
38
+ "text/html": [
39
+ "<div>\n",
40
+ "<style scoped>\n",
41
+ " .dataframe tbody tr th:only-of-type {\n",
42
+ " vertical-align: middle;\n",
43
+ " }\n",
44
+ "\n",
45
+ " .dataframe tbody tr th {\n",
46
+ " vertical-align: top;\n",
47
+ " }\n",
48
+ "\n",
49
+ " .dataframe thead th {\n",
50
+ " text-align: right;\n",
51
+ " }\n",
52
+ "</style>\n",
53
+ "<table border=\"1\" class=\"dataframe\">\n",
54
+ " <thead>\n",
55
+ " <tr style=\"text-align: right;\">\n",
56
+ " <th></th>\n",
57
+ " <th>tweet</th>\n",
58
+ " <th>label</th>\n",
59
+ " </tr>\n",
60
+ " <tr>\n",
61
+ " <th>id</th>\n",
62
+ " <th></th>\n",
63
+ " <th></th>\n",
64
+ " </tr>\n",
65
+ " </thead>\n",
66
+ " <tbody>\n",
67
+ " <tr>\n",
68
+ " <th>0</th>\n",
69
+ " <td>Elle ne devait pas dégager la nazi ???</td>\n",
70
+ " <td>1</td>\n",
71
+ " </tr>\n",
72
+ " <tr>\n",
73
+ " <th>1</th>\n",
74
+ " <td>je dois faire un oral en anglais sur Hitler et...</td>\n",
75
+ " <td>0</td>\n",
76
+ " </tr>\n",
77
+ " <tr>\n",
78
+ " <th>2</th>\n",
79
+ " <td>A ça 🤏 de ressembler à la croix nazi mdrr</td>\n",
80
+ " <td>0</td>\n",
81
+ " </tr>\n",
82
+ " <tr>\n",
83
+ " <th>3</th>\n",
84
+ " <td>\"Par curiosité, j’ai voulu écouter les dis...</td>\n",
85
+ " <td>0</td>\n",
86
+ " </tr>\n",
87
+ " <tr>\n",
88
+ " <th>4</th>\n",
89
+ " <td>Mdr deux nazi n importe quoi 🤦🏼‍♀️</td>\n",
90
+ " <td>1</td>\n",
91
+ " </tr>\n",
92
+ " <tr>\n",
93
+ " <th>...</th>\n",
94
+ " <td>...</td>\n",
95
+ " <td>...</td>\n",
96
+ " </tr>\n",
97
+ " <tr>\n",
98
+ " <th>2851</th>\n",
99
+ " <td>Kevin c’est un sal noir.</td>\n",
100
+ " <td>1</td>\n",
101
+ " </tr>\n",
102
+ " <tr>\n",
103
+ " <th>2852</th>\n",
104
+ " <td>bougnoule bamboula sale arabe , elle est belle...</td>\n",
105
+ " <td>1</td>\n",
106
+ " </tr>\n",
107
+ " <tr>\n",
108
+ " <th>2853</th>\n",
109
+ " <td>Tu viens de le traiter de sal noir ?</td>\n",
110
+ " <td>1</td>\n",
111
+ " </tr>\n",
112
+ " <tr>\n",
113
+ " <th>2854</th>\n",
114
+ " <td>SAL NOIR</td>\n",
115
+ " <td>1</td>\n",
116
+ " </tr>\n",
117
+ " <tr>\n",
118
+ " <th>2855</th>\n",
119
+ " <td>Sal Noir</td>\n",
120
+ " <td>1</td>\n",
121
+ " </tr>\n",
122
+ " </tbody>\n",
123
+ "</table>\n",
124
+ "<p>2856 rows × 2 columns</p>\n",
125
+ "</div>"
126
+ ],
127
+ "text/plain": [
128
+ " tweet label\n",
129
+ "id \n",
130
+ "0 Elle ne devait pas dégager la nazi ??? 1\n",
131
+ "1 je dois faire un oral en anglais sur Hitler et... 0\n",
132
+ "2 A ça 🤏 de ressembler à la croix nazi mdrr 0\n",
133
+ "3 \"Par curiosité, j’ai voulu écouter les dis... 0\n",
134
+ "4 Mdr deux nazi n importe quoi 🤦🏼‍♀️ 1\n",
135
+ "... ... ...\n",
136
+ "2851 Kevin c’est un sal noir. 1\n",
137
+ "2852 bougnoule bamboula sale arabe , elle est belle... 1\n",
138
+ "2853 Tu viens de le traiter de sal noir ? 1\n",
139
+ "2854 SAL NOIR 1\n",
140
+ "2855 Sal Noir 1\n",
141
+ "\n",
142
+ "[2856 rows x 2 columns]"
143
+ ]
144
+ },
145
+ "execution_count": 5,
146
+ "metadata": {},
147
+ "output_type": "execute_result"
148
+ }
149
+ ],
150
+ "source": [
151
+ "chars = string.ascii_letters + string.punctuation + string.whitespace\n",
152
+ "chars = chars + \"éèê\"\n",
153
+ "\n",
154
+ "url_pattern = r\"(http|https)\\S*\"\n",
155
+ "user_naming_pattern = r\"@\\S*\"\n",
156
+ "\n",
157
+ "ftr_df.tweet = ftr_df.tweet \\\n",
158
+ " .apply(lambda x: re.sub(url_pattern, \"\", x)) \\\n",
159
+ " .apply(lambda x: re.sub(user_naming_pattern, \"\", x))\n",
160
+ "\n",
161
+ "ftr_df"
162
+ ]
163
+ },
164
+ {
165
+ "cell_type": "code",
166
+ "execution_count": 108,
167
+ "id": "6ac2e998",
168
+ "metadata": {},
169
+ "outputs": [],
170
+ "source": [
171
+ "import re\n",
172
+ "\n",
173
+ "def clean_text(text):\n",
174
+ " \n",
175
+ " out = text.replace(\"é\", \"é\")\n",
176
+ " out = out.replace(\"ç\", \"ç\")\n",
177
+ " out = out.replace(\"Ã\\x87\", \"ç\")\n",
178
+ " out = out.replace(\"Ã\\xa0\", \"à\")\n",
179
+ " out = out.replace(\"î\", \"ê\")\n",
180
+ " out = out.replace(\"è\", \"è\")\n",
181
+ " out = out.replace(\"’\", \"'\")\n",
182
+ " out = out.replace('Ã\\x8a', \"ê\")\n",
183
+ " out = out.replace('Ã\\x89', \"é\")\n",
184
+ " out = out.replace(\"Å\\x93\", \"oe\")\n",
185
+ " out = out.replace(\"ô\", \"ô\")\n",
186
+ " \n",
187
+ " \n",
188
+ " out = out.replace(\"ê\", \"\")\n",
189
+ " out = out.replace(\"\\n\", \"\")\n",
190
+ " out = out.replace(\"\\\\'\", \"\")\n",
191
+ " \n",
192
+ " # Smileys\n",
193
+ " out = out.replace(\"â\\x9c\\x8b\", \"\")\n",
194
+ " out = out.replace(\"â\\x9c\\x8b\", \"\")\n",
195
+ " out = out.replace(\"\\x8f\", \"\")\n",
196
+ " out = out.replace(\"â\\x9c\\x8a\", \"\")\n",
197
+ " out = out.replace(\"â\\x80\\x9d\", \"\")\n",
198
+ " out = out.replace(\"«Â\\xa0\", \"\")\n",
199
+ " out = out.replace(\"\\x85\", \"\")\n",
200
+ " \n",
201
+ " # Smileys\n",
202
+ " out = re.sub(\"ð([^\\s]+)\", \"\", out)\n",
203
+ " out = re.sub(\"â([^\\s]+)\", \"\", out)\n",
204
+ " \n",
205
+ " return out\n",
206
+ "\n",
207
+ "ftr_df[\"tweet_clean\"] = ftr_df.tweet.apply(clean_text)\n",
208
+ "\n",
209
+ "ftr_df.loc[ftr_df.label == 1].to_csv(os.path.join(output_dir, \"ftr_dataset_positive.csv\"))\n",
210
+ "ftr_df.loc[ftr_df.label == 0].to_csv(os.path.join(output_dir, \"ftr_dataset_negative.csv\"))"
211
+ ]
212
+ }
213
+ ],
214
+ "metadata": {
215
+ "kernelspec": {
216
+ "display_name": "sexism_detection",
217
+ "language": "python",
218
+ "name": "sexism_detection"
219
+ },
220
+ "language_info": {
221
+ "codemirror_mode": {
222
+ "name": "ipython",
223
+ "version": 3
224
+ },
225
+ "file_extension": ".py",
226
+ "mimetype": "text/x-python",
227
+ "name": "python",
228
+ "nbconvert_exporter": "python",
229
+ "pygments_lexer": "ipython3",
230
+ "version": "3.9.15"
231
+ }
232
+ },
233
+ "nbformat": 4,
234
+ "nbformat_minor": 5
235
+ }
notebooks/JoinDatasets.ipynb ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "c6cadd34",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "import pandas as pd\n",
11
+ "import os\n",
12
+ "import glob"
13
+ ]
14
+ },
15
+ {
16
+ "cell_type": "code",
17
+ "execution_count": 2,
18
+ "id": "4ce0c480",
19
+ "metadata": {},
20
+ "outputs": [
21
+ {
22
+ "name": "stdout",
23
+ "output_type": "stream",
24
+ "text": [
25
+ "Filenames :\n",
26
+ "../../data/processed/uc-berkeley-measuring-hate-speech-negative-translated.csv\n",
27
+ "../../data/processed/caa_negative.csv\n",
28
+ "../../data/processed/caa_positive.csv\n",
29
+ "../../data/processed/ftr_dataset_negative.csv\n",
30
+ "../../data/processed/mlma_negative.csv\n",
31
+ "../../data/processed/merged_datasets.csv\n",
32
+ "../../data/processed/mlma_positive.csv\n",
33
+ "../../data/processed/ftr_dataset_positive.csv\n",
34
+ "../../data/processed/uc-berkeley-measuring-hate-speech-positive-translated.csv\n",
35
+ "\n",
36
+ "Columns:\n",
37
+ "['Unnamed: 2']\n",
38
+ "['tweet' 'sentiment' 'directness' 'annotator_sentiment' 'target' 'group']\n",
39
+ "['tweet' 'label' 'tweet_clean']\n",
40
+ "['translated' 'hate_speech_score' 'translated_clean' 'label']\n",
41
+ "['translated' 'hate_speech_score' 'translated_clean' 'label']\n",
42
+ "['Unnamed: 2']\n",
43
+ "['tweet' 'label' 'tweet_clean']\n",
44
+ "['tweet' 'sentiment' 'directness' 'annotator_sentiment' 'target' 'group']\n",
45
+ "['text']\n"
46
+ ]
47
+ }
48
+ ],
49
+ "source": [
50
+ "input_dir = \"../../data/processed/\"\n",
51
+ "output_dir = \"../../data/processed/\"\n",
52
+ "\n",
53
+ "filenames = glob.glob(input_dir + \"*\")\n",
54
+ "\n",
55
+ "print(\"Filenames :\")\n",
56
+ "pos, neg = [], []\n",
57
+ "for filename in filenames:\n",
58
+ " print(filename)\n",
59
+ " if \"positive\" in filename:\n",
60
+ " pos.append(pd.read_csv(filename, index_col=[0]))\n",
61
+ " else:\n",
62
+ " neg.append(pd.read_csv(filename, index_col=[0]))\n",
63
+ " \n",
64
+ "print()\n",
65
+ "print(\"Columns:\")\n",
66
+ "for pos_df in pos:\n",
67
+ " print(pos_df.columns.values)\n",
68
+ " \n",
69
+ "for neg_df in neg:\n",
70
+ " print(neg_df.columns.values)"
71
+ ]
72
+ },
73
+ {
74
+ "cell_type": "code",
75
+ "execution_count": 3,
76
+ "id": "ef7ee207",
77
+ "metadata": {},
78
+ "outputs": [
79
+ {
80
+ "name": "stdout",
81
+ "output_type": "stream",
82
+ "text": [
83
+ "Positive : 5011\n",
84
+ "Negative : 31378\n"
85
+ ]
86
+ }
87
+ ],
88
+ "source": [
89
+ "for pos_df in pos:\n",
90
+ " if \"Unnamed: 2\" in pos_df.columns:\n",
91
+ " pos_df.rename({\"Unnamed: 2\" : \"text\"}, inplace=True, axis=1)\n",
92
+ " elif \"tweet_clean\" in pos_df.columns:\n",
93
+ " pos_df.rename({\"tweet_clean\" : \"text\"}, inplace=True, axis=1)\n",
94
+ " elif 'translated_clean' in pos_df.columns:\n",
95
+ " pos_df.rename({\"translated_clean\" : \"text\"}, inplace=True, axis=1)\n",
96
+ " elif \"tweet\" in pos_df.columns:\n",
97
+ " pos_df.rename({\"tweet\" : \"text\"}, inplace=True, axis=1)\n",
98
+ " \n",
99
+ "for neg_df in neg:\n",
100
+ " if \"Unnamed: 2\" in neg_df.columns:\n",
101
+ " neg_df.rename({\"Unnamed: 2\" : \"text\"}, inplace=True, axis=1)\n",
102
+ " elif \"tweet_clean\" in neg_df.columns:\n",
103
+ " neg_df.rename({\"tweet_clean\" : \"text\"}, inplace=True, axis=1)\n",
104
+ " elif 'translated_clean' in neg_df.columns:\n",
105
+ " neg_df.rename({\"translated_clean\" : \"text\"}, inplace=True, axis=1)\n",
106
+ " elif \"tweet\" in neg_df.columns:\n",
107
+ " neg_df.rename({\"tweet\" : \"text\"}, inplace=True, axis=1)\n",
108
+ " \n",
109
+ "pos = pd.concat(pos)[[\"text\"]]\n",
110
+ "pos[\"label\"] = 1\n",
111
+ "neg = pd.concat(neg)[[\"text\"]]\n",
112
+ "neg[\"label\"] = 0\n",
113
+ "\n",
114
+ "print(\"Positive :\", pos.shape[0])\n",
115
+ "print(\"Negative :\", neg.shape[0])"
116
+ ]
117
+ },
118
+ {
119
+ "cell_type": "code",
120
+ "execution_count": 4,
121
+ "id": "3ec5fa31",
122
+ "metadata": {},
123
+ "outputs": [],
124
+ "source": [
125
+ "merged = pd.concat([pos, neg])\n",
126
+ "merged.to_csv(os.path.join(output_dir, \"merged_datasets.csv\"))"
127
+ ]
128
+ },
129
+ {
130
+ "cell_type": "code",
131
+ "execution_count": null,
132
+ "id": "9fe7d6ab",
133
+ "metadata": {},
134
+ "outputs": [],
135
+ "source": []
136
+ },
137
+ {
138
+ "cell_type": "code",
139
+ "execution_count": null,
140
+ "id": "fd896f4c",
141
+ "metadata": {},
142
+ "outputs": [],
143
+ "source": []
144
+ }
145
+ ],
146
+ "metadata": {
147
+ "kernelspec": {
148
+ "display_name": "sexism_detection",
149
+ "language": "python",
150
+ "name": "sexism_detection"
151
+ },
152
+ "language_info": {
153
+ "codemirror_mode": {
154
+ "name": "ipython",
155
+ "version": 3
156
+ },
157
+ "file_extension": ".py",
158
+ "mimetype": "text/x-python",
159
+ "name": "python",
160
+ "nbconvert_exporter": "python",
161
+ "pygments_lexer": "ipython3",
162
+ "version": "3.9.15"
163
+ }
164
+ },
165
+ "nbformat": 4,
166
+ "nbformat_minor": 5
167
+ }
notebooks/MLMA dataset.ipynb ADDED
@@ -0,0 +1,511 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "88f13606",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "import pandas as pd\n",
11
+ "import os\n",
12
+ "import re\n",
13
+ "\n",
14
+ "import string\n",
15
+ "\n",
16
+ "chars = string.ascii_letters + string.punctuation + string.whitespace\n",
17
+ "chars = chars + \"éèê\"\n",
18
+ "\n",
19
+ "url_pattern = r\"(http|https)\\S*\"\n",
20
+ "user_naming_pattern = r\"@\\S*\""
21
+ ]
22
+ },
23
+ {
24
+ "cell_type": "code",
25
+ "execution_count": 27,
26
+ "id": "9bff3e8d",
27
+ "metadata": {},
28
+ "outputs": [],
29
+ "source": [
30
+ "mlma_dataset = \"../../data/hate_speech_mlma_fr_dataset.csv\"\n",
31
+ "output_dir = \"../../data/processed/\"\n",
32
+ "\n",
33
+ "mlma_df = pd.read_csv(mlma_dataset, index_col=[0])"
34
+ ]
35
+ },
36
+ {
37
+ "cell_type": "code",
38
+ "execution_count": 3,
39
+ "id": "909d714e",
40
+ "metadata": {},
41
+ "outputs": [
42
+ {
43
+ "data": {
44
+ "text/html": [
45
+ "<div>\n",
46
+ "<style scoped>\n",
47
+ " .dataframe tbody tr th:only-of-type {\n",
48
+ " vertical-align: middle;\n",
49
+ " }\n",
50
+ "\n",
51
+ " .dataframe tbody tr th {\n",
52
+ " vertical-align: top;\n",
53
+ " }\n",
54
+ "\n",
55
+ " .dataframe thead th {\n",
56
+ " text-align: right;\n",
57
+ " }\n",
58
+ "</style>\n",
59
+ "<table border=\"1\" class=\"dataframe\">\n",
60
+ " <thead>\n",
61
+ " <tr style=\"text-align: right;\">\n",
62
+ " <th></th>\n",
63
+ " <th>tweet</th>\n",
64
+ " <th>sentiment</th>\n",
65
+ " <th>directness</th>\n",
66
+ " <th>annotator_sentiment</th>\n",
67
+ " <th>target</th>\n",
68
+ " <th>group</th>\n",
69
+ " </tr>\n",
70
+ " <tr>\n",
71
+ " <th>HITId</th>\n",
72
+ " <th></th>\n",
73
+ " <th></th>\n",
74
+ " <th></th>\n",
75
+ " <th></th>\n",
76
+ " <th></th>\n",
77
+ " <th></th>\n",
78
+ " </tr>\n",
79
+ " </thead>\n",
80
+ " <tbody>\n",
81
+ " <tr>\n",
82
+ " <th>1</th>\n",
83
+ " <td>rt personnage ainsi q tte la clique gauchiste...</td>\n",
84
+ " <td>abusive</td>\n",
85
+ " <td>direct</td>\n",
86
+ " <td>shock</td>\n",
87
+ " <td>origin</td>\n",
88
+ " <td>other</td>\n",
89
+ " </tr>\n",
90
+ " <tr>\n",
91
+ " <th>2</th>\n",
92
+ " <td>bah oui t'as raison l'autre c'est un mongol.</td>\n",
93
+ " <td>offensive</td>\n",
94
+ " <td>indirect</td>\n",
95
+ " <td>shock</td>\n",
96
+ " <td>other</td>\n",
97
+ " <td>individual</td>\n",
98
+ " </tr>\n",
99
+ " <tr>\n",
100
+ " <th>3</th>\n",
101
+ " <td>moi j'ai personne à qui m'adresser pour réclam...</td>\n",
102
+ " <td>hateful</td>\n",
103
+ " <td>direct</td>\n",
104
+ " <td>anger_confusion_sadness_fear_disgust</td>\n",
105
+ " <td>other</td>\n",
106
+ " <td>women</td>\n",
107
+ " </tr>\n",
108
+ " <tr>\n",
109
+ " <th>6</th>\n",
110
+ " <td>en algerie les migrants sont expulsés dans le ...</td>\n",
111
+ " <td>offensive</td>\n",
112
+ " <td>indirect</td>\n",
113
+ " <td>indifference</td>\n",
114
+ " <td>other</td>\n",
115
+ " <td>immigrants</td>\n",
116
+ " </tr>\n",
117
+ " <tr>\n",
118
+ " <th>9</th>\n",
119
+ " <td>mytho t'as juste voulu te faire ken par les re...</td>\n",
120
+ " <td>offensive</td>\n",
121
+ " <td>indirect</td>\n",
122
+ " <td>indifference_disgust</td>\n",
123
+ " <td>other</td>\n",
124
+ " <td>individual</td>\n",
125
+ " </tr>\n",
126
+ " <tr>\n",
127
+ " <th>...</th>\n",
128
+ " <td>...</td>\n",
129
+ " <td>...</td>\n",
130
+ " <td>...</td>\n",
131
+ " <td>...</td>\n",
132
+ " <td>...</td>\n",
133
+ " <td>...</td>\n",
134
+ " </tr>\n",
135
+ " <tr>\n",
136
+ " <th>4009</th>\n",
137
+ " <td>vos twt rappel l'époque ou les journalistes tr...</td>\n",
138
+ " <td>offensive</td>\n",
139
+ " <td>direct</td>\n",
140
+ " <td>shock</td>\n",
141
+ " <td>other</td>\n",
142
+ " <td>jews</td>\n",
143
+ " </tr>\n",
144
+ " <tr>\n",
145
+ " <th>4010</th>\n",
146
+ " <td>tres bien. le cinema francais c...est souvent ...</td>\n",
147
+ " <td>offensive</td>\n",
148
+ " <td>indirect</td>\n",
149
+ " <td>sadness</td>\n",
150
+ " <td>other</td>\n",
151
+ " <td>left_wing_people</td>\n",
152
+ " </tr>\n",
153
+ " <tr>\n",
154
+ " <th>4011</th>\n",
155
+ " <td>j’ai que des rebeus en demande d’amis aussi</td>\n",
156
+ " <td>disrespectful_normal</td>\n",
157
+ " <td>direct</td>\n",
158
+ " <td>indifference</td>\n",
159
+ " <td>origin</td>\n",
160
+ " <td>arabs</td>\n",
161
+ " </tr>\n",
162
+ " <tr>\n",
163
+ " <th>4012</th>\n",
164
+ " <td>sale juif de merde</td>\n",
165
+ " <td>offensive</td>\n",
166
+ " <td>direct</td>\n",
167
+ " <td>fear_shock_indifference_sadness_disgust</td>\n",
168
+ " <td>religion</td>\n",
169
+ " <td>jews</td>\n",
170
+ " </tr>\n",
171
+ " <tr>\n",
172
+ " <th>4014</th>\n",
173
+ " <td>mdr c’est un mongol lui en mode lui demander d...</td>\n",
174
+ " <td>offensive</td>\n",
175
+ " <td>indirect</td>\n",
176
+ " <td>indifference</td>\n",
177
+ " <td>disability</td>\n",
178
+ " <td>individual</td>\n",
179
+ " </tr>\n",
180
+ " </tbody>\n",
181
+ "</table>\n",
182
+ "<p>3193 rows × 6 columns</p>\n",
183
+ "</div>"
184
+ ],
185
+ "text/plain": [
186
+ " tweet \\\n",
187
+ "HITId \n",
188
+ "1 rt personnage ainsi q tte la clique gauchiste... \n",
189
+ "2 bah oui t'as raison l'autre c'est un mongol. \n",
190
+ "3 moi j'ai personne à qui m'adresser pour réclam... \n",
191
+ "6 en algerie les migrants sont expulsés dans le ... \n",
192
+ "9 mytho t'as juste voulu te faire ken par les re... \n",
193
+ "... ... \n",
194
+ "4009 vos twt rappel l'époque ou les journalistes tr... \n",
195
+ "4010 tres bien. le cinema francais c...est souvent ... \n",
196
+ "4011 j’ai que des rebeus en demande d’amis aussi \n",
197
+ "4012 sale juif de merde \n",
198
+ "4014 mdr c’est un mongol lui en mode lui demander d... \n",
199
+ "\n",
200
+ " sentiment directness \\\n",
201
+ "HITId \n",
202
+ "1 abusive direct \n",
203
+ "2 offensive indirect \n",
204
+ "3 hateful direct \n",
205
+ "6 offensive indirect \n",
206
+ "9 offensive indirect \n",
207
+ "... ... ... \n",
208
+ "4009 offensive direct \n",
209
+ "4010 offensive indirect \n",
210
+ "4011 disrespectful_normal direct \n",
211
+ "4012 offensive direct \n",
212
+ "4014 offensive indirect \n",
213
+ "\n",
214
+ " annotator_sentiment target group \n",
215
+ "HITId \n",
216
+ "1 shock origin other \n",
217
+ "2 shock other individual \n",
218
+ "3 anger_confusion_sadness_fear_disgust other women \n",
219
+ "6 indifference other immigrants \n",
220
+ "9 indifference_disgust other individual \n",
221
+ "... ... ... ... \n",
222
+ "4009 shock other jews \n",
223
+ "4010 sadness other left_wing_people \n",
224
+ "4011 indifference origin arabs \n",
225
+ "4012 fear_shock_indifference_sadness_disgust religion jews \n",
226
+ "4014 indifference disability individual \n",
227
+ "\n",
228
+ "[3193 rows x 6 columns]"
229
+ ]
230
+ },
231
+ "execution_count": 3,
232
+ "metadata": {},
233
+ "output_type": "execute_result"
234
+ }
235
+ ],
236
+ "source": [
237
+ "mlma_df.tweet = mlma_df.tweet.apply(lambda x: re.sub(user_naming_pattern, \"\", x).strip())\n",
238
+ "\n",
239
+ "mlma_abuse_df = mlma_df \\\n",
240
+ " .loc[mlma_df.sentiment != \"normal\"]\n",
241
+ "\n",
242
+ "mlma_no_abuse_df = mlma_df \\\n",
243
+ " .loc[mlma_df.sentiment == \"normal\"]\n",
244
+ "\n",
245
+ "mlma_abuse_df"
246
+ ]
247
+ },
248
+ {
249
+ "cell_type": "code",
250
+ "execution_count": 17,
251
+ "id": "e227676c",
252
+ "metadata": {},
253
+ "outputs": [
254
+ {
255
+ "name": "stderr",
256
+ "output_type": "stream",
257
+ "text": [
258
+ "/tmp/ipykernel_17576/1118330829.py:12: SettingWithCopyWarning: \n",
259
+ "A value is trying to be set on a copy of a slice from a DataFrame.\n",
260
+ "Try using .loc[row_indexer,col_indexer] = value instead\n",
261
+ "\n",
262
+ "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
263
+ " pruned_mlma_abuse.tweet = pruned_mlma_abuse.tweet.apply(clean_text)\n"
264
+ ]
265
+ },
266
+ {
267
+ "data": {
268
+ "text/html": [
269
+ "<div>\n",
270
+ "<style scoped>\n",
271
+ " .dataframe tbody tr th:only-of-type {\n",
272
+ " vertical-align: middle;\n",
273
+ " }\n",
274
+ "\n",
275
+ " .dataframe tbody tr th {\n",
276
+ " vertical-align: top;\n",
277
+ " }\n",
278
+ "\n",
279
+ " .dataframe thead th {\n",
280
+ " text-align: right;\n",
281
+ " }\n",
282
+ "</style>\n",
283
+ "<table border=\"1\" class=\"dataframe\">\n",
284
+ " <thead>\n",
285
+ " <tr style=\"text-align: right;\">\n",
286
+ " <th></th>\n",
287
+ " <th>tweet</th>\n",
288
+ " <th>sentiment</th>\n",
289
+ " <th>directness</th>\n",
290
+ " <th>annotator_sentiment</th>\n",
291
+ " <th>target</th>\n",
292
+ " <th>group</th>\n",
293
+ " </tr>\n",
294
+ " <tr>\n",
295
+ " <th>HITId</th>\n",
296
+ " <th></th>\n",
297
+ " <th></th>\n",
298
+ " <th></th>\n",
299
+ " <th></th>\n",
300
+ " <th></th>\n",
301
+ " <th></th>\n",
302
+ " </tr>\n",
303
+ " </thead>\n",
304
+ " <tbody>\n",
305
+ " <tr>\n",
306
+ " <th>1</th>\n",
307
+ " <td>personnage ainsi q tte la clique gauchiste de...</td>\n",
308
+ " <td>abusive</td>\n",
309
+ " <td>direct</td>\n",
310
+ " <td>shock</td>\n",
311
+ " <td>origin</td>\n",
312
+ " <td>other</td>\n",
313
+ " </tr>\n",
314
+ " <tr>\n",
315
+ " <th>2</th>\n",
316
+ " <td>bah oui t'as raison l'autre c'est un mongol.</td>\n",
317
+ " <td>offensive</td>\n",
318
+ " <td>indirect</td>\n",
319
+ " <td>shock</td>\n",
320
+ " <td>other</td>\n",
321
+ " <td>individual</td>\n",
322
+ " </tr>\n",
323
+ " <tr>\n",
324
+ " <th>6</th>\n",
325
+ " <td>en algerie les migrants sont expulsés dans le ...</td>\n",
326
+ " <td>offensive</td>\n",
327
+ " <td>indirect</td>\n",
328
+ " <td>indifference</td>\n",
329
+ " <td>other</td>\n",
330
+ " <td>immigrants</td>\n",
331
+ " </tr>\n",
332
+ " <tr>\n",
333
+ " <th>9</th>\n",
334
+ " <td>mytho t'as juste voulu te faire ken par les re...</td>\n",
335
+ " <td>offensive</td>\n",
336
+ " <td>indirect</td>\n",
337
+ " <td>indifference_disgust</td>\n",
338
+ " <td>other</td>\n",
339
+ " <td>individual</td>\n",
340
+ " </tr>\n",
341
+ " <tr>\n",
342
+ " <th>10</th>\n",
343
+ " <td>c’est un giga attardé mdrrr ils va vraiment se...</td>\n",
344
+ " <td>offensive</td>\n",
345
+ " <td>direct</td>\n",
346
+ " <td>indifference</td>\n",
347
+ " <td>origin</td>\n",
348
+ " <td>individual</td>\n",
349
+ " </tr>\n",
350
+ " <tr>\n",
351
+ " <th>...</th>\n",
352
+ " <td>...</td>\n",
353
+ " <td>...</td>\n",
354
+ " <td>...</td>\n",
355
+ " <td>...</td>\n",
356
+ " <td>...</td>\n",
357
+ " <td>...</td>\n",
358
+ " </tr>\n",
359
+ " <tr>\n",
360
+ " <th>4008</th>\n",
361
+ " <td>pk tu mparles ching chong fils de pute</td>\n",
362
+ " <td>offensive</td>\n",
363
+ " <td>direct</td>\n",
364
+ " <td>indifference</td>\n",
365
+ " <td>origin</td>\n",
366
+ " <td>asians</td>\n",
367
+ " </tr>\n",
368
+ " <tr>\n",
369
+ " <th>4009</th>\n",
370
+ " <td>vos twt rappel l'époque ou les journalistes tr...</td>\n",
371
+ " <td>offensive</td>\n",
372
+ " <td>direct</td>\n",
373
+ " <td>shock</td>\n",
374
+ " <td>other</td>\n",
375
+ " <td>jews</td>\n",
376
+ " </tr>\n",
377
+ " <tr>\n",
378
+ " <th>4010</th>\n",
379
+ " <td>tres bien. le cinema francais c...est souvent ...</td>\n",
380
+ " <td>offensive</td>\n",
381
+ " <td>indirect</td>\n",
382
+ " <td>sadness</td>\n",
383
+ " <td>other</td>\n",
384
+ " <td>left_wing_people</td>\n",
385
+ " </tr>\n",
386
+ " <tr>\n",
387
+ " <th>4012</th>\n",
388
+ " <td>sale juif de merde</td>\n",
389
+ " <td>offensive</td>\n",
390
+ " <td>direct</td>\n",
391
+ " <td>fear_shock_indifference_sadness_disgust</td>\n",
392
+ " <td>religion</td>\n",
393
+ " <td>jews</td>\n",
394
+ " </tr>\n",
395
+ " <tr>\n",
396
+ " <th>4014</th>\n",
397
+ " <td>mdr c’est un mongol lui en mode lui demander d...</td>\n",
398
+ " <td>offensive</td>\n",
399
+ " <td>indirect</td>\n",
400
+ " <td>indifference</td>\n",
401
+ " <td>disability</td>\n",
402
+ " <td>individual</td>\n",
403
+ " </tr>\n",
404
+ " </tbody>\n",
405
+ "</table>\n",
406
+ "<p>1930 rows × 6 columns</p>\n",
407
+ "</div>"
408
+ ],
409
+ "text/plain": [
410
+ " tweet sentiment \\\n",
411
+ "HITId \n",
412
+ "1 personnage ainsi q tte la clique gauchiste de... abusive \n",
413
+ "2 bah oui t'as raison l'autre c'est un mongol. offensive \n",
414
+ "6 en algerie les migrants sont expulsés dans le ... offensive \n",
415
+ "9 mytho t'as juste voulu te faire ken par les re... offensive \n",
416
+ "10 c’est un giga attardé mdrrr ils va vraiment se... offensive \n",
417
+ "... ... ... \n",
418
+ "4008 pk tu mparles ching chong fils de pute offensive \n",
419
+ "4009 vos twt rappel l'époque ou les journalistes tr... offensive \n",
420
+ "4010 tres bien. le cinema francais c...est souvent ... offensive \n",
421
+ "4012 sale juif de merde offensive \n",
422
+ "4014 mdr c’est un mongol lui en mode lui demander d... offensive \n",
423
+ "\n",
424
+ " directness annotator_sentiment target \\\n",
425
+ "HITId \n",
426
+ "1 direct shock origin \n",
427
+ "2 indirect shock other \n",
428
+ "6 indirect indifference other \n",
429
+ "9 indirect indifference_disgust other \n",
430
+ "10 direct indifference origin \n",
431
+ "... ... ... ... \n",
432
+ "4008 direct indifference origin \n",
433
+ "4009 direct shock other \n",
434
+ "4010 indirect sadness other \n",
435
+ "4012 direct fear_shock_indifference_sadness_disgust religion \n",
436
+ "4014 indirect indifference disability \n",
437
+ "\n",
438
+ " group \n",
439
+ "HITId \n",
440
+ "1 other \n",
441
+ "2 individual \n",
442
+ "6 immigrants \n",
443
+ "9 individual \n",
444
+ "10 individual \n",
445
+ "... ... \n",
446
+ "4008 asians \n",
447
+ "4009 jews \n",
448
+ "4010 left_wing_people \n",
449
+ "4012 jews \n",
450
+ "4014 individual \n",
451
+ "\n",
452
+ "[1930 rows x 6 columns]"
453
+ ]
454
+ },
455
+ "execution_count": 17,
456
+ "metadata": {},
457
+ "output_type": "execute_result"
458
+ }
459
+ ],
460
+ "source": [
461
+ "def clean_text(text):\n",
462
+ " \n",
463
+ " out = text.replace(\"rt \", \"\")\n",
464
+ " out = out.replace(\"\\xa0\", \"\")\n",
465
+ " for w in out.split():\n",
466
+ " if \"…\" in w:\n",
467
+ " out = out.replace(w, \"\")\n",
468
+ " return out\n",
469
+ "\n",
470
+ "target_categories = [\"abusive\", \"offensive\"]\n",
471
+ "pruned_mlma_abuse = mlma_abuse_df.loc[mlma_abuse_df.sentiment.isin(target_categories)]\n",
472
+ "pruned_mlma_abuse.tweet = pruned_mlma_abuse.tweet.apply(clean_text)\n",
473
+ "pruned_mlma_abuse"
474
+ ]
475
+ },
476
+ {
477
+ "cell_type": "code",
478
+ "execution_count": 28,
479
+ "id": "db79bea5",
480
+ "metadata": {
481
+ "scrolled": true
482
+ },
483
+ "outputs": [],
484
+ "source": [
485
+ "pruned_mlma_abuse.to_csv(os.path.join(output_dir, \"mlma_positive.csv\"))\n",
486
+ "mlma_no_abuse_df.to_csv(os.path.join(output_dir, \"mlma_negative.csv\"))"
487
+ ]
488
+ }
489
+ ],
490
+ "metadata": {
491
+ "kernelspec": {
492
+ "display_name": "Python 3 (ipykernel)",
493
+ "language": "python",
494
+ "name": "python3"
495
+ },
496
+ "language_info": {
497
+ "codemirror_mode": {
498
+ "name": "ipython",
499
+ "version": 3
500
+ },
501
+ "file_extension": ".py",
502
+ "mimetype": "text/x-python",
503
+ "name": "python",
504
+ "nbconvert_exporter": "python",
505
+ "pygments_lexer": "ipython3",
506
+ "version": "3.9.15"
507
+ }
508
+ },
509
+ "nbformat": 4,
510
+ "nbformat_minor": 5
511
+ }
notebooks/MultiCONAN.ipynb ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "0e1a6b29",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "import pandas as pd"
11
+ ]
12
+ },
13
+ {
14
+ "cell_type": "code",
15
+ "execution_count": 3,
16
+ "id": "e1144184",
17
+ "metadata": {},
18
+ "outputs": [],
19
+ "source": [
20
+ "url = \"https://github.com/marcoguerini/CONAN/raw/master/Multitarget-CONAN/Multitarget-CONAN.csv\"\n",
21
+ "\n",
22
+ "df = pd.read_csv(url, index_col=[0])"
23
+ ]
24
+ },
25
+ {
26
+ "cell_type": "code",
27
+ "execution_count": 4,
28
+ "id": "8ec0dfff",
29
+ "metadata": {},
30
+ "outputs": [
31
+ {
32
+ "data": {
33
+ "text/html": [
34
+ "<div>\n",
35
+ "<style scoped>\n",
36
+ " .dataframe tbody tr th:only-of-type {\n",
37
+ " vertical-align: middle;\n",
38
+ " }\n",
39
+ "\n",
40
+ " .dataframe tbody tr th {\n",
41
+ " vertical-align: top;\n",
42
+ " }\n",
43
+ "\n",
44
+ " .dataframe thead th {\n",
45
+ " text-align: right;\n",
46
+ " }\n",
47
+ "</style>\n",
48
+ "<table border=\"1\" class=\"dataframe\">\n",
49
+ " <thead>\n",
50
+ " <tr style=\"text-align: right;\">\n",
51
+ " <th></th>\n",
52
+ " <th>HATE_SPEECH</th>\n",
53
+ " <th>COUNTER_NARRATIVE</th>\n",
54
+ " <th>TARGET</th>\n",
55
+ " <th>VERSION</th>\n",
56
+ " </tr>\n",
57
+ " <tr>\n",
58
+ " <th>INDEX</th>\n",
59
+ " <th></th>\n",
60
+ " <th></th>\n",
61
+ " <th></th>\n",
62
+ " <th></th>\n",
63
+ " </tr>\n",
64
+ " </thead>\n",
65
+ " <tbody>\n",
66
+ " <tr>\n",
67
+ " <th>0</th>\n",
68
+ " <td>Maybe the UN could talk to those asian and afr...</td>\n",
69
+ " <td>You're right, ocean pollution is one of the ma...</td>\n",
70
+ " <td>other</td>\n",
71
+ " <td>V1</td>\n",
72
+ " </tr>\n",
73
+ " <tr>\n",
74
+ " <th>1</th>\n",
75
+ " <td>‘Juice (Jews) are worse that nukes.’ Caption t...</td>\n",
76
+ " <td>You'd rather be nuked then?</td>\n",
77
+ " <td>JEWS</td>\n",
78
+ " <td>V1</td>\n",
79
+ " </tr>\n",
80
+ " <tr>\n",
81
+ " <th>2</th>\n",
82
+ " <td>Foreigners on UK benefits leaps 41% in 5 years...</td>\n",
83
+ " <td>You seem to be worried about government expend...</td>\n",
84
+ " <td>MIGRANTS</td>\n",
85
+ " <td>V1</td>\n",
86
+ " </tr>\n",
87
+ " <tr>\n",
88
+ " <th>3</th>\n",
89
+ " <td>Jews cannot be patriots, since their allegianc...</td>\n",
90
+ " <td>You can have parents and grandparents born els...</td>\n",
91
+ " <td>JEWS</td>\n",
92
+ " <td>V1</td>\n",
93
+ " </tr>\n",
94
+ " <tr>\n",
95
+ " <th>4</th>\n",
96
+ " <td>Israel, Zionism and Jewish Supremacist control...</td>\n",
97
+ " <td>Wouldn't you say its colonialism from many dif...</td>\n",
98
+ " <td>JEWS</td>\n",
99
+ " <td>V1</td>\n",
100
+ " </tr>\n",
101
+ " <tr>\n",
102
+ " <th>...</th>\n",
103
+ " <td>...</td>\n",
104
+ " <td>...</td>\n",
105
+ " <td>...</td>\n",
106
+ " <td>...</td>\n",
107
+ " </tr>\n",
108
+ " <tr>\n",
109
+ " <th>4998</th>\n",
110
+ " <td>Woman are basically childlike.</td>\n",
111
+ " <td>They are not childlike and are capable of grea...</td>\n",
112
+ " <td>WOMEN</td>\n",
113
+ " <td>V6_mix</td>\n",
114
+ " </tr>\n",
115
+ " <tr>\n",
116
+ " <th>4999</th>\n",
117
+ " <td>women should be submissive to men.</td>\n",
118
+ " <td>There are many women who want to be \"submissiv...</td>\n",
119
+ " <td>WOMEN</td>\n",
120
+ " <td>V6_mix</td>\n",
121
+ " </tr>\n",
122
+ " <tr>\n",
123
+ " <th>5000</th>\n",
124
+ " <td>Women are essentially childlike, unable to und...</td>\n",
125
+ " <td>Maybe you should try talking to a woman instea...</td>\n",
126
+ " <td>WOMEN</td>\n",
127
+ " <td>V6_mix</td>\n",
128
+ " </tr>\n",
129
+ " <tr>\n",
130
+ " <th>5001</th>\n",
131
+ " <td>Women should be submissive to men.</td>\n",
132
+ " <td>Women are human beings deserving respect and e...</td>\n",
133
+ " <td>WOMEN</td>\n",
134
+ " <td>V6_mix</td>\n",
135
+ " </tr>\n",
136
+ " <tr>\n",
137
+ " <th>5002</th>\n",
138
+ " <td>Women should not be allowed to vote, this is a...</td>\n",
139
+ " <td>I don't think that a country can be 'male domi...</td>\n",
140
+ " <td>WOMEN</td>\n",
141
+ " <td>V6_mix</td>\n",
142
+ " </tr>\n",
143
+ " </tbody>\n",
144
+ "</table>\n",
145
+ "<p>5003 rows × 4 columns</p>\n",
146
+ "</div>"
147
+ ],
148
+ "text/plain": [
149
+ " HATE_SPEECH \\\n",
150
+ "INDEX \n",
151
+ "0 Maybe the UN could talk to those asian and afr... \n",
152
+ "1 ‘Juice (Jews) are worse that nukes.’ Caption t... \n",
153
+ "2 Foreigners on UK benefits leaps 41% in 5 years... \n",
154
+ "3 Jews cannot be patriots, since their allegianc... \n",
155
+ "4 Israel, Zionism and Jewish Supremacist control... \n",
156
+ "... ... \n",
157
+ "4998 Woman are basically childlike. \n",
158
+ "4999 women should be submissive to men. \n",
159
+ "5000 Women are essentially childlike, unable to und... \n",
160
+ "5001 Women should be submissive to men. \n",
161
+ "5002 Women should not be allowed to vote, this is a... \n",
162
+ "\n",
163
+ " COUNTER_NARRATIVE TARGET VERSION \n",
164
+ "INDEX \n",
165
+ "0 You're right, ocean pollution is one of the ma... other V1 \n",
166
+ "1 You'd rather be nuked then? JEWS V1 \n",
167
+ "2 You seem to be worried about government expend... MIGRANTS V1 \n",
168
+ "3 You can have parents and grandparents born els... JEWS V1 \n",
169
+ "4 Wouldn't you say its colonialism from many dif... JEWS V1 \n",
170
+ "... ... ... ... \n",
171
+ "4998 They are not childlike and are capable of grea... WOMEN V6_mix \n",
172
+ "4999 There are many women who want to be \"submissiv... WOMEN V6_mix \n",
173
+ "5000 Maybe you should try talking to a woman instea... WOMEN V6_mix \n",
174
+ "5001 Women are human beings deserving respect and e... WOMEN V6_mix \n",
175
+ "5002 I don't think that a country can be 'male domi... WOMEN V6_mix \n",
176
+ "\n",
177
+ "[5003 rows x 4 columns]"
178
+ ]
179
+ },
180
+ "execution_count": 4,
181
+ "metadata": {},
182
+ "output_type": "execute_result"
183
+ }
184
+ ],
185
+ "source": [
186
+ "df"
187
+ ]
188
+ }
189
+ ],
190
+ "metadata": {
191
+ "kernelspec": {
192
+ "display_name": "sexism_detection",
193
+ "language": "python",
194
+ "name": "sexism_detection"
195
+ },
196
+ "language_info": {
197
+ "codemirror_mode": {
198
+ "name": "ipython",
199
+ "version": 3
200
+ },
201
+ "file_extension": ".py",
202
+ "mimetype": "text/x-python",
203
+ "name": "python",
204
+ "nbconvert_exporter": "python",
205
+ "pygments_lexer": "ipython3",
206
+ "version": "3.9.15"
207
+ }
208
+ },
209
+ "nbformat": 4,
210
+ "nbformat_minor": 5
211
+ }
notebooks/UC-Berkeley Measuring Hate Speech dataset.ipynb ADDED
@@ -0,0 +1,551 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "3f943bb9",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "import pandas as pd\n",
11
+ "import os"
12
+ ]
13
+ },
14
+ {
15
+ "cell_type": "code",
16
+ "execution_count": 5,
17
+ "id": "e1997b1a",
18
+ "metadata": {},
19
+ "outputs": [
20
+ {
21
+ "data": {
22
+ "text/html": [
23
+ "<div>\n",
24
+ "<style scoped>\n",
25
+ " .dataframe tbody tr th:only-of-type {\n",
26
+ " vertical-align: middle;\n",
27
+ " }\n",
28
+ "\n",
29
+ " .dataframe tbody tr th {\n",
30
+ " vertical-align: top;\n",
31
+ " }\n",
32
+ "\n",
33
+ " .dataframe thead th {\n",
34
+ " text-align: right;\n",
35
+ " }\n",
36
+ "</style>\n",
37
+ "<table border=\"1\" class=\"dataframe\">\n",
38
+ " <thead>\n",
39
+ " <tr style=\"text-align: right;\">\n",
40
+ " <th></th>\n",
41
+ " <th>comment_id</th>\n",
42
+ " <th>annotator_id</th>\n",
43
+ " <th>platform</th>\n",
44
+ " <th>sentiment</th>\n",
45
+ " <th>respect</th>\n",
46
+ " <th>insult</th>\n",
47
+ " <th>humiliate</th>\n",
48
+ " <th>status</th>\n",
49
+ " <th>dehumanize</th>\n",
50
+ " <th>violence</th>\n",
51
+ " <th>...</th>\n",
52
+ " <th>annotator_religion_jewish</th>\n",
53
+ " <th>annotator_religion_mormon</th>\n",
54
+ " <th>annotator_religion_muslim</th>\n",
55
+ " <th>annotator_religion_nothing</th>\n",
56
+ " <th>annotator_religion_other</th>\n",
57
+ " <th>annotator_sexuality_bisexual</th>\n",
58
+ " <th>annotator_sexuality_gay</th>\n",
59
+ " <th>annotator_sexuality_straight</th>\n",
60
+ " <th>annotator_sexuality_other</th>\n",
61
+ " <th>translated</th>\n",
62
+ " </tr>\n",
63
+ " </thead>\n",
64
+ " <tbody>\n",
65
+ " <tr>\n",
66
+ " <th>0</th>\n",
67
+ " <td>47777</td>\n",
68
+ " <td>10873</td>\n",
69
+ " <td>3</td>\n",
70
+ " <td>0.0</td>\n",
71
+ " <td>0.0</td>\n",
72
+ " <td>0.0</td>\n",
73
+ " <td>0.0</td>\n",
74
+ " <td>2.0</td>\n",
75
+ " <td>0.0</td>\n",
76
+ " <td>0.0</td>\n",
77
+ " <td>...</td>\n",
78
+ " <td>False</td>\n",
79
+ " <td>False</td>\n",
80
+ " <td>False</td>\n",
81
+ " <td>False</td>\n",
82
+ " <td>False</td>\n",
83
+ " <td>False</td>\n",
84
+ " <td>False</td>\n",
85
+ " <td>True</td>\n",
86
+ " <td>False</td>\n",
87
+ " <td>Oui, en effet. Elle me rappelle en quelque sor...</td>\n",
88
+ " </tr>\n",
89
+ " <tr>\n",
90
+ " <th>1</th>\n",
91
+ " <td>39773</td>\n",
92
+ " <td>2790</td>\n",
93
+ " <td>2</td>\n",
94
+ " <td>0.0</td>\n",
95
+ " <td>0.0</td>\n",
96
+ " <td>0.0</td>\n",
97
+ " <td>0.0</td>\n",
98
+ " <td>2.0</td>\n",
99
+ " <td>0.0</td>\n",
100
+ " <td>0.0</td>\n",
101
+ " <td>...</td>\n",
102
+ " <td>False</td>\n",
103
+ " <td>False</td>\n",
104
+ " <td>False</td>\n",
105
+ " <td>False</td>\n",
106
+ " <td>False</td>\n",
107
+ " <td>False</td>\n",
108
+ " <td>False</td>\n",
109
+ " <td>True</td>\n",
110
+ " <td>False</td>\n",
111
+ " <td>La femme trans en train de lire ce message est...</td>\n",
112
+ " </tr>\n",
113
+ " <tr>\n",
114
+ " <th>2</th>\n",
115
+ " <td>47101</td>\n",
116
+ " <td>3379</td>\n",
117
+ " <td>3</td>\n",
118
+ " <td>4.0</td>\n",
119
+ " <td>4.0</td>\n",
120
+ " <td>4.0</td>\n",
121
+ " <td>4.0</td>\n",
122
+ " <td>4.0</td>\n",
123
+ " <td>4.0</td>\n",
124
+ " <td>0.0</td>\n",
125
+ " <td>...</td>\n",
126
+ " <td>False</td>\n",
127
+ " <td>False</td>\n",
128
+ " <td>False</td>\n",
129
+ " <td>True</td>\n",
130
+ " <td>False</td>\n",
131
+ " <td>False</td>\n",
132
+ " <td>False</td>\n",
133
+ " <td>True</td>\n",
134
+ " <td>False</td>\n",
135
+ " <td>Question &amp; #160;: ces 4 filles qui critiquent ...</td>\n",
136
+ " </tr>\n",
137
+ " <tr>\n",
138
+ " <th>3</th>\n",
139
+ " <td>43625</td>\n",
140
+ " <td>7365</td>\n",
141
+ " <td>3</td>\n",
142
+ " <td>2.0</td>\n",
143
+ " <td>3.0</td>\n",
144
+ " <td>2.0</td>\n",
145
+ " <td>1.0</td>\n",
146
+ " <td>2.0</td>\n",
147
+ " <td>0.0</td>\n",
148
+ " <td>0.0</td>\n",
149
+ " <td>...</td>\n",
150
+ " <td>False</td>\n",
151
+ " <td>False</td>\n",
152
+ " <td>False</td>\n",
153
+ " <td>False</td>\n",
154
+ " <td>False</td>\n",
155
+ " <td>False</td>\n",
156
+ " <td>False</td>\n",
157
+ " <td>True</td>\n",
158
+ " <td>False</td>\n",
159
+ " <td>Il est temps pour tous les illégaux de retourn...</td>\n",
160
+ " </tr>\n",
161
+ " <tr>\n",
162
+ " <th>4</th>\n",
163
+ " <td>12538</td>\n",
164
+ " <td>488</td>\n",
165
+ " <td>0</td>\n",
166
+ " <td>4.0</td>\n",
167
+ " <td>4.0</td>\n",
168
+ " <td>4.0</td>\n",
169
+ " <td>4.0</td>\n",
170
+ " <td>4.0</td>\n",
171
+ " <td>4.0</td>\n",
172
+ " <td>4.0</td>\n",
173
+ " <td>...</td>\n",
174
+ " <td>False</td>\n",
175
+ " <td>False</td>\n",
176
+ " <td>False</td>\n",
177
+ " <td>False</td>\n",
178
+ " <td>False</td>\n",
179
+ " <td>False</td>\n",
180
+ " <td>False</td>\n",
181
+ " <td>True</td>\n",
182
+ " <td>False</td>\n",
183
+ " <td>Pour commencer, repliez -vous sur celui en ros...</td>\n",
184
+ " </tr>\n",
185
+ " <tr>\n",
186
+ " <th>...</th>\n",
187
+ " <td>...</td>\n",
188
+ " <td>...</td>\n",
189
+ " <td>...</td>\n",
190
+ " <td>...</td>\n",
191
+ " <td>...</td>\n",
192
+ " <td>...</td>\n",
193
+ " <td>...</td>\n",
194
+ " <td>...</td>\n",
195
+ " <td>...</td>\n",
196
+ " <td>...</td>\n",
197
+ " <td>...</td>\n",
198
+ " <td>...</td>\n",
199
+ " <td>...</td>\n",
200
+ " <td>...</td>\n",
201
+ " <td>...</td>\n",
202
+ " <td>...</td>\n",
203
+ " <td>...</td>\n",
204
+ " <td>...</td>\n",
205
+ " <td>...</td>\n",
206
+ " <td>...</td>\n",
207
+ " <td>...</td>\n",
208
+ " </tr>\n",
209
+ " <tr>\n",
210
+ " <th>135551</th>\n",
211
+ " <td>37080</td>\n",
212
+ " <td>8590</td>\n",
213
+ " <td>2</td>\n",
214
+ " <td>1.0</td>\n",
215
+ " <td>1.0</td>\n",
216
+ " <td>0.0</td>\n",
217
+ " <td>0.0</td>\n",
218
+ " <td>2.0</td>\n",
219
+ " <td>0.0</td>\n",
220
+ " <td>0.0</td>\n",
221
+ " <td>...</td>\n",
222
+ " <td>False</td>\n",
223
+ " <td>False</td>\n",
224
+ " <td>False</td>\n",
225
+ " <td>False</td>\n",
226
+ " <td>False</td>\n",
227
+ " <td>False</td>\n",
228
+ " <td>False</td>\n",
229
+ " <td>True</td>\n",
230
+ " <td>False</td>\n",
231
+ " <td>équilibréealphilippines. nicolas. ternisien. t...</td>\n",
232
+ " </tr>\n",
233
+ " <tr>\n",
234
+ " <th>135552</th>\n",
235
+ " <td>22986</td>\n",
236
+ " <td>8303</td>\n",
237
+ " <td>2</td>\n",
238
+ " <td>2.0</td>\n",
239
+ " <td>0.0</td>\n",
240
+ " <td>0.0</td>\n",
241
+ " <td>0.0</td>\n",
242
+ " <td>2.0</td>\n",
243
+ " <td>0.0</td>\n",
244
+ " <td>0.0</td>\n",
245
+ " <td>...</td>\n",
246
+ " <td>False</td>\n",
247
+ " <td>False</td>\n",
248
+ " <td>False</td>\n",
249
+ " <td>False</td>\n",
250
+ " <td>True</td>\n",
251
+ " <td>True</td>\n",
252
+ " <td>False</td>\n",
253
+ " <td>False</td>\n",
254
+ " <td>False</td>\n",
255
+ " <td>Des millions de #Yémen-is ont participé à des ...</td>\n",
256
+ " </tr>\n",
257
+ " <tr>\n",
258
+ " <th>135553</th>\n",
259
+ " <td>21008</td>\n",
260
+ " <td>6207</td>\n",
261
+ " <td>2</td>\n",
262
+ " <td>1.0</td>\n",
263
+ " <td>1.0</td>\n",
264
+ " <td>1.0</td>\n",
265
+ " <td>1.0</td>\n",
266
+ " <td>1.0</td>\n",
267
+ " <td>0.0</td>\n",
268
+ " <td>0.0</td>\n",
269
+ " <td>...</td>\n",
270
+ " <td>False</td>\n",
271
+ " <td>False</td>\n",
272
+ " <td>False</td>\n",
273
+ " <td>False</td>\n",
274
+ " <td>False</td>\n",
275
+ " <td>False</td>\n",
276
+ " <td>False</td>\n",
277
+ " <td>True</td>\n",
278
+ " <td>False</td>\n",
279
+ " <td>@AbeShinzo @realDonaldTump @shinzoabe Ðţţţţţţţ...</td>\n",
280
+ " </tr>\n",
281
+ " <tr>\n",
282
+ " <th>135554</th>\n",
283
+ " <td>22986</td>\n",
284
+ " <td>7886</td>\n",
285
+ " <td>2</td>\n",
286
+ " <td>2.0</td>\n",
287
+ " <td>0.0</td>\n",
288
+ " <td>0.0</td>\n",
289
+ " <td>0.0</td>\n",
290
+ " <td>2.0</td>\n",
291
+ " <td>0.0</td>\n",
292
+ " <td>0.0</td>\n",
293
+ " <td>...</td>\n",
294
+ " <td>False</td>\n",
295
+ " <td>False</td>\n",
296
+ " <td>False</td>\n",
297
+ " <td>True</td>\n",
298
+ " <td>False</td>\n",
299
+ " <td>False</td>\n",
300
+ " <td>False</td>\n",
301
+ " <td>True</td>\n",
302
+ " <td>False</td>\n",
303
+ " <td>Des millions de #Yémen-is ont participé à des ...</td>\n",
304
+ " </tr>\n",
305
+ " <tr>\n",
306
+ " <th>135555</th>\n",
307
+ " <td>14785</td>\n",
308
+ " <td>6897</td>\n",
309
+ " <td>0</td>\n",
310
+ " <td>4.0</td>\n",
311
+ " <td>4.0</td>\n",
312
+ " <td>4.0</td>\n",
313
+ " <td>2.0</td>\n",
314
+ " <td>2.0</td>\n",
315
+ " <td>2.0</td>\n",
316
+ " <td>3.0</td>\n",
317
+ " <td>...</td>\n",
318
+ " <td>False</td>\n",
319
+ " <td>False</td>\n",
320
+ " <td>False</td>\n",
321
+ " <td>False</td>\n",
322
+ " <td>False</td>\n",
323
+ " <td>False</td>\n",
324
+ " <td>False</td>\n",
325
+ " <td>True</td>\n",
326
+ " <td>False</td>\n",
327
+ " <td>OCTROR DECIDENTIBILITÉ OCTRORIPERIPERIPERISERI...</td>\n",
328
+ " </tr>\n",
329
+ " </tbody>\n",
330
+ "</table>\n",
331
+ "<p>135388 rows × 132 columns</p>\n",
332
+ "</div>"
333
+ ],
334
+ "text/plain": [
335
+ " comment_id annotator_id platform sentiment respect insult \\\n",
336
+ "0 47777 10873 3 0.0 0.0 0.0 \n",
337
+ "1 39773 2790 2 0.0 0.0 0.0 \n",
338
+ "2 47101 3379 3 4.0 4.0 4.0 \n",
339
+ "3 43625 7365 3 2.0 3.0 2.0 \n",
340
+ "4 12538 488 0 4.0 4.0 4.0 \n",
341
+ "... ... ... ... ... ... ... \n",
342
+ "135551 37080 8590 2 1.0 1.0 0.0 \n",
343
+ "135552 22986 8303 2 2.0 0.0 0.0 \n",
344
+ "135553 21008 6207 2 1.0 1.0 1.0 \n",
345
+ "135554 22986 7886 2 2.0 0.0 0.0 \n",
346
+ "135555 14785 6897 0 4.0 4.0 4.0 \n",
347
+ "\n",
348
+ " humiliate status dehumanize violence ... \\\n",
349
+ "0 0.0 2.0 0.0 0.0 ... \n",
350
+ "1 0.0 2.0 0.0 0.0 ... \n",
351
+ "2 4.0 4.0 4.0 0.0 ... \n",
352
+ "3 1.0 2.0 0.0 0.0 ... \n",
353
+ "4 4.0 4.0 4.0 4.0 ... \n",
354
+ "... ... ... ... ... ... \n",
355
+ "135551 0.0 2.0 0.0 0.0 ... \n",
356
+ "135552 0.0 2.0 0.0 0.0 ... \n",
357
+ "135553 1.0 1.0 0.0 0.0 ... \n",
358
+ "135554 0.0 2.0 0.0 0.0 ... \n",
359
+ "135555 2.0 2.0 2.0 3.0 ... \n",
360
+ "\n",
361
+ " annotator_religion_jewish annotator_religion_mormon \\\n",
362
+ "0 False False \n",
363
+ "1 False False \n",
364
+ "2 False False \n",
365
+ "3 False False \n",
366
+ "4 False False \n",
367
+ "... ... ... \n",
368
+ "135551 False False \n",
369
+ "135552 False False \n",
370
+ "135553 False False \n",
371
+ "135554 False False \n",
372
+ "135555 False False \n",
373
+ "\n",
374
+ " annotator_religion_muslim annotator_religion_nothing \\\n",
375
+ "0 False False \n",
376
+ "1 False False \n",
377
+ "2 False True \n",
378
+ "3 False False \n",
379
+ "4 False False \n",
380
+ "... ... ... \n",
381
+ "135551 False False \n",
382
+ "135552 False False \n",
383
+ "135553 False False \n",
384
+ "135554 False True \n",
385
+ "135555 False False \n",
386
+ "\n",
387
+ " annotator_religion_other annotator_sexuality_bisexual \\\n",
388
+ "0 False False \n",
389
+ "1 False False \n",
390
+ "2 False False \n",
391
+ "3 False False \n",
392
+ "4 False False \n",
393
+ "... ... ... \n",
394
+ "135551 False False \n",
395
+ "135552 True True \n",
396
+ "135553 False False \n",
397
+ "135554 False False \n",
398
+ "135555 False False \n",
399
+ "\n",
400
+ " annotator_sexuality_gay annotator_sexuality_straight \\\n",
401
+ "0 False True \n",
402
+ "1 False True \n",
403
+ "2 False True \n",
404
+ "3 False True \n",
405
+ "4 False True \n",
406
+ "... ... ... \n",
407
+ "135551 False True \n",
408
+ "135552 False False \n",
409
+ "135553 False True \n",
410
+ "135554 False True \n",
411
+ "135555 False True \n",
412
+ "\n",
413
+ " annotator_sexuality_other \\\n",
414
+ "0 False \n",
415
+ "1 False \n",
416
+ "2 False \n",
417
+ "3 False \n",
418
+ "4 False \n",
419
+ "... ... \n",
420
+ "135551 False \n",
421
+ "135552 False \n",
422
+ "135553 False \n",
423
+ "135554 False \n",
424
+ "135555 False \n",
425
+ "\n",
426
+ " translated \n",
427
+ "0 Oui, en effet. Elle me rappelle en quelque sor... \n",
428
+ "1 La femme trans en train de lire ce message est... \n",
429
+ "2 Question & #160;: ces 4 filles qui critiquent ... \n",
430
+ "3 Il est temps pour tous les illégaux de retourn... \n",
431
+ "4 Pour commencer, repliez -vous sur celui en ros... \n",
432
+ "... ... \n",
433
+ "135551 équilibréealphilippines. nicolas. ternisien. t... \n",
434
+ "135552 Des millions de #Yémen-is ont participé à des ... \n",
435
+ "135553 @AbeShinzo @realDonaldTump @shinzoabe Ðţţţţţţţ... \n",
436
+ "135554 Des millions de #Yémen-is ont participé à des ... \n",
437
+ "135555 OCTROR DECIDENTIBILITÉ OCTRORIPERIPERIPERISERI... \n",
438
+ "\n",
439
+ "[135388 rows x 132 columns]"
440
+ ]
441
+ },
442
+ "execution_count": 5,
443
+ "metadata": {},
444
+ "output_type": "execute_result"
445
+ }
446
+ ],
447
+ "source": [
448
+ "dataset_path = \"../../data/translated/en/ucberkeley-dlab_measuring-hate-speech_translated_positive_en_translated.csv\"\n",
449
+ "\n",
450
+ "df = pd.read_csv(dataset_path, index_col=[0])\n",
451
+ "df"
452
+ ]
453
+ },
454
+ {
455
+ "cell_type": "code",
456
+ "execution_count": 6,
457
+ "id": "272a8a64",
458
+ "metadata": {},
459
+ "outputs": [
460
+ {
461
+ "name": "stdout",
462
+ "output_type": "stream",
463
+ "text": [
464
+ "Worst : 14206\n",
465
+ "Best : 14206\n"
466
+ ]
467
+ },
468
+ {
469
+ "name": "stderr",
470
+ "output_type": "stream",
471
+ "text": [
472
+ "/tmp/ipykernel_18064/1870029499.py:38: SettingWithCopyWarning: \n",
473
+ "A value is trying to be set on a copy of a slice from a DataFrame.\n",
474
+ "Try using .loc[row_indexer,col_indexer] = value instead\n",
475
+ "\n",
476
+ "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
477
+ " worst_df[\"label\"] = 1\n"
478
+ ]
479
+ }
480
+ ],
481
+ "source": [
482
+ "# Preprocessing\n",
483
+ "import os\n",
484
+ "import re\n",
485
+ "\n",
486
+ "def clean_text(text):\n",
487
+ " \n",
488
+ " patterns = [\"(\", \")\", \"Name\", \"URL\", \"NAME\", \"probably does not need a translation\", \"(optional\", \"optional,\"]\n",
489
+ " out = text\n",
490
+ " for p in patterns:\n",
491
+ " out = out.replace(p, \"\")\n",
492
+ " \n",
493
+ " #out = \"\".join([x for x in out if x.isascii() or x == \" \"])\n",
494
+ " \n",
495
+ " out = re.sub(\"#[0-9]\", \"\", out)\n",
496
+ " out = re.sub(r\"& 60;\", \"\", out)\n",
497
+ " out = out.replace(\"#\", \"\") # supression des hashtag après erreur de decoding\n",
498
+ " out = out.replace(\"@\", \"\")\n",
499
+ " \n",
500
+ " return out\n",
501
+ "\n",
502
+ "OUTPUT_DIR = \"../data/processed/\"\n",
503
+ "if not os.path.exists(OUTPUT_DIR):\n",
504
+ " os.makedirs(OUTPUT_DIR)\n",
505
+ "\n",
506
+ "worst_threshold = 0.9\n",
507
+ "best_threshold = 0.1\n",
508
+ "\n",
509
+ "avg_score = pd.DataFrame(df.groupby(\"translated\").hate_speech_score.mean())\n",
510
+ "avg_score = avg_score.sort_values(\"hate_speech_score\", ascending=False).reset_index()\n",
511
+ "avg_score[\"translated_clean\"] = avg_score.translated.apply(clean_text)\n",
512
+ "\n",
513
+ "worst_df = avg_score.loc[avg_score.hate_speech_score > 0]\n",
514
+ "n_worst = worst_df.shape[0]\n",
515
+ "\n",
516
+ "best_df = avg_score.loc[avg_score.hate_speech_score < 0]\n",
517
+ "best_df = best_df.iloc[:n_worst] # keep balancing\n",
518
+ "\n",
519
+ "worst_df[\"label\"] = 1\n",
520
+ "best_df[\"label\"] = 0\n",
521
+ "\n",
522
+ "print(\"Worst :\", worst_df.shape[0])\n",
523
+ "print(\"Best :\", best_df.shape[0])\n",
524
+ "\n",
525
+ "worst_df.to_csv(os.path.join(OUTPUT_DIR, \"uc-berkeley-measuring-hate-speech-positive-translated.csv\"))\n",
526
+ "best_df.to_csv(os.path.join(OUTPUT_DIR, \"uc-berkeley-measuring-hate-speech-negative-translated.csv\"))"
527
+ ]
528
+ }
529
+ ],
530
+ "metadata": {
531
+ "kernelspec": {
532
+ "display_name": "sexism_detection",
533
+ "language": "python",
534
+ "name": "sexism_detection"
535
+ },
536
+ "language_info": {
537
+ "codemirror_mode": {
538
+ "name": "ipython",
539
+ "version": 3
540
+ },
541
+ "file_extension": ".py",
542
+ "mimetype": "text/x-python",
543
+ "name": "python",
544
+ "nbconvert_exporter": "python",
545
+ "pygments_lexer": "ipython3",
546
+ "version": "3.9.15"
547
+ }
548
+ },
549
+ "nbformat": 4,
550
+ "nbformat_minor": 5
551
+ }
notebooks/utils.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ import string
2
+
3
+ chars = string.ascii_letters + string.punctuation + string.whitespace
4
+ chars = chars + "éèê"
5
+
6
+ url_pattern = r"(http|https)\S*"
7
+ user_naming_pattern = r"@\S*"