Skip to Content
  • Article
  • Open Access

25 November 2024

24 Pages

Investigating Offensive Language Detection in a Low-Resource Setting with a Robustness Perspective

,
,
,
,
and
School of Science and Engineering, Al Akhawayn University, Ifrane 53000, Morocco
*
Author to whom correspondence should be addressed.

Abstract

Moroccan Darija, a dialect of Arabic, presents unique challenges for natural language processing due to its lack of standardized orthographies, frequent code switching, and status as a low-resource language. In this work, we focus on detecting offensive language in Darija, addressing these complexities. We present three key contributions that advance the field. First, we introduce a human-labeled dataset of Darija text collected from social media platforms. Second, we explore and fine-tune various language models on the created dataset. This investigation identifies a Darija RoBERTa-based model as the most effective approach, with an accuracy of 90% and F1 score of 85%. Third, we evaluate the best model beyond accuracy by assessing properties such as correctness, robustness and fairness using metamorphic testing and adversarial attacks. The results highlight potential vulnerabilities in the model’s robustness, with the model being susceptible to attacks such as inserting dots (29.4% success rate), inserting spaces (24.5%), and modifying characters in words (18.3%). Fairness assessments show that while the model is generally fair, it still exhibits bias in specific cases, with a 7% success rate for attacks targeting entities typically subject to discrimination. The key finding is that relying solely on offline metrics such as the F1 score and accuracy in evaluating machine learning systems is insufficient. For low-resource languages, the recommendation is to focus on identifying and addressing domain-specific biases and enhancing pre-trained monolingual language models with diverse and noisier data to improve their robustness and generalization capabilities in diverse linguistic scenarios.

1. Introduction

Natural language processing (NLP) and machine learning (ML) research can play an important role in moderating content by automatically identifying hate speech and offensive language on social network platforms. This, in turn, facilitates the implementation of robust automatic content moderation strategies. Social media platforms make use of artificial intelligence (AI), including various ML classifiers such as random forests and naive Bayesian networks, to detect and remove offensive and demeaning language [1]. However, unlike languages equipped with abundant linguistic resources, constructing robust models capable of accurately classifying offensive from non-offensive text in the Moroccan Arabic dialect called Darija (MD) poses a challenge due to the scarcity of linguistic assets, primarily labeled datasets. This challenge is further amplified by the distinctive nature of Darija, which is a low-resource language that is also mostly spoken-only, informal and code-switched. In this context, Darija incorporates lexical elements from diverse languages, including Berber, French, and Spanish, while its grammatical structure lacks standardization and writing rules [2].
In MD, linguistics and sociolinguistics reflect the unique blend of languages and cultures in Morocco. Morocco has a long history of being a place where various cultures have interacted and coexisted together, due to its location at the intersection of Africa, Europe, and the Islamic world [3]. As a result, Darija includes a significant number of loanwords from Berber, French, and Spanish, which affect its lexicon and phonetic structure. These borrowed elements can alter the perception and identification of offensive language. Understanding these phonological and morphological features is crucial for developing accurate detection algorithms.
Written Darija does not have an official version and is not taught in any formal educational programs. The syntax of Darija often deviates from Modern Standard Arabic (MSA), with variations in sentence structure and verb conjugation [4]. MD often allows more flexible word order compared to the more rigid structure of MSA. MD also differs from MSA in its use of affixes and suffixes for verb conjugation. In Darija, tense markers are often prefixes like “kan-” for present tense and “-t” for past tense, compared to the more complex system in MSA, which uses distinct prefixes and suffixes for each pronoun. For instance, the verb “to write” in MSA would be “kataba” (he wrote) and “yaktubu” (he writes), while in Darija it becomes “ktb” (he wrote) and “ka-yktb” (he writes). Darija also tends to drop case endings and uses shorter, more colloquial forms than MSA. The method of negation in Darija involves different sentence structure and suffixes. In the example “ana ma fhamtch” (I do not understand), MD uses (ma) and the suffix (-tch) to indicate negation in the past tense, reflecting a different structure and suffixation.
The use of Latin script (Arabizi or Franco-Arabic) is common online for writing Darija due to the accessibility of Latin keyboards and the convenience of typing in informal settings. Numerals are used to represent specific Arabic sounds, such as “3” for “ع” (ayn) and “7” for “ح” (ḥā). Meanwhile, Arabic script remains prevalent in more formal or traditional online contexts, highlighting the dual nature of script use in Morocco. However, there are no standard writing rules for MD.
Sociolinguistically, MD is a language spoken by nearly 37 million Moroccans. MD represents more than just a language; it acts as a cultural identifier, especially in urban areas. In contrast, Berber and French dominate rural and formal sectors. Diglossia is prominent, with Moroccans switching between Darija for informal settings and MSA or French in formal and educational contexts. Darija varies significantly across different regions of Morocco, with distinct local dialects and slang [5]. These regional variations affect how offensive language is used and perceived. The usage of offensive language in Darija can be influenced by social factors such as age, gender, and social status. For instance, what might be considered offensive in one social group may not be perceived the same way in another.
Detecting offensive language is a significant challenge. It goes beyond simply identifying bad words; it requires understanding the context, grasping linguistic nuances, recognizing sentiment and tone, and detecting irony, as well as implicit offensive language. Moreover, the annotated data might suffer from bias because of the personal views of the annotators, as determining what is considered offensive can vary based on cultural and social norms.
In a typical machine learning process, held-out accuracy has traditionally been the primary method for assessing generalization. However, it often overestimates the performance of NLP models because the holdout test set typically shares the same biases as the training data. Hence, there is a need for an alternative for testing the generalization capabilities of the model when confronted with different linguistic data. Moreover, in production systems, the changing behavior of online users over time might cause a data distribution shift, causing a drop in the performance of the ML models. Hence, offensive language detection models should be tested thoroughly to check if they work as intended. Testing ML models can be more complex than testing traditional software [6]. First, there is the issue of data dependency problem, because the results of the models can vary based on the input data and the specific circumstances of its usage [7]. Secondly, the black-box nature inherent to ML models makes it difficult to understand or explain their internal workings. This complexity impedes the identification of the root cause of model weaknesses and hinders the development of the right tests to expose them [8]. Moreover, ML models will usually have their performance degrade over time; they can become stale if they are not part of a continual learning pipeline that is able to adapt to new data distributions, making it difficult to evaluate their long-term reliability. Finally, the issue of limited test coverage is challenging as it is impractical to test a machine learning model on all possible input data [9].
Moreover, unlike languages characterized by the abundance of resources, such as English or German, it is difficult to generate testing data for low resource languages because of the limited availability of tools, such as Part-Of-Speech (POS) taggers, word vectors or embeddings, and Named Entities Recognition (NER) models.
MD is the most spoken dialect in Morocco, and its use in social media is continually increasing. According to Kepios analysis, the number of social media users is increasing and was estimated in 2022 to 63.4% of the total population. Therefore, the regulation of social media content in this low-resource language is a pressing matter and no language should be left behind. In response to these challenges, our work aims to directly address the deficiency of research for processing Darija. The aim of this work is to fill the gap within the literature and address the lack of research in Darija NLP. We present three key contributions that advance this under-explored area. First, we introduce a human-labeled dataset, we fine-tune various language models on the created dataset, and we test the best model by assessing its correctness, robustness and fairness in a black-box manner by using metamorphic testing (MT) and adversarial data. In the context of ML-based systems, correctness represents the ability of a system to produce correct results when provided with valid inputs [10]. Robustness describes the model’s capacity to make correct predictions when provided with unexpected or abnormal inputs [11]. Fairness, on the other hand, represents the ability to make unbiased predictions, without discrimination, based on sensitive attributes such as race, gender, religion, or age [12].
The rest of this article is organized as follows. Section 2 reviews state-of-the art research in the field of offensive language detection and machine learning testing, with a special focus on testing NLP models. Section 3 presents relevant materials and methods and delves into the details of the dataset, the ML models and the testing experiments, providing insights on the process of completing this work. Section 4 discusses and analyzes the results of the research. Finally, in Section 5, we outline some conclusions and directions for future work.

