Leveraging attention-based deep learning models for detecting insult offenses on social media in the context of Turkish Penal Law
摘要
One of the most common forms of hate speech encountered on social media is insult. Insults that constitute a criminal offense are regulated by Articles 125 to 131 of the Turkish Penal Law (TPL), subjecting offenders to legal sanctions. Not every insulting comment constitutes a legally defined insult under the TPL; therefore, it is challenging to distinguish between comments that actually amount to a legally defined insult and those that do not. In this study, an insult-containing dataset (TPL-Insult) has been presented to identify comments on social media that qualify as insults under the TPL. The dataset was obtained from numerous comments sent to the Instagram accounts of a popular women’s program broadcast on weekdays in Turkey throughout 2024 and contains 3652 comments classified as insults and 3709 comments classified as non-insults based on manual labeling. The classification performance of twenty-one models (attention-based Deep Learning (DL) and Classical Machine Learning (CML) models) for detecting Turkish insult comments that constitute a crime has been evaluated using various performance metrics to determine the most successful classification model. The proposed pre-trained BERT embeddings with an attention-based CNN model demonstrated significantly higher performance (macro-averaged F1 0.93) compared to other attention-based DL models and CML methods, effectively classifying Turkish insult comments. The resulting Turkish TPL-I dataset will provide a valuable resource for other researchers in Turkish natural language processing studies, and the proposed model will lead the development of Turkish insult‑detection filters on social media. To our knowledge, this study is the first to detect legally defined insult messages in Turkish.