UNT Linguistics at S em E val-2020 Task 12: Linear SVC with Pre-trained Word Embeddings as Document Vectors and Targeted Linguistic Features (2020)

Abstract: This paper outlines our approach to Tasks A & B for the English Language track of SemEval-2020 Task 12: OffensEval 2: Multilingual Offensive Language Identification in Social Media. We use a Linear SVM with document vectors computed from pre-trained word embeddings, and we explore the effectiveness of lexical, part of speech, dependency, and named entity (NE) features. We manually annotate a subset of the training data, which we use for error analysis and to tune a threshold for mapping training confidence values to labels. While document vectors are consistently the most informative features for both tasks, testing on the development set suggests that dependency features are an effective addition for Task A, and NE features for Task B.

## introduction and system overview semeval 2020 task 12: offenseval 2 @xcite ) is an offensive language identification task revolving around classifying social media comments. for the english track, there are three sub-tasks: offensive language identification (task a), offense type categorization (task b), and offense target identification (task c). we focus on tasks a & b. in contrast to 2019's task, this year's training data is labeled using distant supervision: various supervised models trained on the manually-annotated olid-2019 data set @xcite output labels and confidence values for a much larger data set, resulting in the solid dataset @xcite . the semi-supervised labels are converted to an average confidence value between 0 and 1; 1 is aligned to the positive class for the task and 0 to the negative class. thus an additional challenge in this task is determining an appropriate threshold value for mapping confidence measures to labels. to this end, we create a held-out hand-annotated development set from the training data for each task and use it as a test set for picking a good threshold. 1 using scikit-learn's linear svm implementation @xcite , we build a classifier with features based on two sets of pre-trained word embeddings: glove's 200-dimension twitter embeddings @xcite and 200-dimensional word2vec twitter embeddings @xcite . additionally, we explore four categories of linguistic features beyond the embeddings: lexical, part of speech, dependency, and named entity features. we use spacy @xcite for preprocessing and extraction of linguistic features. ablation studies of the additional linguistic features establish which linguistic features are most effective in each task. the goals of these studies are: to further target which features are most informative for each of the sub-tasks; to also narrow in on features that are ineffective or may be detrimental to classification; and to identify which types of offensive constructions are still missed by the model and why. in other tasks, such as multi-lingual sentiment analysis, success has been found in deep learning architectures that have utilized both word embeddings and feature embeddings as input @xcite . for some tasks, the most appropriate types of feature embeddings may be directly apparent. however, in a complex semantic problem such as recognizing offensive and abusive language, the ideal feature support to the word embedding input is not immediately clear. feature engineering and error analysis can offer additional information in understanding which linguistic relations best inform feature extraction for future implementations. ## data all experiments are performed using the solid @xcite and olid @xcite data sets. the offenseval annotation scheme is a pipeline: tweets are labeled as off or not in task a, and only offensive tweets go on to task b, where they are labeled as targeted or untargeted. this means good performance on earlier subtasks is essential for good overall performance; thus we focus on the first two subtasks. we randomly sample 1 million tweets from the total training data for task a (over 9 million tweets), and we use the entire training set for task b (188,727 tweets). as mentioned above, we create small hand-annotated validation sets for each task: 375 tweets for task a and 350 for task b. discretization and threshold testing. to identify an appropriate threshold for discretizing the average confidence values in the training set (i.e. to convert them to labels of off or not), we perform iterative testing of different threshold values, using an increment of 0.01 and measuring f1 on the hand-annotated validation sets. one concern with this approach is that all annotations in the hand-annotated data sets come from our first author, with no discussion or adjudication. thus we perform a second round of iterative testing using last year's olid test data as validation data. we decide final threshold values by compromising between the best thresholds on our human-annotated data and on the olid-2019 test data. we try two different strategies for picking the best threshold, described below. results appear in figure 1 ; lines with circles show the simple average strategy, and those with triangles show the filtering strategy. average confidence value testing. in this strategy, we compare performance on the validation data sets for different thresholds on the average confidence value provided with the training data. the best values testing on our small manually-annotated data set are 0.40 and 0.33 for tasks a and b, respectively. testing on olid-2019, the best threshold values for the two tasks are 0.44 and 0.47, respectively. compromise values, used for further classification, are 0.42 and 0.38. filtering. the second strategy is designed to remove many of the less-confident or borderline cases of the data, leaving only clearer instances of positive and negative classes. to do this, we set two conditions: average confidence values must be either above a certain value or below another value (avoiding instances with scores around the midpoint of the data), and standard deviation for the scores must not exceed a specified value. as such, the following filters were set for task a&b's training data: the filtering strategy has a noticeable effect on performance trends, effectively flattening the peaks and troughs seen with the simpler method. while filtering allows for a more generous range when determining the best threshold, with a larger margin for error, there is a fundamental concern of whether or not this method generalizes well to new test data, having removed all of the difficult and/or vague cases. we use the simple method for our submitted system. ## model and features although the most successful systems from offenseval 2019 were primarily neural systems @xcite , we choose to use a non-neural svm classifier because of the ease of feature inspection, feature specification, and error analysis. specifically, we use scikit-learn's linear svm implementation @xcite with default parameter values. previous svm-based approaches to offensive language detection investigate the effectiveness of sentence embeddings @xcite , for example) and lexical features such as sentiment analysis and offensive/profane word lexicons (plaza-del arco et al., 2019, among others). we hypothesize that part of speech, dependency, and named entity features capture additional context useful for classifying tweets with more elusive forms of offensive language. these context-level features could also be useful in task b, to capture differences in the constructions seen in targeted vs. untargeted tweets. our base model uses the dimensions of a document embedding (described below) as features; our additional linguistic features are listed in lexical features. this category of features includes a combination of simple token features, including counts and length, with several twitter specific features. in particular, features related to user names and non-alphabetic character substitutions aim to account for alternate word constructions that may be reflected in the pre-trained embeddings. @xcite use a similar non-alpha substitution feature when looking at yahoo! finance comments due to observations that some users self-censor their profanity. part of speech and dependency features. along with tokenization, part of speech tagging and dependency parsing was also done by spacy's nlp pipeline for each tweet. for part of speech features, we build a tfidf matrix of tags. for dependency features, which describe relation to a root, we concatenate dependency tags with their corresponding root's pos tag to form "dependency headpostag" constructions and, similarly, build a tfidf matrix. in both cases, we use sub-linear term frequency. named entity features. we use spacy's named entity recognition (ner) parser to produce named entity tags for tweets. the intuition is that ne information should be useful for task b in particular, as the presence or lack of certain ne constructions could signal a targeted or untargeted tweet. we implement this as four binary features indicating the presence of person, place, nationality, and organization tags. ## analysis we perform two types of analysis to better understand the role of various linguistic feature sets for offensive language classification: ablation studies ( we do ablation studies in two directions: adding feature sets to our base model, and subtracting them from the full model (base model plus all linguistic feature sets). all results in this section are from testing on our hand-annotated validation set, with best-performing threshold values. for each task, one additional feature set triggers the largest gain in f1, and additional feature set combinations result in negligible gains; we do additional error analysis for these two feature sets. the lexical feature set seems to be the least informative for both tasks, as its addition or subtraction causes minimal changes. text gold base +dep 1. "i forgot that for my city school is back in session, and i nearly shat myself when i saw a school bus" off not off 2. ain't nothing wrong with that some of you should just accept you was a quick f**k. &amp; that's okay off not off 3. @user that must have been extremely painful! not off not 4. @user we need some or her passion in politics. she would wipe the floor with johnson. not off not 5. hey i don't like the term bbc or to use it. i just like that i have sex with people. no label necessary. off not off 6. "i've got this love-hate relationship with fluid dynamics it's so interesting, but so f**king hard " off not off task a. dependency features are the most effective of the linguistic feature sets for task a, triggering the largest performance gain in additive ablation and the largest drop in subtractive ablation. part of speech features are the second most informative. intuitively, context-based features like dependencies and pos tags may capture relations with unknown words or lexical variants missed by the embeddings. for task a, pos and dependency features seem to overlap, though the results suggest that dependency relations to the pos tag of the head have more informative weight than plain pos tags. the difference between the effect of the two feature sets is minimal in additive ablation but stronger in subtractive ablation. example 4 illustrates offensive or profanity-based acronyms such as "bbc". in these cases, context-based relations bridge the gap that unknown words or variation create in the embedding baseline. in cases such as examples 2 and 6, while the offensive keywords have a strong association with the off label, the presence of emojis may interfere with the mean vector of the embeddings, as these are unlikely to have a concrete entry in the pre-trained embeddings. dependency features also have some overlap with other feature categories. one of the twitter-specific lexical features signals the @user tag in tweet-initial position. @user at the start of a sentence is parsed as a root dependency tag with no relations. because of this, the presence of a "root postag" relationship in a sentence commonly marks for start @user position. relationships such as these, where the dependency features indirectly measure and have overlap with other feature areas in their context and scope, may explain the size of the effect for dependency features. task b. as expected, named entity features offer the most information value on top of the base model for task b. while specific ne tags could be perceived as being most useful for task c in distinguishing between individual, group, or other categories, the presence of these aspects can help distinguish between a targeted tweet and an untargeted tweet. we find that the four binary features are more useful than the tfidf matrix for frequencies of ne tags. the binary features offer sufficient coverage to explain most misclassification errors corrected through the addition of ne features. some examples appear in a challenging aspect of building the development set for this task is the absence of conversational context. example 10 could be considered ambiguous as to whether the tweet is targeted, depending on the speaker. if the speaker is indian (i.e. a member of the potentially targeted group), whether the tweet is targeting that group remains unclear. however, if the tweet is uttered by a person outside that group, it would be more clearly considered a targeted tweet. in the case of this tweet, it gets labeled with has place and has nationality, suggesting a targeted (tin) label, but the correct label could change based on conversational context. additional features offer very little value, with only the full feature model and the minus lexical feature model surpassing the embeddings-plus-ne model. though dependency features show greater effectiveness for task a, they under-perform in task b, offering less f1-gain when added to the baseline. ## results and future work at submission time, our model achieved f1 scores of 0.882 for task a (rank 71) and 0.617 for task b (rank 16). the model with these scores used thresholds of 0.38 and 0.33 for tasks a and b. additional threshold testing on the development set after the initial submission period suggests that further fine-tuning of the threshold may increase f1. use of the filtering strategy and additional filter parameter testing could also improve performance; we leave investigation of these directions for future work. to further explore this task, we would like to consider other embedding approaches, considering contextual embeddings such as elmo @xcite or large-scale fasttext @xcite embeddings for improving coverage on unknown words and lexical variations common to twitter. another interesting direction is the use of methods to transform emojis into word representation @xcite ; we suspect that emojis may play a strong role in conveying offensive language. since linguistic features seem to be useful for this task, we plan to look into twitter-specific toolkits for extraction of linguistic features; two possibilities are nltk's tweet tokenizer @xcite and tweetnlp's part-of-speech taggers and dependency parsers @xcite . finally, larger development sets with more annotators should lead to better threshold testing, especially for task b. ## conclusions while document-level embeddings are a useful foundation for both tasks a and b, the usefulness of additional features is highly dependent on the task. performance on task a, which saw errors where embedding coverage was bypassed by lexical variations, misspellings, or acronyms, is bolstered by contextbased features in the form of dependency information. this dependency information also indirectly covered other lexical features and proved to be the most informative of the additional features. task b is, as hypothesized, most heavily affected by the addition of named entity features.