{ "cells": [ { "cell_type": "code", "execution_count": 2, "id": "23a02d5a", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
acl.idX1textlabeltypetargetlevelsplitround.baseannotatorroundacl.id.matched
1acl11dalits are lowliveshatenotgivennotgivenoriginaltrain1GNZuCtwed31NaN
2acl102gay people are a burden to our societyhatenotgivennotgivenoriginaltrain1GNZuCtwed31NaN
3acl1003Arabs are not welcomehatenotgivennotgivenoriginaltrain1vDe7GN0NrL1NaN
4acl10004I'm not saying we should actually eliminate he...hatenotgivennotgivenoriginaltrain1oemYWm1Tjg1NaN
5acl100005bananas are for black peoplehatenotgivennotgivenoriginaltest1QiOKkCi7F81NaN
.......................................
117100acl997441228Indian culture is so backwardshatenotgivennotgivenoriginaltest1GNZuCtwed31NaN
118100acl115741752Women don't want equality, they just want to b...hatederogationwomoriginaltrain2CAgNlUizNm2aacl11575
119100acl134463832fuck covidnothatenonenoneoriginaltrain2CAgNlUizNm2aacl13447
1205acl134573844This computer is garbagenothatenonenoneoriginaltrain2eLGzdD8Tvb2aacl13458
121100acl3209524553The only good Muslim is a dead onehatethreateningmusoriginaltrain4IBsVsBliwX4aacl32096
\n", "

41144 rows × 12 columns

\n", "
" ], "text/plain": [ " acl.id X1 text \\\n", "1 acl1 1 dalits are lowlives \n", "2 acl10 2 gay people are a burden to our society \n", "3 acl100 3 Arabs are not welcome \n", "4 acl1000 4 I'm not saying we should actually eliminate he... \n", "5 acl10000 5 bananas are for black people \n", "... ... ... ... \n", "117100 acl9974 41228 Indian culture is so backwards \n", "118100 acl11574 1752 Women don't want equality, they just want to b... \n", "119100 acl13446 3832 fuck covid \n", "1205 acl13457 3844 This computer is garbage \n", "121100 acl32095 24553 The only good Muslim is a dead one \n", "\n", " label type target level split round.base \\\n", "1 hate notgiven notgiven original train 1 \n", "2 hate notgiven notgiven original train 1 \n", "3 hate notgiven notgiven original train 1 \n", "4 hate notgiven notgiven original train 1 \n", "5 hate notgiven notgiven original test 1 \n", "... ... ... ... ... ... ... \n", "117100 hate notgiven notgiven original test 1 \n", "118100 hate derogation wom original train 2 \n", "119100 nothate none none original train 2 \n", "1205 nothate none none original train 2 \n", "121100 hate threatening mus original train 4 \n", "\n", " annotator round acl.id.matched \n", "1 GNZuCtwed3 1 NaN \n", "2 GNZuCtwed3 1 NaN \n", "3 vDe7GN0NrL 1 NaN \n", "4 oemYWm1Tjg 1 NaN \n", "5 QiOKkCi7F8 1 NaN \n", "... ... ... ... \n", "117100 GNZuCtwed3 1 NaN \n", "118100 CAgNlUizNm 2a acl11575 \n", "119100 CAgNlUizNm 2a acl13447 \n", "1205 eLGzdD8Tvb 2a acl13458 \n", "121100 IBsVsBliwX 4a acl32096 \n", "\n", "[41144 rows x 12 columns]" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import pandas as pd\n", "\n", "url = \"https://github.com/bvidgen/Dynamically-Generated-Hate-Speech-Dataset/raw/main/Dynamically%20Generated%20Hate%20Dataset%20v0.2.3.csv\"\n", "df = pd.read_csv(url, index_col=[0])\n", "df" ] }, { "cell_type": "code", "execution_count": 8, "id": "da71ad26", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
texttypelabel
36829women are just thotsnotgivenhate
26232They will if they keep coming to voat. The thi...derogationhate
133I don't have a problem with lesbians, but I do...notgivenhate
5145muslims grow abroad and should stay therederogationhate
34928This country is a lot worse now, there are too...notgivenhate
11884There are not enough fucking racists these day...derogationhate
33797Mike Pence had to swear in Kyrsten Sinema, the...derogationhate
39112The disabled should be sterilizednotgivenhate
10691No blacks welcome at my partynotgivenhate
20979Get rid of the gaysnotgivenhate
36957disabled people are not bad, they're just infe...notgivenhate
7328Is anyone else getting really bored? I heard s...derogationhate
8007i love making chicks angryanimosityhate
3806I have no money and there are no fucking jobs,...animosityhate
7175Im DONE! This is over, ropeheads dont belong a...derogationhate
5725Dear baby boomers, think twice before you pass...notgivenhate
24537These attacks will only end when Whites stand ...derogationhate
1300Can you smell these dirty muzzies? It's a brut...derogationhate
35023No matter how much they tell us the opposite, ...notgivenhate
16933Oy vey, da poysakyewshun! It's anudda shoah. I...derogationhate
\n", "
" ], "text/plain": [ " text type label\n", "36829 women are just thots notgiven hate\n", "26232 They will if they keep coming to voat. The thi... derogation hate\n", "133 I don't have a problem with lesbians, but I do... notgiven hate\n", "5145 muslims grow abroad and should stay there derogation hate\n", "34928 This country is a lot worse now, there are too... notgiven hate\n", "11884 There are not enough fucking racists these day... derogation hate\n", "33797 Mike Pence had to swear in Kyrsten Sinema, the... derogation hate\n", "39112 The disabled should be sterilized notgiven hate\n", "10691 No blacks welcome at my party notgiven hate\n", "20979 Get rid of the gays notgiven hate\n", "36957 disabled people are not bad, they're just infe... notgiven hate\n", "7328 Is anyone else getting really bored? I heard s... derogation hate\n", "8007 i love making chicks angry animosity hate\n", "3806 I have no money and there are no fucking jobs,... animosity hate\n", "7175 Im DONE! This is over, ropeheads dont belong a... derogation hate\n", "5725 Dear baby boomers, think twice before you pass... notgiven hate\n", "24537 These attacks will only end when Whites stand ... derogation hate\n", "1300 Can you smell these dirty muzzies? It's a brut... derogation hate\n", "35023 No matter how much they tell us the opposite, ... notgiven hate\n", "16933 Oy vey, da poysakyewshun! It's anudda shoah. I... derogation hate" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.loc[df.type != \"none\"].sample(20)[[\"text\", \"type\", \"label\"]]" ] }, { "cell_type": "code", "execution_count": 10, "id": "a195bff3", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "none 18969\n", "derogation 9907\n", "notgiven 7110\n", "animosity 3439\n", "dehumanization 906\n", "threatening 606\n", "support 207\n", "Name: type, dtype: int64" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.type.value_counts()" ] }, { "cell_type": "code", "execution_count": 23, "id": "897a1bd5", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array(['Who here wants to bet that she is JEWISH FUNDED?',\n", " \"Believe me! Not all black men slatternly - I've met a few that were actually clean\",\n", " \"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", " \"I believe using the name jungle japping japs doesn't function as a slur, don't you agree?\",\n", " '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", " \"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", " '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", " \"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", " '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", " '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", " dtype=object)" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.loc[df.type == \"animosity\"].sample(10).text.values" ] }, { "cell_type": "code", "execution_count": 20, "id": "b4e7c439", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
acl.idX1textlabeltypetargetlevelsplitround.baseannotatorroundacl.id.matched
1437acl112901437people who think hermies should be eliminated ...hatethreateninggenderminoriginaltrain2TrRF46JWfP2aacl20647
1443acl112961443anyone want to join me in sorting out the tran...hatethreateninggenderminoriginaltrain2TrRF46JWfP2aacl20390
1465acl113151465I don't agree with scapegoating but you have t...hatethreateninggenderminoriginaltrain2TrRF46JWfP2aacl11316
1469acl113191469I wish someone would just exterminate those he...hatethreateninggenderminoriginaltrain2TrRF46JWfP2aacl11320
1495acl113421495Traaaans should be wiped offhatethreateningtransoriginaltrain2TrRF46JWfP2aacl11343
.......................................
34490acl4103834490I proudly beat gays in the gay wars of 2007hatethreateninggayperturbationdev4IBsVsBliwX4bacl37574
34495acl4104234495Covid vaccine? It's 100% sure that it's made b...hatethreateningbla, jeworiginaldev4iO6vHa6qJm4aacl31366
34554acl4109634554I hope her Daddy'll beat H.E.R., until her fac...hatethreateningwomperturbationdev4iO6vHa6qJm4bacl34774
34556acl4109834556yo, what heppen to the idea of lynching that n...hatethreateningblaperturbationdev4iO6vHa6qJm4bacl41004
121100acl3209524553The only good Muslim is a dead onehatethreateningmusoriginaltrain4IBsVsBliwX4aacl32096
\n", "

606 rows × 12 columns

\n", "
" ], "text/plain": [ " acl.id X1 text \\\n", "1437 acl11290 1437 people who think hermies should be eliminated ... \n", "1443 acl11296 1443 anyone want to join me in sorting out the tran... \n", "1465 acl11315 1465 I don't agree with scapegoating but you have t... \n", "1469 acl11319 1469 I wish someone would just exterminate those he... \n", "1495 acl11342 1495 Traaaans should be wiped off \n", "... ... ... ... \n", "34490 acl41038 34490 I proudly beat gays in the gay wars of 2007 \n", "34495 acl41042 34495 Covid vaccine? It's 100% sure that it's made b... \n", "34554 acl41096 34554 I hope her Daddy'll beat H.E.R., until her fac... \n", "34556 acl41098 34556 yo, what heppen to the idea of lynching that n... \n", "121100 acl32095 24553 The only good Muslim is a dead one \n", "\n", " label type target level split round.base \\\n", "1437 hate threatening gendermin original train 2 \n", "1443 hate threatening gendermin original train 2 \n", "1465 hate threatening gendermin original train 2 \n", "1469 hate threatening gendermin original train 2 \n", "1495 hate threatening trans original train 2 \n", "... ... ... ... ... ... ... \n", "34490 hate threatening gay perturbation dev 4 \n", "34495 hate threatening bla, jew original dev 4 \n", "34554 hate threatening wom perturbation dev 4 \n", "34556 hate threatening bla perturbation dev 4 \n", "121100 hate threatening mus original train 4 \n", "\n", " annotator round acl.id.matched \n", "1437 TrRF46JWfP 2a acl20647 \n", "1443 TrRF46JWfP 2a acl20390 \n", "1465 TrRF46JWfP 2a acl11316 \n", "1469 TrRF46JWfP 2a acl11320 \n", "1495 TrRF46JWfP 2a acl11343 \n", "... ... ... ... \n", "34490 IBsVsBliwX 4b acl37574 \n", "34495 iO6vHa6qJm 4a acl31366 \n", "34554 iO6vHa6qJm 4b acl34774 \n", "34556 iO6vHa6qJm 4b acl41004 \n", "121100 IBsVsBliwX 4a acl32096 \n", "\n", "[606 rows x 12 columns]" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "targets = [\"threatening\"]\n", "clean_df = df.loc[df.type.isin(targets)][[\"text\", \"label\"]]\n", "clean_df.label = 1\n", "clean_df.to_csv(\"../../data/processed/Dynamically-Generated-Hate-Speech-Dataset_p.csv\")" ] } ], "metadata": { "kernelspec": { "display_name": "sexism_detection", "language": "python", "name": "sexism_detection" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.15" } }, "nbformat": 4, "nbformat_minor": 5 }