# 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
We also investigated how varying the length of n-grams impacts the accuracy of various classification classifiers. TF-IDF is a numerical statistic model utilized to determine the significance of every word within the dataset. It is a well-known, straightforward method for extracting features that is employed in NLP, recommendation tasks, and classification. Two fundamental steps are required to implement this model. First, the Term Frequency (TF) It counts how many times a word appears in a tweet relative to the entire length of tweet words. It is stated as follows:

\[TF=\frac{NumberOfTimesTerm(t)AppearsInATweet}{NumberOfTermsInTheTweet} \tag{1}\]

Second, the Inverse Document Frequency (IDF) of uncommon words is high while that of common words is typically low. Hence, having the impact of highlighting unique words is explained as follows,

\[IDF=log(\frac{N}{n}) \tag{2}\]

where N is the number of tweets and n is the number of tweets a term t has appeared in. Then, to obtain the TF-IDF, we multiply the TF by each word's IDF value. The TF-IFD score increase proportionately with the frequency with which a word appears in the tweet \begin{table}
\begin{tabular}{l c} \hline \hline Total tweets in original AraCOVID19-SSD dataset & 4548 \\ Total number of positive tweets & 1762 \\ Total number of negative tweets & 955 \\ Total number of neutral tweets & 1831 \\ Total number of words & 72,122 \\ Total number of characters & 493,356 \\ Average words per tweet & 15.85 \\ \hline \hline \end{tabular}
\end{table} 
Table 8: Statistics about AraCOVID19-SSD dataset. and decreases with the frequency with which the term appears in the corpus. Commonly occurring terms in the corpus have lower TF-IDF values [26]. Sentiment-based feature: sentiment words are words in a language that are used to express positive or negative sentiments. Examples of positive opinion words are '_i_i_' (healing), '_'_j_' (joy), and '_'_j_' (recover). Examples of negative opinion words are '



DT [29] is a likelihood classifier based on multistage of logical decisions. Moreover, it classifies an unlabeled document to its class based on several decision functions. RF is a collection of tree structure classification models such that h (N, \(\theta\) n), M = 1,2,3,...T, where N is the input, T is number of tree structure classifiers and \(\theta\) is the independent random vectors. The general definition of RF classifier has been defined by [30]. Many other researchers provide different approaches such as [31; 32] in which the difference is the way of obtaining the distributed random vectors. Every tree is working as a decision tree that selects the data randomly from the available data. LR is a discriminative classifier. LR has been introduced by [33] for modeling categorical outcome of binary or multi-values variables. It solves the problem by extracting weighted features, in order to produce the label which maximizes the probability of event occurrence. #### 4.1.4 Evaluation Metrics

In the scope of this research, the performance of different used machine learning algorithms has been evaluated using the following frequently metrics, accuracy, recall, precision, and F-score. Accuracy is defined as the ratio of accurately predicted observations to total observations in Equation (4), where TP, FP, TN, and FN denote True Positive, False Positive, True Negative, and False Negative. \[Accuracy=(TP+TN)/(TP+TN+FP+FN) \tag{4}\]

Precision is calculated as stated in Equation (5), which equals the number of correctly predicted positive occurrences divided by the total number of predicted positive occurrences. \[Precision=TP/(TP+FP) \tag{5}\]

Recall is calculated as indicated in Equation (6), which is the ratio of correctly anticipated positive occurrences to the total number of positive opinions. \[Recall=TP/(TP+FN) \tag{6}\]

Continuing with recall and precision, the F-Score can be calculated as harmonic mean of precision and recall, as illustrated in Equation (7).