S peech T rans@ SMM 4 H ’20: Impact of Preprocessing and N-grams on Automatic Classification of Tweets That Mention Medications (2020)

Abstract: This paper describes our system developed for automatically classifying tweets that mention medications. We used the Decision Tree classifier for this task. We have shown that using some elementary preprocessing steps and TF-IDF n-grams led to acceptable classifier performance. Indeed, the F1-score recorded was 74.58% in the development phase and 63.70% in the test phase.

## introduction the 2020 social media mining for health applications workshop @xcite launched several natural language processing tasks using social media mining for health monitoring for automatic classification of tweets: that mention medications, multilingual tweets that report adverse effects, tweets reporting a birth defect pregnancy outcome, in addition to automatic extraction and normalization of adverse effects in english tweets, and automatic characterization of chatter related to prescription medication abuse in tweets. we are interested in the automatic classification of tweets that mention medication. a binary classification system has been experimented to achieve the task's aim, which is the distinction of tweets reporting medications from those that do not. ## dataset in this section, we describe the dataset of task 1 that proposes to find tweets mentioning medications. then, we present the pre-processing steps that we applied to clean the raw texts extracted from twitter. the publicly available dataset @xcite ) contains for each tweet: (i) the user id, (ii) the tweet id, and (iii) the binary annotation indicating the presence or absence of medications information. the dataset contains 69,272 tweets manually tagged. we noted that 0.26% of the dataset (181 tweets) mentioning medications are tagged as "positive", and 99.97% (69,091 tweets) that don't mention medication information are tagged as "negative". ## system architecture in our system, we applied three pre-processing steps. where the first is the tweets preprocessor 1 developed by the auth team as part of the plastictwist crowdsourcing module 2 . we used this tool to remove: all urls, all mentions, all hashtags, twitter reserved words (e.g. 'rt', 'via'), punctuation, single-letter words, blank spaces, stop-words, profane words, numbers. whereas for the second step, we used spacy tool 3 to parse the documents, and filter numbers, punctuation, white space, url, while keeping the hashtag text. we also removed special characters, single-syllable tokens, mentions. we also this work is licensed under a creative commons attribution 4.0 international license. license details: http:// creativecommons.org/licenses/by/4.0/ . we have done a contraction check to check if there is any contracted form, and replace it with its original form ("aren't" is replaced by "are not") followed by a lemmatization process where we lemmatize each token using spacy method '.lemma ', except for pronouns, where they are kept as they are since spacy lemmatizer transforms every pronoun to "-pron-". finally, we will run a spell correction to deals with repeated characters such as "sooooo goooood". finally, for the third pre-processing step, we have used some regex rules to remove punctuation and emojis. in this work, we used a machine learning approach. in order to prepare the corpus, we adopted three pre-processing steps which can be used individually or all together. after many experiments with multiple combinations of the aforementioned three pre-processing steps, we decided to keep two choices that gave the best performance: the 1st choice (applying steps 1 and 2 sequentially) and the 2nd choice (steps 1, 2, 3). after cleaning the data, we applied a tf-idf vectorizer, and n-grams with multiple values of n (ranging from 3 to 20). we performed three tokenization process: word, character, and character with boundary (considers the space as a character) @xcite . the classification has been achieved using the decision tree algorithm. we applied re-sampling using k-fold cross-validation @xcite . we set the values of k to 5 and 10. ## experiments and results as mentioned in the previous section, our system consists of applying multiple combinations of cleaners (preprocessing steps) and using n-grams and tokenizers. we selected the three best results found for development and test phase and addressed in ## conclusion the approach adopted in this work relies first on a set of preprocessing steps applied to the tweets' dataset supplied in this task, and second, on the tf-idf classifier with n-grams features, in addition to tokenization module. we have shown that adequate choices of preprocessing steps combination and values of n (n-grams) led to performance improvement. compared to the average task performance, our system gives an f1 score of 63.70% with a precision which outperforms the average by nearly 4%.