In this repository you will find the code for the Master's Thesis: "Community-based Abuse Detection: Using Distantly Supervised Data and Biased Word Embeddings".
The goal of this thesis is to find out whether data coming from abusive communities and other non-abusive communities can be used for the detection of abusive language. The community-based data are collected from hateful communities and 'normal' subreddits on Reddit. With this data, we create distant datasets and generate task-specific polerized embeddings which are used to train abuse detection models. These models are tested both on an in-domain test set created in this research and on existing cross-domain test sets. This study confirms that data coming from abusive and non-abusive communities can be used for the detection of abusive language. The results indicate that models learn to classify abuse from silver distant training data (even though they still get outperformed by smaller gold training data). Furthermore, models that use pre-trained biased abusive embeddings generated from this data are showing competitive results when compared against much larger pre-trained generic embeddings.
Data Statement (Bender and Friedman, 2018)
Data in the Gold Reddit test set has been collected from the medium Reddit and the language of the messages is English. The annotation of the explicit, implicit and non-abusive labels have been conducted by a group of first-year Information Science Bachelor students and the author of this paper. The annotators group consisted of 31 men and 10 women. Out of this group 21 students have previous experience with annotating documents and 19 students did not have any previous experience. The average age is 21.025 years and ranges between the ages of 18 and 42. All annotators have the Dutch nationality.
All ages refer to the time of annotation: April 2020.
Description of the repository.
Required Python packages necessary for running the program.
Folder that contains code to create and extract annotated data by annotators.
Folder that contains outputfiles of student annotations.
Creates annotation data for groups of students with common and individual messages.
Extracts test comments from Reddit archive files.
Combines all annotations and calculates fleiss kappa within groups of annotators, writes final labels to output.
Folder that contains code to extract non-abusive messages from Reddit archive files.
Code to extract non-abusive messages from Reddit archive files.
Lexicon used to filter explicit messages from abusive communities.
List of abusive communities.
Folder that contains training and test data for the project.
Folder that contains training data.
Folder that contains the distant training data with 25-25-50 and 33-33-33 distributions of labels.
Folder that contains the gold training data files: AbusEval and OffensEval2019.
Folder that contains all test data for the experiments.
Filters and creates distant training data sets and distant test sets.
Folder that contains LSTM and SVM folders.
Folder that contains code for building the Bi-LSTM models.
Builds a Bi-LSTM model.
Folder that contains code for building the SVM models.
Contains code for SVM models and cross_validation experiments.
Folder that contains file for preprocessing and fastText input generation.
File that cleans the reddit data and generates inputfiles necessary for the creation of fastText embeddings.
Folder that contains extra data checks and analysis
Folder that contains text files that list which subreddits are used in which dataset.
File that checks the integrety and completeness of the datafiles
File that gathers statistics about the abusive data
File that gathers statistics about the non-abusive data
Folder that contains the code for the creation and inspection of abusive and non-abusive word embeddings with fastText
Code that creates the abusive and non-abusive embeddings with fastText
Code that inspects the nearest neighbors of generated embeddings
$ python3 modelSVM.py <classification_type>-<exp_number>-<input_type>-<embeddings_source>-<distribution>-<batch_size>-<gold_data>
$ python3 modelSVM.py multiclass-1-tfidf-fasttext-252550-24000-NA
$ python3 modelLSTM.py <classification_type>-<exp_number>-<embeddings_source>-<distribution>-<batch_size>-<gold_data>
$ python3 modelLSTM.py binary-1-fasttext-333333-48000-NA
$ python3 modelSVM.py <classification_type>-<exp_number>-<input_type>-<embeddings_source>-<distribution>-<batch_size>-<gold_data>
$ python3 modelSVM.py multiclass-2-embeddings-fasttext-NA-NA-offenseval2019
$ python3 modelLSTM.py <classification_type>-<exp_number>-<embeddings_source>-NA-NA-<gold_data>
$ python3 modelLSTM.py multiclass-2-glove-NA-NA-abuseval
$ python3 modelSVM.py <classification_type>-<exp_number>-<input_type>-<embeddings_source>-<distribution>-<batch_size>-<gold_data>
$ python3 modelSVM.py binary-3-embeddings-glove-NA-NA-abuseval
$ python3 modelLSTM.py <classification_type>-<exp_number>-<embeddings_source>-<distribution>-<batch_size>-<gold_data>
$ python3 modelLSTM.py multiclass-3-fasttext-333333-12000-offenseval2019