# Improved Graph-Based Arabic Hotel Review Summarization Using Polarity Classification
## 4 Methodology
### TextRank Summarization  
TextRank algorithm includes three steps: calculating the similarity value between sentences, calculating sentence weight, and ranking sentences. The similarity value between two sentences is calculated in TextRank based on Equation (1) below, where \(K\) represents sentences and \(w\) is the word:  
\[sim_{ij}=\frac{\big{|}\big{\{}w_{k}|w_{k}\ \in\ k_{i}\ \&\ w_{k}\ \in\ k_{j}\big{\}} \big{|}}{\log(|k_{i}|)+\log(|k_{j}|)} \tag{3}\]  
where \(sim_{ij}\) represents the similarity value between sentences \(k_{i}\) and \(k_{j}\).  
To calculate the sentence weight, Google's PageRank utilizes a web link structure to calculate a quality ranking for each webpage. PageRank normalizes the number of links on a page rather than equally counting the links from all pages. PageRank is computed by Equation (2) below [42]:  
\[PR(X)=(1-d)+d\left(\frac{PR(T1)}{C(T1)}+\frac{PR(T2)}{C(T2)}+\dots+\frac{PR(Tn) }{C(Tn)}\right) \tag{4}\]  
Figure 5: The proposed review classification model.  
\begin{table}
\begin{tabular}{l l} \hline \hline
**Layer (Type)** & **Number of Parameters** \\ \hline embedding (Embedding) & 9,227,072 \\ bidirectional (Bidirectional) & 12,672 \\ dense (Dense) & 2080 \\ dropout (Dropout) & 0 \\ dense\_1 (Dense) & 165 \\ Total params: 9,241,989 \\ Trainable params: 9,241,989 \\ Non-trainable params: 0 \\ \hline \hline \end{tabular}
\end{table}
Table 5: The proposed deep learning model’s layers and the corresponding number of parameters.  
\(PR(X)\) represents the PageRank of page \(X\), while \(PR(T1)\) represents the PageRank of page \(T1\), which refers to page \(X\). \(C(T1)\) represents the number of outbound links on page \(T1\). A damping factor is defined as d, which can be assigned a value between 0 and 1, which is the click-through probability used to prevent sinking pages with no outgoing links [42]. PageRank computation is applied to the TextRank text summarization algorithm to calculate the node weight. PageRank and TextRank are based on graphs; the difference lies in the definition of node and edge. In PageRank, the node represents the web page, and the edge represents the page's link. While in TextRank, the node represents the sentence, and the edge represents the similarity value between sentences. In TextRank, sentence weight is calculated using Equation (3) below:  
\[WS(V_{i})=(1-d)+d\ \sum V_{j}\ \in\ \text{In}(V_{i})\ \frac{sim_{ij}}{\sum V_{k} \in\ \text{Out}(V_{j})sim_{jk}}\ WS(V_{j}) \tag{5}\]  
\(WS(Vi)\) represents the weight for sentence \(i\). \(sim_{ij}\) represents the similarity value of the sentence \(i\) and \(j\). In \((Vi)\) are all edges pointing to sentence \(i(Vi)\), while Out(\(Vj)\) is all the edges pointing outward from a sentence \(i(Vi)\), \(d\) represents the damping factor. Finally, after determining the weights of the sentences, the last step in obtaining the summary is to rank the sentences according to their weight, from highest to lowest, and the summary represents a certain percentage of the top-ranked sentences, depending on how long the summary is required to be. The Genism Python library [43] was used in this study to apply TextRank. The summaries ratio was set to 0.05 for the combined summary and 10% for each polarity group summary. The reason for choosing these parameters is to create a summary size close to the human-authored summary. Different ratios were tested, and those ratios generated the best results due to the size similarity.