3. Materials and Methods

In this section, we present the Darija offensive dataset collection and preparation, and describe the deep learning model architectures and experiments. This also includes the testing process of the offensive language detection model, adversarial data generation, and the definition of metamorphic relations. The workflow is made of several steps, as shown in Figure 1. In the data collection phase, we gather Moroccan Darija text from different online platforms. In the data annotation phase, we curate and label the collected data for offensive language detection. The next step is about model selection and fine-tuning, where we experiment with various language models, including three Darija-specific language model variants and different types of classifiers. Then, we generate adversarial examples using famous NLP attacks to test the victim model against potential attacks. We also designed metamorphic rules to stipulate how outputs should change in response to specific, systematic changes in the input. We evaluate the model using the adversarial attack success rate metric. Finally, we perform a manual error analysis to understand what makes our model vulnerable and we make recommendations for further refinement and improvement.
Figure 1. Machine learning workflow with metamorphic testing using adversarial data.

3.1. Darija Offensive Language Dataset Collection and Preprocessing

The curated dataset comprises 20,402 Moroccan Darija sentences sourced from diverse outlets, annotated as offensive or inoffensive. The dataset structure consists of two columns: one housing the sentence itself and the other indicating the corresponding label, as elucidated in Table 1. Specifically, the dataset comprises 7717 sentences marked as offensive and 12,685 sentences categorized as non-offensive, resulting in a distribution where 37.8% of sentences are deemed offensive, while the remaining 62.2% are not.
Table 1. Dataset specifications.
Understanding the distribution of sentence lengths plays a crucial role in choosing the right techniques and algorithms to use. Sentence lengths range from 1 to 150 words, with frequencies representing how many sentences share the same word count, ranging from 1 to 1707 occurrences. A depiction of the sentence length distribution, provided in Figure 2, reveals a right-skewed pattern characterized by a longer tail on the right-hand side. The distribution’s median sentence length is nine words, while its mode stands at four words. Notably, the calculation of the interquartile range (IQR) for the lower 5th percentile and upper 95th percentile within the sentence length distribution discloses that approximately 90% of sentence lengths fall within the range between 2 and 34.
Figure 2. Distribution of sentence lengths in the dataset.
Short sentences of four words are very common since social media content is the predominant form of content within the dataset. Social media encourages brevity in writing, so comments on these platforms tend to take on a more informal ’reaction’- or ’response’-type formats as opposed to full sentence constructions. Such sentences do not normally need much expansion. It is also worth remarking that this dataset contains a lot of insults and expressions of frustration. In sentences like these, a lot can often be said with very few words.
Moroccan online users seamlessly switch between the Latin and Arabic scripts to express their thoughts. This linguistic phenomenon is faithfully reflected in our dataset, which encapsulates a blend of sentences in both scripts. Arabic-script sentences predominate with a percentage of 74% (14,978 sentences), while 25% of the sentences (5170 sentences) are presented in the Latin script. Additionally, a subset of 1% of the sentences (254 sentences) showcases a combination of both scripts.
The initial step involved gathering data, with sentences being sourced from two primary platforms: Twitter and YouTube. Twitter, being a globally used platform, served as a valuable source of textual content in the form of tweets. We employed the Twitter API and retrieved data by using a set of commonly used Moroccan Darija words. These words served as filters to define the scope of the tweets to be collected. Among the utilized keywords were terms like “chkoun” (who), “kifach” (how), “sir” (go), etc. Once the initial batch of tweets was obtained, we leveraged the originating accounts to acquire further tweets from the same accounts. This approach was based on the assumption that accounts that tweeted at least once in Moroccan Darija are more likely to produce additional content in the same language.
In parallel, the project’s scope encompassed the extraction of comments from 40 renowned Moroccan channels, most notably “ChoufTV”. These channels boasted a substantial volume of comments in Darija. Given that YouTube employs JavaScript rendering, our methodology involved employing Selenium, which operates by simulating user actions, such as scrolling and clicking, enabling the retrieval of data despite the platform’s intricate rendering mechanism. Table 2 presents a list of data samples, their English translations, and corresponding labels.
Table 2. Sample dataset sentences with English translations and labels.
The data preprocessing phase involved several key steps. We used lowercasing to ensure consistency in letter casing. We replaced emojis with their textual descriptions to extract semantic information such as emotions or symbols. We utilized the Arabic Emojipedia repository (https://github.com/a-ibrahimi/Arabic-Emojipedia (accessed on 4 January 2024)) for this purpose. A set of special characters that do not contribute to the sentence’s meaning was removed. Notable examples of these removed characters are punctuation marks and characters such as the asterisk ‘*’, hyphen ‘-’, and ampersand ‘@’. We also handled elongated characters, which are commonly used in social media. For instance, users may use “salaaam” instead of “salam” (hello in Moroccan Darija). As no specialized tools were available for detecting Moroccan Darija words with elongated characters, we opted for a straightforward approach: identifying words containing more than two consecutive instances of the same character and replacing them with just two instances of that character. Finally, we normalize Arabic text. This step takes care of bringing Arabic text to a unified form by removing diacritics from all letters, and by removing elongations.
In order to annotate the data in a consistent way, we established a list of traits and guidelines that make a sentence offensive, which can be summarized as follows: (i) vulgar language, such as the use of swear words, profanities and inappropriate references to private parts or sexual acts; (ii) name calling, such as the use of abusive names to belittle or humiliate another person; (iii) hate speech, such as attacking religious beliefs and the use of homophobic and racist language; and (iv) derogatory language, such as the use of pejorative terms relating to illness or disabilities, besides sexism, evil wishes, direct threats and family insults.
The labeling process involved the collaboration of two human annotators who followed the predefined guidelines to determine whether a sentence was offensive or not. The selected annotators are native speakers who demonstrated expertise in the sentiment analysis task. Training sessions were then held in the forms of meetings to align on and agree on the guidelines to be followed. The inter-annotator agreement rate for this study was 88.79%. For the data samples that resulted in conflicting labels, a third annotator, who went through the same pre-screening and training process as the first annotators, was consulted for resolution.
Despite the important resources invested in collecting, preprocessing, and labeling the dataset, we still encountered a handful of limitations. Namely, there was a lack of diversity in types of comments, including offensive text, due to the fact that only two sources were used for data collection: Twitter and YouTube. Indeed, the comments and tweets retrieved only represent a subset of Moroccan online users, encompassing relatively biased content. This limitation also relates to the nature of the data sources used. The prevalence of short sentences in social media content, which is clearly manifested in the dataset shown in Figure 2, limits contextual depth. Moreover, only about 37% of the sentences are labeled as offensive, meaning that the dataset suffers from class imbalance. Having a balanced dataset proves crucial for several classification techniques and algorithms. Therefore, it is necessary to address class imbalance to improve model performance and ensure accurate classification results.

3.2. Deep Learning Models for Offensive Language Detection

We fine-tuned five language models on the offensive language detection task. We used two Arabic language models, namely MARBERT and ARBERT [60], besides three Darija language models, including DarijaBERT [61] and two other compact models, DarELECTRA and DarRoBERTa [62]. We opted for experimenting with three different classifier models: CNNs, LSTMs and a combined CNN-LSTM architecture. In all experiments, we generated the pooled embedding vector from the sequence embedding vectors using a dense layer with a tanh activation function.
The CNN architecture we opted for consists of a one-dimensional convolution layer with L1 regularization used for feature extraction, followed by a max pooling layer for feature condensation, and a dropout layer with a 0.1 dropout rate. Next, we flatten the feature map, and we use a dense layer with L2 regularization, followed by the output layer using a sigmoid activation function that classifies the comments as offensive or not offensive.
For the second experiment, the transformers’ pooled output was fed to an LSTM layer with 128 hidden units and L1 regularization. A dropout layer with a 0.1 dropout rate was then applied, followed by a dense layer with L2 regularization, and finally the output layer for classification.
The third experiment consists of a combination of a CNN and LSTM that was proven to be effective for a variety of tasks. This combination allows CNN’s filters to extract n-gram features that are passed to the LSTM layer to discover feature dependencies. As a result, word-level features are extracted first by the CNN, and sentence-level features are highlighted by the LSTM. Our model consists of a one-dimensional convolution layer with L1 regularization, followed by a max pooling layer for feature condensation, and a dropout layer with a 0.1 dropout rate. The output is flattened and then passed to a LSTM layer with 128 hidden units and L1 regularization, followed by a dropout layer with 0.2 dropout rate. Finally, we use a dense layer with L2 regularization followed by the output layer for classification.
When the different classes are not present in the training data in equal proportions, the more samples of a class we have, the more that class will determine gradient updates. To overcome the unbalanced data issue, we use class weighting, i.e., while computing the total loss, a weighted sum is performed instead of a regular sum, in which each sample’s loss is weighted according to its class. Each class is assigned a weight that is inversely proportional to its frequency in training data. This results in samples from less frequent classes having a larger contribution to total loss and thus to gradient updates. The model is therefore protected from over-generating labels in the majority class. Accordingly, the weight of the offensive class was set to 1.321, while the weight of the non-offensive class was set to 0.8042. In our work, the offensive class has a higher weight since we have fewer offensive labels than non-offensive ones.

3.3. Model Testing Beyond Accuracy

In this work, we draw inspiration from software engineering testing to evaluate the best performing offensive language detection model from previous experiments in terms of correctness, robustness and fairness. This is carried out by applying metamorphic testing in a black-box setting and combining character-level and word-level modifications.
In order to generate test cases to challenge the model with, we proceed in two main steps. First, we identify the most important words in a sentence to be modified using the algorithm in Figure 3. Then, we change the identified tokens in the sentence and re-test the model with the new inputs. The goal of this step is to identify the two most important words, based on their ability to significantly reduce the model’s confidence or change its prediction completely [35,63]. Only two words are selected for perturbation to generate adversarial data, as making more alterations could render the sentence incomprehensible [40,47]. First, the importance of each word is determined by calculating a combination of its head score and tail score. The head score is calculated by subtracting the model’s prediction score for the sentence up until the word, from the model’s prediction score for the same sentence without the word. The tail score is calculated similarly: by subtracting the model’s prediction score for the sentence starting with the word and continuing to the end, from the model’s prediction score for the same sentence without the word. The head and tail scores are important in determining the importance of each word in a sentence because they provide a measure of how much impact removing that word has on the overall meaning of the sentence. The head score represents the contribution of the word to the beginning of the sentence, while the tail score represents the contribution of the word to the end of the sentence. The head and tail scores may yield negative values when we subtract the predictions, so they are converted to positive values. The combined score, obtained by adding the head and the tail scores, serves as a metric to determine the importance of each word. The word exhibiting the highest combined score is deemed the most important one, as it induces the most significant change. This stems from the fact that this score is the summation of the absolute values of the head and tail scores, reflecting the extent to which the word’s presence affects the overall meaning of the sentence.
Figure 3. Algorithm for finding important words in a sentence.
The main idea of the second step is to provide specified and personalized metamorphic rules (MRs) that not only describe the perturbations performed on the source data but also the results against which we evaluate the output of our test data [64]. In this work, we define eight MRs to test the three properties of the model. These MRs take into consideration the usual real-world errors that can be made by humans while typing, as well as purposeful attacks performed against the model. The assumption from the designed MRs for the model to be considered error-free is that its predictions should remain invariant under any type of induced perturbation.
To assess the correctness of the system, we test if it performs well when provided with correct clean data. The modifications that were made preserve the correctness and meaning of the original sentences. The different MRs that were developed for testing correctness are described in Table 3.
Table 3. Metamorphic rules for testing the model’s correctness.
To test the robustness of the model, we provide it with slightly altered data, introducing modifications that make the sentences incorrect but still understandable for humans. The model should see through these alterations and comprehend the sentences. To ensure effective adversarial data generation while preserving semantic similarity, we considered several controls. We specifically limit the number of edits, such as changing a letter in a word or substituting it with synonyms, to a maximum of two. This approach ensures that the meaning of the sentence is not drastically altered while still introducing sufficient perturbations to confuse the target model. If more than two words are modified, the meaning of the sentence might drift, and inaccuracies in the test results may arise due to inevitable errors by the model. In situations where we swap or change only one letter, we perturb two words. However, for more significant perturbations such as replacing a word with “unknown”, we only modify a single word to avoid changing the meaning of the sentence. Moreover, the generated adversarial examples are constrained within generic semantic spaces, such as typo spaces and contextualized semantic spaces using the embedding space. By leveraging these spaces, the adversarial texts remain semantically close to the original inputs, helping to preserve meaning while testing the model’s robustness. Due to the lack of robust semantic similarity models for Darija that could automate the process, we assess the readability and semantic preservation of the adversarial texts through a manual evaluation. An annotator manually reviewed modified sentences to determine if the texts remained intelligible and similar in meaning to the original ones. The different MRs that were developed for testing the model’s robustness are described in Table 4.
Table 4. Metamorphic rules for testing the model’s robustness.
When it comes to fairness, the objective is to evaluate if the model performs well when the attributes of the sentences are changed to sensitive ones that are usually subject to bias and discrimination such as ethnicity, religion nationality, and gender. We use the same function as in the correctness test to change the named entities, except we replace them with sensitive names this time. The MRs that were developed for testing the model’s fairness are described in Table 5.
Table 5. Metamorphic rules for testing the model’s fairness.
To produce adversarial data, we perturbed the original test set. For each attack, the adversarial dataset contains 4086 instances, except for modifications that involve a single character perturbation. In those cases, we combined the transformations equally to create a test set of 4086 instances. This test set includes the following attacks: deleting one letter, inserting one letter, swapping two letters, and replacing one letter with another one. For attacks that involve substituting similar words or altering named entities, we generated test sets with only 1000 instances from the original test set for each type. This choice stems from the requirement that comments must include named entities and must be in Arabic script. In terms of labeling, the ground truth of the adversarial datasets against which the model’s predictions are evaluated is the same as in the original test set.

4. Results and Discussion

To evaluate the model’s performance on the test data, we used accuracy (acc), precision (prec), recall (rec), the F1 score, and the success rate. In this research, we used NVIDIA Tesla T4 Graphics Processing Units (GPUs) provided by Google Colab Pro platform.

4.1. Deep Learning Models for Offensive Language Detection

For the offensive language detection task, we used a split of 85% for training and 15% for validation. As can be seen in Table 6, DarRoBERTA performed slightly better than the other pre-trained models, achieving an accuracy of 90% and an F1 score of 85%. Even though MARBERT and ARBERT were trained on less MD instances than the other MD models, they achieved high scores, which confirms the findings in the literature, i.e., using a diversified dataset composed of formal and informal text in Arabic and its dialects for pre-training or fine-tuning BERT can improve the effectiveness of Arabic text classification. We also noticed that the ARBERT-based model achieved the highest recall (89%), indicating its ability to capture the highest proportion of correctly predicted offensive content, i.e., the true positives out of all actual offensive instances. The highest precision was achieved by the ELECTRA-based Darija language model (89%), indicating its ability to minimize false positives when flagging comments as offensive.
Table 6. Offensive language detection results. Bold values indicate the best results.
It should be noted that although performances of the different pre-trained Darija models are similar, DarELECTRA (55 m parameters) and DarRoBERTa (80 m parameters) are much compacter than DarijaBERT, which is a BERT-based model (110 m parameters).
While accuracy was the highest score in all experiments, the F1 score was not as high. This indicates that all of the models were good at classifying one label but not the other. A manual error analysis shows that this phenomenon could be explained by a number of factors: (i) an inability of the models to detect sarcasm and irony in offensive tweets, (ii) the use of a negative word to express a positive meaning, and (iii) the use of some words that are inappropriate in some regions but accepted in others.
In the task of offensive language detection, recent benchmarks highlight the advanced performances of LLMs like GPT-3.5, Mistral, and Flan-T5 [65]. In terms of robustness, the findings from [65] revealed that while all three models demonstrated reliable performance across languages, their results varied depending on language structure and dataset composition. Mistral and GPT-3.5 showed strong adaptability across languages, with Mistral particularly excelling in English and Spanish. However, GPT-3.5’s superior handling of German offensive language detection suggests its robustness in languages with more complex grammatical structures. The findings also indicated that GPT-3.5’s content moderation safeguards sometimes interfered with straightforward predictions, potentially affecting its output consistency in sensitive contexts. Flan-T5, with fewer parameters, remained effective in English but was less robust in non-English settings, showing reduced precision and recall. Overall, while Mistral and GPT-3.5 exhibit higher robustness in multilingual tasks, the distinct moderation policies and smaller model capacity of Flan-T5 limit its adaptability outside of English contexts. The best results for the three languages under monolingual and multilingual settings are shown in Table 7.
Table 7. Overview of top performance results from [65] across monolingual and multilingual settings in English, Spanish, and German.
In comparison to the results obtained using Mistral and GPT-3.5, our RoBERTa-based model achieved competitive performance, particularly in precision, despite its relatively compact size. The comparison to results from [65] opens up an avenue for future work to enhance our results by exploring techniques such as fine-tuning on multilingual datasets.

4.2. Testing the Properties of the Best-Performing Model

We selected the best-performing model, DarRoBERTa LM combined with a CNN-LSTM classifier, as the victim model. We evaluated the failure of the model by using the adversarial success rate. The metric is defined as the percentage of the adversarial examples that were successful in making the victim model change its classification from one class to another, compared to the predictions on the original test set. Each attack has its own success rate, as defined by (1).
Success rate = Number of successful attacks Total attacks
The results of the experiments indicate that the attacks succeeded in deceiving the model, with some perturbations being more successful than others. If we consider the results of correction testing, as shown by Table 8, we can observe a decrease in performance against specific adversarial attacks. Despite a slight maximum reduction of 2% in the F1 score, the results highlight potential vulnerabilities in the model’s correctness and generalization capabilities. The 7.9% success rate for inserting filler words suggests that the model is sensitive to extraneous information, showing a vulnerability in handling irrelevant or noisy data. The offensive language detection model was trained mainly on clean data and seems to struggle when confronted with noisier data. The 4% success rate for replacing named entities indicates a moderate vulnerability in the model’s understanding of the contextual importance of specific entities. This suggests that, while the model can often maintain performance despite these changes, it shows weaknesses in comprehending some of the named entities and their significance in identifying offensive content. The 1.1% success rate for replacing words with similar ones might indicate a low effectiveness of this approach in altering the model’s predictions, likely due to the robustness of transformer LLMs, which use byte-based tokenizers, making them less sensitive to word-level changes.
Table 8. Correctness testing results.
The results of robustness testing are shown in Table 9. The model’s vulnerability to minor perturbations such as inserting a dot or space between letters, or modifying one letter in a word, resulted in success rates ranging from 17.9% to 29.4%. This character-level model vulnerability, which seems to be a common problem in most NLP systems, shows that the model relies primarily on exact words. On the other hand, the 16.1% success rate for deleting spaces between words indicates that the model’s ability to parse and understand word boundaries correctly is moderately affected. Repeating vowels resulted in a 13.4% success rate, suggesting that the model might struggle with informal or colloquial language patterns, such as vowel repetition, possibly exacerbated by preprocessing steps aimed at data normalization. The 10.6% success rate for replacing a word with “unknown” suggests that BERT’s contextual understanding and attention mechanisms can mitigate the impact of replacing words with the “unknown” token. This resilience could be due to its ability to infer missing information from the surrounding context. Attacks involving changing punctuation or numbers had low success rates, ranging from 0.42% to 6.1%. However, the absence of failure in this case may be skewed by a lack of training data diversity in these aspects. A manual inspection of the original training data revealed that it did not include much punctuation or numerical information, leading the model to rely less on these features.
Table 9. Robustness testing results.
Overall, the robustness success rates are not negligible. This could be explained by the fact that these attacks target the most important words as determined by the important tokens algorithm, which seems to frequently select offensive words when present. Modifying these words can cause the sentence to lose its offensive meaning, leading the model to make errors in its predictions. This performance drop is particularly exhibited by an increase in the false negative rate, which is reflected by a large drop in recall that reaches 15% in certain test cases. We also noticed a significant decrease in precision when the model encountered words with inserted dots, with false positives rising sharply as precision dropped by 28%. This drop in precision may be attributed to the language model learning a pattern that associates the presence of dots with the intent to obscure offensive text. On social media, users often employ dots as a tactic to bypass content moderation systems, leading the model to interpret any text with dots as potentially offensive. This pattern recognition can result in an increased likelihood of false positives, as the model may misidentify unoffensive language containing dots as offensive. This limitation underscores the need for improved learning to differentiate between normal uses of dots and intentional obfuscation of harmful language.
To test the fairness of the model, the attacks focused on replacing named entities with sensitive names. The model is clearly affected by bias to a certain extent. The specific biases detected during our testing include nationality-related bias and gender bias. For instance, the model was more likely to classify sentences as offensive when a male name was replaced with a female name, leading to an increase in offensive classifications. Similarly, the predictions made by the model completely changed when the nationalities were replaced with sensitive names, especially considering that most of the countries and nationalities were substituted with those that have political conflicts with the country from where the dataset was generated. These patterns reflect how the model may inadvertently associate certain demographic or cultural groups with negative sentiments. The results displayed in Table 10 show a 7% success rate, which reflects the reliance of the model on specific named entities, instead of building an understanding of named entities and their impact on whether a comment is offensive or not.
Table 10. Fairness testing results.
Examples of adversarial data along with their classifications are shown in Table 11. Overall, the results indicate that there are some types of attacks concerning robustness and fairness, which highlight specific vulnerabilities in the model’s handling of input perturbations. Despite these vulnerabilities, it is noteworthy that the results align with baseline findings, falling within the expected ranges of failure reported on state-of-the-art models, including production systems.
Table 11. Examples of misclassifications with adversarial data.
The interplay between biased training data and model architecture limitations significantly affects adversarial robustness in offensive language detection. The dataset, drawn exclusively from Twitter and YouTube, introduces bias by offering a limited representation of Moroccan online users. This bias can undermine the effectiveness of adversarial attacks, as the generated adversarial examples may fail to reflect the linguistic diversity and context found across different platforms. Consequently, this limitation could restrict the success of attacks in effectively targeting the offensive language model. The lack of diversity in the original data means that the adversarial testing might not reveal all the vulnerabilities of the model. Adversarial data might be biased towards the specific characteristics of the original dataset, leading to an incomplete assessment of the model’s robustness. If adversarial testing is primarily conducted with examples similar to those in the original dataset, the model might overfit to these specific adversarial patterns. This can lead to a situation where the model is optimized to handle only a narrow set of adversarial examples, rather than being robust to a wide range of adversarial attacks. Moreover, the prevalence of short sentences in our data limits the contextual depth of the data. Adversarial examples created from such limited contexts may struggle to fully exploit the model’s weaknesses, as the lack of nuances could reduce the chances of successful manipulations. The low success rate of attacks that rely on word-level transformations highlights the fact that transformer tokenizers, like Byte Pair Encoding (BPE) or WordPiece, decompose words into subword units. This decomposition reduces the vulnerability of models to adversarial attacks that attempt to manipulate specific words, whether by substituting them with synonyms or by introducing misspellings. As a result, the effectiveness of such attacks is diminished, highlighting the need for more sophisticated methods to generate quality adversarial data.

5. Conclusions and Future Work

In this work, we present a contribution towards building an offensive language detection system in Moroccan Darija. We introduce a human-labeled dataset comprising a collection of Darija sentences collected from social media platforms. This study addresses the scarcity of labeled datasets for Darija and provides a resource for researchers focusing on natural language processing that are interested in Darija, particularly offensive language and sentiment analysis tasks.
We also fine-tuned several BERT-based models on the offensive language detection task. Interestingly, the smaller Darija-specific language models achieved the best results. Using compact models will have an impact on online metrics when the ML model is deployed, such as on the latency, requests per second, and resource utilization.
We tested the best model using adversarial data to evaluate correctness, robustness, and fairness. The results demonstrate that the attacks were able to deceive the model and reveal its vulnerabilities. Although adversarial attacks designed to test correctness had relatively low success rates, the model showed vulnerabilities in robustness and fairness that were not revealed with standard evaluations. The testing pinpointed the specific characteristics of data that led to incorrect predictions and discerned the areas of vulnerabilities at the levels of words or characters.
Low-resource languages face several fundamental challenges, such as the scarcity of large, labeled datasets; the variability across dialects; and the lack of foundational linguistic tools like Part-of-Speech taggers and Named Entity Recognition systems. In the case of Moroccan Darija, these challenges are compounded by the diglossic nature of the language, where the standard Arabic used in official contexts differs significantly from the spoken dialects. As a result, models trained on standard Arabic often perform poorly when applied to regional dialects. In recent years, research on low-resource languages has gained momentum, leveraging techniques like transfer learning and multilingual models (e.g., mBERT and XLM-R), which can transfer knowledge from high-resource languages. However, such approaches often suffer from generalization issues due to insufficient fine-tuning on the specific dialects or sub-languages. This gap is particularly evident in NLP tasks, such as offensive language detection, where model performance is crucial for social media moderation and public safety but remains under-developed for languages like MD. The contribution of this study lays the groundwork for addressing the broader need for dialect-specific solutions that account for linguistic and cultural variations in low-resource languages. Moreover, the techniques used here are transferable to other Arabic dialects and could be beneficial for multidialectical Arabic efforts, where models that generalize across dialects are needed. This can help bridge the gap in NLP for Arabic as a whole, supporting efforts in dialect-specific research while contributing to a shared framework.
The limitations of this work stem from the inherent complexity of NLP systems and the testing methodologies used. While metamorphic testing and adversarial attacks were effective in uncovering certain vulnerabilities related to robustness and fairness, other bugs may still remain undetected. This is due to the challenges of crafting comprehensive adversarial examples that can explore the full input space, particularly for languages with rich morphology and syntax, like Arabic. Moreover, the tested adversarial cases may not cover all real-world variations or contexts in offensive language, leaving some edge cases and system weaknesses unexamined. Additionally, relying solely on adversarial testing may not expose all latent issues in the data and models, especially biases that emerge in unexpected usage scenarios. This limitation stems from the lack of variability in our dataset, which does not necessarily cover the full spectrum of regional or linguistic nuances, potentially leaving the model vulnerable to performance gaps in real-world applications.
In light of the limited body of NLP research on Moroccan Darija, it is also crucial to outline strategic directions for advancing this field. First, there is a need for the development of comprehensive, annotated datasets specific to Darija to facilitate more robust training and evaluation of NLP models. Second, research into models that can effectively handle variations across different Arabic dialects is essential for advancing NLP applications in Arabic-speaking countries. Finally, there is a need to focus on methods for effective code-switching and adaptations, as switches between languages reflect authentic language use in many social contexts.
A future direction of this work is to improve the offensive language detection model’s resilience against adversarial attacks by exploring different types of defense methods, such as using adversarial training, which entails training the model on a combination of original and adversarial data. We will also experiment on newer LLMs and investigate multilingual offensive language detection.

Author Contributions

Conceptualization, A.M.; methodology, A.M., A.I., I.A., M.A. and M.A.E.B.; validation, A.I., I.A., M.A.E.B. and S.D.; formal analysis, A.I., I.A., M.A., M.A.E.B. and S.D.; investigation, A.I., I.A., M.A., M.A.E.B. and S.D.; resources, A.M.; data curation, A.I., M.A.E.B. and M.A.; writing—original draft preparation, A.I., I.A., M.A.E.B. and A.M.; writing—review and editing, A.I. and A.M.; visualization, A.I., I.A. and M.A.E.B.; supervision, A.M.; project administration, A.M.; funding acquisition, A.M. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by Al Akhawayn University’s seed money grant under contract number 92567.

Data Availability Statement

The original data presented in the study are openly available at https://data.mendeley.com/datasets/2y4m97b7dc/3 (accessed on 29 July 2024).

Conflicts of Interest

The authors declare no conflicts of interest. The funders had no role in the design of this study; in the collection, analyses, or interpretation of data; in the writing of the manuscript; or in the decision to publish the results.

Declaration of Generative AI and AI-Assisted Technologies in the Writing Process:

During the preparation of this work, the authors used the paraphrasing tool Quillbot and ChatGPT in order to improve readability. After using these tools, the authors reviewed and edited the content as needed and take responsibility for the publication’s content.

References

  1. Muneer, A.; Fati, S.M. A Comparative Analysis of Machine Learning Techniques for Cyberbullying Detection on Twitter. Future Internet 2020, 12, 187. [Google Scholar] [CrossRef] [Scilit]
  2. Aghzal, M.; Mourhir, A. Distributional Word Representations for Code-mixed Text in Moroccan Darija. Procedia Comput. Sci. 2021, 189, 266–273. [Google Scholar] [CrossRef] [Scilit]
  3. Sedrati, A.; Ait Ali, A. Moroccan Darija in Online Creation Communities: Example of Wikipedia. Al-Andal. Maghreb 2019, 26, 1–14. [Google Scholar] [CrossRef] [Scilit]
  4. Morocco, P.C. Moroccan Darija Textbook. 2011. Available online: https://friendsofmorocco.org/Docs/Darija/Moroccan%20Arabic%20textbook%202011.pdf (accessed on 7 September 2024).
  5. El-Hairan, Z. Darija, the Evolution of Oral Arabic in Morocco. 2011. Available online: https://www.academia.edu/8123140/Darija_the_evolution_of_Oral_Arabic_in_Morocco (accessed on 9 November 2024).
  6. Braiek, H.B.; Khomh, F. On Testing Machine Learning Programs. J. Syst. Softw. 2020, 164, 110542. [Google Scholar] [CrossRef] [Scilit]
  7. Ackerman, S.; Farchi, E.; Raz, O.; Zalmanovici, M.; Dube, P. Detection of Data Drift and Outliers Affecting Machine Learning Model Performance Over Time. arXiv 2020, arXiv:2012.09258. [Google Scholar]
  8. Brożek, B.; Furman, M.; Jakubiec, M.; Kucharzyk, B. The Black Box Problem Revisited. Real and Imaginary Challenges for Automated Legal Decision Making. Artif. Intell. Law 2024, 32, 427–440. [Google Scholar] [CrossRef] [Scilit]
  9. Asudeh, A.; Shahbazi, N.; Jin, Z.; Jagadish, H. Identifying Insufficient Data Coverage for Ordinal Continuous-Valued Attributes. In Proceedings of the 2021 International Conference on Management of Data, Virtual, 20–25 June 2021; pp. 129–141. [Google Scholar]
  10. Aggarwal, A.; Shaikh, S.; Hans, S.; Haldar, S.; Ananthanarayanan, R.; Saha, D. Testing Framework for Black-box AI Models. In Proceedings of the 2021 IEEE/ACM 43rd International Conference on Software Engineering: Companion Proceedings (ICSE-Companion), Madrid, Spain, 25–28 May 2021; pp. 81–84. [Google Scholar]
  11. Liang, B.; Li, H.; Su, M.; Bian, P.; Shi, X.L.; Wang, W. Deep Text Classification Can Be Fooled. In Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence (IJCAI-18), Stockholm, Sweden, 13–19 July 2018; pp. 4208–4215. [Google Scholar]
  12. Prabhakaran, V.; Hutchinson, B.; Mitchell, M. Perturbation Sensitivity Analysis to Detect Unintended Model Biases. arXiv 2019, arXiv:1910.04210. [Google Scholar]
  13. Akhter, M.P.; Jiangbin, Z.; Naqvi, I.R.; AbdelMajeed, M.; Zia, T. Abusive Language Detection from Social Media Comments Using Conventional Machine Learning and Deep Learning Approaches. Multimed. Syst. 2022, 28, 1925–1940. [Google Scholar] [CrossRef] [Scilit]
  14. Hajibabaee, P.; Malekzadeh, M.; Ahmadi, M.; Heidari, M.; Esmaeilzadeh, A.; Abdolazimi, R. Offensive Language Detection on Social Media Based on Text Classification. In Proceedings of the 2022 IEEE 12th Annual Computing and Communication Workshop and Conference (CCWC), Las Vegas, NV, USA, 26–29 January 2022; pp. 0092–0098. [Google Scholar]
  15. Jahan, M.S.; Oussalah, M. A Systematic Review of Hate Speech Automatic Detection Using Natural Language Processing. Neurocomputing 2023, 546, 126232. [Google Scholar] [CrossRef] [Scilit]
  16. Ashok Kumar, J.; Abirami, S.; Trueman, T.E.; Cambria, E. Comment Toxicity Detection via a Multichannel Convolutional Bidirectional Gated Recurrent Unit. Neurocomputing 2021, 441, 272–278. [Google Scholar]
  17. Al-Hassan, A.; Al-Dossari, H. Detection of Hate Speech in Arabic Tweets Using Deep Learning. Multimed. Syst. 2022, 28, 1963–1974. [Google Scholar] [CrossRef] [Scilit]
  18. Alatawi, H.S.; Alhothali, A.M.; Moria, K.M. Detecting White Supremacist Hate Speech Using Domain Specific Word Embedding with Deep Learning and BERT. IEEE Access 2021, 9, 106363–106374. [Google Scholar] [CrossRef] [Scilit]
  19. Nikolov, A.; Radivchev, V. Nikolov-Radivchev at SemEval-2019 Task 6: Offensive Tweet Classification with BERT and Ensembles. In Proceedings of the 13th International Workshop on Semantic Evaluation, Minneapolis, MN, USA, 6–7 June 2019; pp. 691–695. [Google Scholar]
  20. Ranasinghe, T.; Zampieri, M.; Hettiarachchi, H. BRUMS at HASOC 2019: Deep Learning Models for Multilingual Hate Speech and Offensive Language Identification. In Proceedings of the FIRE (Working Notes), Hyderabad, India, 16–20 December 2020 2019; pp. 199–207. [Google Scholar]
  21. Devlin, J.; Chang, M.-W.; Lee, K.; Toutanova, K. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. arXiv 2018, arXiv:1810.04805. [Google Scholar]
  22. Mohaouchane, H.; Mourhir, A.; Nikolov, N.S. Detecting Offensive Language on Arabic Social Media Using Deep Learning. In Proceedings of the 2019 Sixth International Conference on Social Networks Analysis, Management and Security (SNAMS), Granada, Spain, 22–25 October 2019; pp. 466–471. [Google Scholar]
  23. Abdelsamie, M.M.; Azab, S.S.; Hefny, H.A. A Comprehensive Review on Arabic Offensive Language and Hate Speech Detection on Social Media: Methods, Challenges and Solutions. Soc. Netw. Anal. Min. 2024, 14, 111. [Google Scholar] [CrossRef] [Scilit]
  24. Althobaiti, M.J. BERT-based Approach to Arabic Hate Speech and Offensive Language Detection in Twitter: Exploiting Emojis and Sentiment Analysis. Int. J. Adv. Comput. Sci. Appl. 2022, 13, 972–980. [Google Scholar] [CrossRef] [Scilit]
  25. El-Alami, F.-z.; Ouatik El Alaoui, S.; En Nahnahi, N. A Multilingual Offensive Language Detection Method Based on Transfer Learning from Transformer Fine-Tuning Model. J. King Saud Univ.-Comput. Inf. Sci. 2022, 34, 6048–6056. [Google Scholar] [CrossRef] [Scilit]
  26. Koshiry, A.M.E.; Eliwa, E.H.I.; Abd El-Hafeez, T.; Omar, A. Arabic Toxic Tweet Classification: Leveraging the AraBERT Model. Big Data Cogn. Comput. 2023, 7, 170. [Google Scholar] [CrossRef] [Scilit]
  27. Saeed, R.; Afzal, H.; Rauf, S.A.; Iltaf, N. Detection of Offensive Language and Its Severity for Low Resource Language. ACM Trans. Asian Low-Resour. Lang. Inf. Process. 2023, 22, 156. [Google Scholar] [CrossRef] [Scilit]
  28. Pitenis, Z.; Zampieri, M.; Ranasinghe, T. Offensive Language Identification in Greek. arXiv 2020, arXiv:2003.07459. [Google Scholar]
  29. Niraula, N.B.; Dulal, S.; Koirala, D. Offensive Language Detection in Nepali Social Media. In Proceedings of the 5th Workshop on Online Abuse and Harms (WOAH 2021), Kolkata, India, 12–15 December 2021; pp. 67–75. [Google Scholar]
  30. Nandi, A.; Sarkar, K.; Mallick, A.; De, A. A Survey of Hate Speech Detection in Indian Languages. Soc. Netw. Anal. Min. 2024, 14, 70. [Google Scholar] [CrossRef] [Scilit]
  31. Goyal, S.; Doddapaneni, S.; Khapra, M.M.; Ravindran, B. A Survey of Adversarial Defenses and Robustness in NLP. ACM Comput. Surv. 2023, 55, 1–39. [Google Scholar] [CrossRef] [Scilit]
  32. Chen, T.Y.; Cheung, S.C.; Yiu, S.M. Metamorphic Testing: A New Approach for Generating Next Test Cases. arXiv 2020, arXiv:2002.12543. [Google Scholar]
  33. de Oliveira, G.A.; de Sousa, R.T.; de Oliveira Albuquerque, R.; García Villalba, L.J. Adversarial Attacks on a Lexical Sentiment Analysis Classifier. Comput. Commun. 2021, 174, 154–171. [Google Scholar] [CrossRef] [Scilit]
  34. Hosseini, H.; Kannan, S.; Zhang, B.; Poovendran, R. Deceiving Google’s Perspective API Built for Detecting Toxic Comments. arXiv 2017, arXiv:1702.08138. [Google Scholar]
  35. Samanta, S.; Mehta, S. Generating Adversarial Text Samples. In Advances in Information Retrieval; Springer: Cham, Switzerland, 2018; pp. 744–749. [Google Scholar]
  36. Belinkov, Y.; Bisk, Y. Synthetic and Natural Noise Both Break Neural Machine Translation. arXiv 2017, arXiv:1711.02173. [Google Scholar]
  37. Formento, B.; Foo, C.S.; Tuan, L.A.; Ng, S.K. Using Punctuation as an Adversarial Attack on Deep Learning-Based NLP Systems: An Empirical Study. In Proceedings of the Findings of the Association for Computational Linguistics: EACL 2023, Dubrovnik, Croatia, 2–6 May 2023; pp. 1–34. [Google Scholar]
  38. Alsmadi, I.; Ahmad, K.; Nazzal, M.; Alam, F.; Al-Fuqaha, A.; Khreishah, A.; Algosaibi, A. Adversarial Attacks and Defenses for Social Network Text Processing Applications: Techniques, Challenges and Future Research Directions. arXiv 2021, arXiv:2110.13980. [Google Scholar]
  39. Alzantot, M.; Sharma, Y.; Elgohary, A.; Ho, B.-J.; Srivastava, M.; Chang, K.-W. Generating Natural Language Adversarial Examples. arXiv 2018, arXiv:1804.07998. [Google Scholar]
  40. Jia, R.; Raghunathan, A.; Göksel, K.; Liang, P. Certified Robustness to Adversarial Word Substitutions. arXiv 2019, arXiv:1909.00986. [Google Scholar]
  41. Ribeiro, M.T.; Singh, S.; Guestrin, C. Semantically Equivalent Adversarial Rules for Debugging NLP Models. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), Melbourne, Australia, 15–20 July 2018; pp. 856–865. [Google Scholar]
  42. Eger, S.; Şahin, G.G.; Rücklé, A.; Lee, J.-U.; Schulz, C.; Mesgar, M.; Swarnkar, K.; Simpson, E.; Gurevych, I. Text Processing Like Humans Do: Visually Attacking and Shielding NLP Systems. arXiv 2019, arXiv:1903.11508. [Google Scholar]
  43. Fu, X.; Gu, Z.; Han, W.; Qian, Y.; Wang, B. Exploring Security Vulnerabilities of Deep Learning Models by Adversarial Attacks. Wirel. Commun. Mob. Comput. 2021, 2021, 9969867. [Google Scholar] [CrossRef] [Scilit]
  44. Zang, Y.; Qi, F.; Yang, C.; Liu, Z.; Zhang, M.; Liu, Q.; Sun, M. Word-level Textual Adversarial Attacking as Combinatorial Optimization. arXiv 2019, arXiv:1910.12196. [Google Scholar]
  45. Tu, K.; Jiang, M.; Ding, Z. A Metamorphic Testing Approach for Assessing Question Answering Systems. Mathematics 2021, 9, 726. [Google Scholar] [CrossRef] [Scilit]
  46. Iyyer, M.; Wieting, J.; Gimpel, K.; Zettlemoyer, L. Adversarial Example Generation with Syntactically Controlled Paraphrase Networks. arXiv 2018, arXiv:1804.06059. [Google Scholar]
  47. Ren, S.; Deng, Y.; He, K.; Che, W. Generating Natural Language Adversarial Examples Through Probability Weighted Word Saliency. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, Florence, Italy, 28 July–2 August 2019; pp. 1085–1097. [Google Scholar]
  48. Jiang, M.; Bao, H.; Tu, K.; Zhang, X.Y.; Ding, Z. Evaluating Natural Language Inference Models: A Metamorphic Testing Approach. In Proceedings of the 2021 IEEE 32nd International Symposium on Software Reliability Engineering (ISSRE), Wuhan, China, 25–28 October 2021; pp. 220–230. [Google Scholar]
  49. Ma, P.; Wang, S.; Liu, J. Metamorphic Testing and Certified Mitigation of Fairness Violations in NLP Models. In Proceedings of the Twenty-Ninth International Joint Conference on Artificial Intelligence (IJCAI-20), Yokohama, Japan, 7–15 January 2020; pp. 458–465. [Google Scholar]
  50. Xu, Y.; Zhou, Z.Q.; Zhang, X.; Wang, J.; Jiang, M. Metamorphic Testing of Named Entity Recognition Systems: A Case Study. IET Softw. 2022, 16, 386–404. [Google Scholar] [CrossRef] [Scilit]
  51. Sun, Y.; Ding, Z.; Huang, H.; Zou, S.; Jiang, M. Metamorphic Testing of Relation Extraction Models. Algorithms 2023, 16, 102. [Google Scholar] [CrossRef] [Scilit]
  52. Yan, B.; Yecies, B.; Zhou, Z.Q. Metamorphic Relations for Data Validation: A Case Study of Translated Text Messages. In Proceedings of the 2019 IEEE/ACM 4th International Workshop on Metamorphic Testing (MET), Montreal, QC, Canada, 26 May 2019; pp. 70–75. [Google Scholar]
  53. Jiang, M.; Chen, T.Y.; Wang, S. On the Effectiveness of Testing Sentiment Analysis Systems with Metamorphic Testing. Inf. Softw. Technol. 2022, 150, 106966. [Google Scholar] [CrossRef] [Scilit]
  54. Wang, B.; Xu, C.; Liu, X.; Cheng, Y.; Li, B. SemAttack: Natural Textual Attacks via Different Semantic Spaces. arXiv 2022, arXiv:2205.01287. [Google Scholar]
  55. Tsai, Y.-T.; Yang, M.-C.; Chen, H.-Y. Adversarial Attack on Sentiment Classification. In Proceedings of the 2019 ACL Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, Florence, Italy, 1 August 2019; pp. 233–240. [Google Scholar]
  56. Rusert, J.; Shafiq, Z.; Srinivasan, P. On the Robustness of Offensive Language Classifiers. arXiv 2022. [Google Scholar] [CrossRef] [Scilit]
  57. Ribeiro, M.T.; Wu, T.; Guestrin, C.; Singh, S. Beyond Accuracy: Behavioral Testing of NLP Models with CheckList. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, Online, 5–10 July 2020; p. 442. [Google Scholar] [CrossRef] [Scilit]
  58. Abdelaty, M.; Lazem, S. Investigating the Robustness of Arabic Offensive Language Transformer-Based Classifiers to Adversarial Attacks. In Proceedings of the 2024 Intelligent Methods, Systems, and Applications (IMSA), Giza, Egypt, 13–14 July 2024; pp. 109–114. [Google Scholar]
  59. Manerba, M.M.; Tonelli, S. Fine-grained Fairness Analysis of Abusive Language Detection Systems with CheckList. In Proceedings of the 5th Workshop on Online Abuse and Harms (WOAH 2021), Bangkok, Thailand, 6 August 2021; pp. 81–91. [Google Scholar]
  60. Abdul-Mageed, M.; Elmadany, A.; Nagoudi, E.M.B. ARBERT & MARBERT: Deep Bidirectional Transformers for Arabic. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing, Online, 1–6 August 2021; pp. 7088–7105. [Google Scholar]
  61. Gaanoun, K.; Naira, A.M.; Allak, A.; Benelallam, I. DarijaBERT: A Step Forward in NLP for the Written Moroccan Dialect. Int. J. Data Sci. Anal. 2024. [Google Scholar] [CrossRef] [Scilit]
  62. Aghzal, M.; Bouni, M.A.E.; Driouech, S.; Mourhir, A. Compact Transformer-based Language Models for the Moroccan Darija. In Proceedings of the 2023 7th IEEE Congress on Information Science and Technology (CiSt), Agadir–Essaouira, Morocco, 16–22 December 2023; pp. 299–304. [Google Scholar]
  63. Gao, J.; Lanchantin, J.; Soffa, M.L.; Qi, Y. Black-Box Generation of Adversarial Text Sequences to Evade Deep Learning Classifiers. In Proceedings of the 2018 IEEE Security and Privacy Workshops (SPW), San Francisco, CA, USA, 24 May 2018; pp. 50–56. [Google Scholar]
  64. Segura, S.; Fraser, G.; Sanchez, A.B.; Ruiz-Cortés, A. A Survey on Metamorphic Testing. IEEE Trans. Softw. Eng. 2016, 42, 805–824. [Google Scholar] [CrossRef] [Scilit]
  65. He, J.; Wang, L.; Wang, J.; Liu, Z.; Na, H.; Wang, Z.; Chen, Q. Guardians of Discourse: Evaluating LLMs on Multilingual Offensive Language Detection. arXiv 2024, arXiv:2410.15623. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.