# A Lexicon-Based Framework for Mining and Analysis of Arabic Comparative Sentences
## 3 Proposed Framework
### Arabic Comparative Sentence Type Identification
The statement in line 2 splits each sentence into words using the space between words and stores it in an array. The statement in line 3 accesses each word in the array. The statement in line 4 accesses each superlative type comparison keywords from the comparison keywords lexicon in order. The statement in line 5 checks if the comparison keyword has a positive sentiment, then the statements from line 6 to line 15 extract entity 1 from the words before the comparison keyword. The statement in line 17 checks if the comparison keyword has a negative sentiment, then the statement in line 18 stores the setting that shows that there is no preferred entity extracted from the analyzed sentence. ```
1:Input: dataset of Superlative comparative sentences. 2:Output: extracted preferred entities from the input dataset. 3:for each sentence\({}_{\text{i}}\) in the dataset of Superlative comparative sentences do
4: New Array arr[] = split sentence\({}_{\text{i}}\) with \" \"
5:for each word\({}_{\text{j}}\) in arr[] do
6:for each Superlative-Type-keyword\({}_{\text{n}}\) in Comparative Keyword Lexicon do\(\triangleright\) Positive Superlative Type Keyword
7:if (wordj = PositiveSuperlativeTypeKeyword\({}_{\text{n}}\)) then
8:if (j - 2 >= 0) then Then
9: Entity1 = word\({}_{\text{j-2}}\) + \" + word\({}_{\text{j-1}}\)
10:else
11:if (j - 1 >= 0) then
12: Entity1 = word\({}_{\text{j-1}}\)
13:else
14: Entity1 = \" \"
15:endif
16:endif
17: PreferredEntity = Entity1 \(\triangleright\) Negative Superlative Type keyword
18:else
19:if (wordj = NegativeSuperlativeTypeKeyword\({}_{\text{n}}\)) then
20: PreferredEntity = \"No Preferred Entity\"
21:endif
22:endif
23:endif
24:endif
25:endif
26:endif
27:endif
28:endif
```

**Algorithm 5** Pseudo-code of the PEEASCS algorithm

## 4 Evaluation Metrics

This section presents the evaluation metrics used in evaluating the proposed algorithms. Four main standard evaluation metrics were used to obtain the evaluation results. The metrics are _Precision_, _Recall_, _F-score_ and _Accuracy_[21]. The following equations define the evaluation metrics. It should be noted that TP and TN parameters represent the number of true positive and true negative identified results, respectively, while FP and FN parameters represent the number of false positive and false negative identified results, respectively. \[Precision=\frac{TP}{TP+FP}\times 100\% \tag{1}\]

\[Recall=\frac{TP}{TP+FN}\times 100\% \tag{2}\]\[F\text{-}score=2\times\frac{Precision\times Recall}{Precision+Recall} \tag{3}\]

\[Accuracy=\frac{TP+TN}{TP+TN+FP+FN}\times 100\% \tag{4}\]

## 5 Results and Discussion

### Evaluation of ACSI Algorithm

This section presents and discusses the evaluation results of the proposed ACSI algorithm. Figure 2 and Table 5 show the evaluation results of the ACSI algorithm for each of the three datasets used in the evaluation. The figure shows the results in a graphical presentation so that the reader can easily compare the different metrics accross all datasets. The table shows the same results; however, in a numerical format so that curious reader can accurately compare the different metrics in a quantitative way. The evaluation metrics were calculated using Equations (1) to (4). The TP and FP parameters mentioned in the equations indicate the number of comparative sentences that were truly and falsely identified using the proposed ACSI algorithm, respectively. The TN and FN parameters indicate the number of non-comparative sentences that were truly and falsely identified using the proposed ACSI algorithm, respectively. * Diacritics in modern standard Arabic language change the meaning of the word completely such as the word _equi_ which means yes in English; however, (_equi_) means the best in English. In this example, if the correct diacritics is considered in the analysis of the sentence, the sentence would be identified as a superlative comparative type. The ACSI algorithm does not take into account the diacritics of the words.