# Developing Analytical Tools for Arabic Sentiment Analysis of COVID-19 Data
## 3 Research Methodology
### Lexicon Construction
#### 3.1.2 Constructing a Lexicon Using the Trained Data
When we execute the first task, we look for instances of duplicate words because we want to guarantee that all words contained in the lexicon are distinct. As depicted in Figure 2, the size of the positive file decreased by 861 words, the size of the neutral file decreased by 1063 words, and the size of the negative file decreased by 1744 words. As part of the second assignment, we undertake manual testing, which results in some words being located in a neutral file but having a negative sentiment, such as the word \"\(\blacktriangle\)j\"/ \(\blacktriangle\)j\"/ \(\blacktriangle\)j\"/ \(\blacktriangle\)j\"/. Some words contained in the negative file, on the other hand, have neutral polarity, such as the words \"\(\blacktriangle\)j\"/ \(\blacktriangle\)j\"/ \(\blacktriangle\)j\"/ \(\blacktriangle\)j\"/ \(\blacktriangle\)j\"/. A number of words, such as \"\(\blacktriangle\)j\"/ located in negative file however, they have neutral polarity. Although certain words are in the positive file, they having a negative sentiment, as in \"\(\blacktriangle\)

### Sentiment Analyzer

An efficient Arabic sentiment analyzer is developed for performing SA of Arabic tweets regarding to COVID-19 based on lexicon approach. This tool takes Arabic tweets as input, process them, and categorize them as neutral, positive, or negative based on lexicon approach and take into consideration negation, and emojis. To develop this tool several steps are performed, data preprocessing, sentiment score extraction, and sentiment computation. These steps will be described in detail as follows, as shown in Figure 3.

Figure 3: A proposed framework for sentiment analyzer. Figure 2: Size of positive, negative, and neutral file without/with duplicate. #### 3.2.1 Scraping Tweets

In general, the most important factor of a study is the data collected. This is because evaluation and experimentation are based on that data. Twitter has been chosen as the social media platform to collect datasets. Twitter makes its data available through public APIs that may access via URLs. For Twitter data collection, calling required libraries, such as Tweepy, is the first step to access Twitter data. Tweepy is a Python library that allows to access Twitter's data via the API. Then, an OAuth protocol-supported user authentication and a keep-alive HTTP connection method were utilized to gain access to the Twitter API. Specifically, the OAuth authentication protocol is utilized to grant applications permission to Twitter's services. Python function/API is utilized to fetch tweets from Twitter based on specified keywords, such as \"'Us35555



#### 3.2.3 Sentiment Score Extraction

After the dataset was collected, several steps of preprocessing were performed. The words from each incoming tweet is scanned one by one in seven diverse files, negative word file, neutral word file, positive word file, positive emoji file, negative emoji file, neutral emoji file, and negation word file. Add one to the positive counter when a term is located in the positive word file. Add one to the negative counter if a word is located in the negative word file. Add one to the neutral counter when a term is located in the neutral word file. If a term is located in negation file or in emoji files, it is assigned polarity according to the following rules. In the SA task, handling negation is a crucial stage because negation can influence the text's overall polarity [23]. In this study, we employ a more straightforward but efficient method for handling negation. In case a negation word is found, we will examine the polarity of the next token; if the next token has a positive polarity, then we add to the counter of negative words. However, if the word is negative, then this time we add to the counter of positive words. If the following token does not have any sentiment, then the next token will be examined and the counter will increase for negative or positive depending on the word's polarity.