1. Introduction
Human behavior consisting of actions, feelings, judgement, and opinions is ultimately constructed and influenced by abstract ideas and benefits. Expressing opinions and attitudes is an integral and habitual component of human interactions as a feature of our being social animals. For this reason, people often make choices based on how others think and interpret the world (Yi and Liu, Reference Yi and Liu2020). With the rise and advancement of digital technologies, social media platforms have become powerful tools that allow everyone to express their opinions, relay their experiences, and shape public discussion on a wide variety of topics. In this case, SA, or opinion mining, is a growing area of focus. That is to say, SA is part of a family of data mining and machine learning (ML) approaches focusing on identification or the extraction and classification of subjective information from textual or multimedia content. SA can provide understanding of the public’s attitude toward subjects in areas such as politics, economics, entertainment, and consumer products (Mehta and Pandya, Reference Mehta and Pandya2020). Given the real-time feedback and opinion nature of platforms like Twitter and Facebook, social media acts as an abundant source of emotionally driven user-generated content that can provide valuable commentary about social trends and public opinion. The applications of SA go beyond commercial uses; SA serves an important role in the advancement toward intelligent governance, intelligent infrastructure, and data-informed decision-making systems. Businesses have already adopted SA into customer engagement strategies, using feedback loops to co-create value for customers and enhance customer experiences. Public administration is starting to utilize SA to get insight into civic concerns as a way to improve policy-making. The ability to capture public opinion with access to real-time commentary over social media acts as a digital “social sensor,” which allows for pro-active governance and responsive governance (Nair et al., Reference Nair, Paralkar, Pandya, Chopra and Krishnan2021). With the advent of video-based content and the accelerated rate of content generation on YouTube, users have more capabilities to timestamp reviews and provide opinions through talkies or video. It is estimated that over five hours of video are uploaded to YouTube every second (Hasan et al. Reference Hasan, Sutikno and Ismail2021), (Polat et al. Reference Polat, Çelik, Ibrahim and Köseoglu2023).
ML techniques are widely employed to process and analyze user-generated content in social media. They assist in extracting interpretable patterns and predictions from complex data (Anvar Shathik and Krishna Prasad, Reference Anvar Shathik and Krishna Prasad2020). However, ML models are frequently limited by issues such as noisy, biased, or imbalanced training data; over- and underfitting; lack of interpretability; and computation burden (Birjali et al., Reference Birjali, Kasri and Beni-Hssane2021; Patil et al., Reference Patil, Rane, Desai and Rane2024; Koli and Redekar, Reference Koli and Redekar2023) that all contribute to poor model performance, which can hinder their use in real-time or high-stakes settings. In recent years, DL techniques have rapidly gained favor due in part to their capacity to very accurately model complex and high-dimensional data. Unlike conventional ML models, Dl models require no manual feature engineering because they learn the complex representation and relation for each feature from large datasets with DL (Gandhi et al., Reference Gandhi, Adhvaryu, Poria, Cambria and Hussain2023; George and Baskar, Reference George and Baskar2024; Rane et al., Reference Rane, Choudhary and Rane2024). This is particularly useful when the issues of interest are subtly expressed and highly contextual. For example, as personalized recommendations, user motivators, and engagement are of great interest to several media distribution companies, Netflix, Amazon, and YouTube use such models to improve their recommendation capacity and ultimately audience engagement (Wankhade et al., Reference Wankhade, Rao and Kulkarni2022; Kit and Joseph, Reference Kit and Joseph2023).
As we have seen many advances in SA, traditional SA methods still face a number of important issues, especially in complex, mixed, and contextually based sentiment domains like movie reviews. Many of these methods cannot reliably detect sentiments due to difficulties detecting long-range dependencies, subtle word interactions, and small semantic changes. Additionally, user-generated labels, which we rely on for classification, often include negative and positive components and vary among users, which adds to the challenges of detecting sentiment reliably.
Our research aims to mitigate these issues through a robust, adaptive sentiment analysis framework specifically designed for movie reviews and other high-context-text domains. We sat proposing a new model that aims to accurately and adaptively enhance both the model architecture and preprocessing pipeline to achieve overall substantial improvements for capturing nuanced sentiment expressions, detecting mixed opinions, and improved usage of contextual features. Our research will address the limitations of traditional methods to offer more reliable extraction of sentiment and related aspects while improving accuracy, interpretability, and consistency. This effort is intended to contribute to both academic SA and provide practical value for real-world sentiment-aware systems.
The main contributions of the proposed method are as follows:
-
1. A two-stage architecture called Hierarchical Attention-Guided Sentiment Network (HASN) is developed, combining advanced preprocessing with a hybrid deep learning classifier for robust sentiment prediction in movie reviews.
-
2. A systematic pipeline including text cleaning, lemmatization, stop-word removal, negation preservation, TF-IDF filtering, and Word2Vec embeddings is applied to ensure semantic consistency and improved feature quality.
-
3. A novel feature extraction module is proposed, which integrates stacked Bi-LSTMs for contextual learning, multi-head attention for sentiment focus, and a residual-normalized GRU (ResNorm-GRU) for efficient sequential refinement.
-
4. An enhanced classification mechanism is introduced, extending traditional CRFs with attention weighting to emphasize sentiment-driving tokens while maintaining coherent label transitions.
The article is structured as follows: The literature on sentiment analysis in cinematic critique is thoroughly examined in Section 2. The research methodology used in this study is presented in Section 3. Results are presented and discussed in Section 4, with a focus on the effectiveness and implementation of the suggested strategy. The conclusion provides a succinct overview of the main conclusions and their ramifications.
2. Literature review
Recent reviews of various SA research methods for movies have highlighted the promise of improving accuracy and interpretability of some of these methods with the lingering limitations of subtle sentiments, long-range dependencies, and possible overfitting. The literature supports that improvements to SA for movie review sentiment classification are a lively area of research that faces the ongoing limitations of subjectivity and model generalization.
Rehman et al. (Reference Rehman, Malik, Raza and Ali2019) discussed how social media had become an essential channel for user expression, with blogs and websites serving as fundamental repositories of product reviews. This study proposes a hybrid model based on LSTM and CNN for product review analysis. The initial word embedding was trained using the Word2Vec method. Then, long-term dependencies associated with the LSTM were combined with features obtained through the convolution and global max-pooling layers. To prevent overfitting, accuracy increases, and reduced elapsed time, dropout, normalization, and a ReLU were employed as well. The hybrid CNN-LSTM model experiment had better results in comparison to traditional DL and ML methods. However, the model did not have success identifying long-term dependencies and complex sequential interactions in text, which could misclassify movie reviews.
Dang et al. (Reference Dang, Moreno-García and De la Prieta2021) suggested a recommendation approach that utilized a combination of genre-based similarity and SA along with cooperative filtering methods. They implemented hybrid DL models for user review SA and BERT for genre preprocessing and feature extraction. By examining user thoughts and product characteristics, the method assisted consumers in better understanding their preferences. However, the model overfitted, excelling on trained data but not on unknown information due to learning noise and underlying patterns. To mitigate this, regularization and cross-validation techniques were recommended to prevent overcomplexity and promote better generalization.
Ramadhan and Ramadhan (Reference Ramadhan and Ramadhan2021) addressed the large volume of user reviews on IMDB, which some found overwhelming, making it difficult to evaluate the viewpoints of others. They used the SVM method to categorize the comments and analyze their sentiment utilizing the star rating component. SVM worked well for scientific and technical classification tasks, particularly those involving pattern recognition. Documents were converted into numerous words using the TF-IDF approach. The SVM model outperformed other techniques, such as logistic regression, with 79% accuracy, 75% precision, and 87% recall. However, existing sentiment analysis models led to inconsistencies and potential misclassifications, as users sometimes gave conflicting ratings, resulting in inaccuracies. Subtle sentiments posed a challenge, as nuanced expressions were difficult to capture using simple labels.
Dahir and Alkindy (Reference Dahir and Alkindy2023), prior to all of this, preprocessed the movie review textual data through tokenization, lemmatization, and feature extraction methods to aid with SA within text analytics. The author employed three of the most common ML methods, RF, SVM, and LR, to build models for sentimental classification. The results indicated that TF-IDF combined with a logistic regression performed better than any other model. These findings created more valid text analytic tools. However, the models frequently had difficulties nothing word’s subtle interactions, which was problematic for classifying meaning reliant on subtle linguistic relationships.
Steinke et al. (Reference Steinke, Wier, Simon and Seetan2022) constructed ML methods to categorize sentiments into emotions in internet movie reviews. They found and constructed models using the Standford Large Movie Review Dataset and SVMs, random forests, and decision trees. The researchers even constructed a new dataset based on postings to identify sentiment under the COVID-19 epidemic. SVM models provided the best classification accuracy (86.18%) and RF (85.27%). One reason that SA models trained with the dataset were limited in their ability to discover and detect nuanced or subtle sentiment lay in the inherent subjectivity of the sentiment labels provided by the users that created ambiguity and inconsistency.
Zhu and Samsudin (Reference Zhu and Samsudin2024) suggested an attention-based Bi-LSTM model with spatialized word embeddings for sentimental classification. These authors achieved an F1-score of 0.91 and accuracy of 91%, outperforming traditional ML approaches. The algorithm is a successful way of capturing a sentimental tendency that would be useful to consumer decision-making and feedback analysis. However, the model currently relies only on text data for sentiment analysis, which limits its effectiveness in real-world scenarios where emotions are often expressed through more than just words. By focusing only on text, the model lost important context and emotional cues found in other forms of unstructured data, such as voice tone in audio or facial expressions in video. This makes it harder for the model to fully understand the sentiment being conveyed.
The following Table 1 provides an overview of the literature reviews.
Overview of literature reviews

Table 1. Long description
A table with 6 rows and 4 columns comparing different studies on sentiment analysis and recommender systems. The columns are labeled Author(s), Methodology, Key findings, and Challenges/limitations. Row 1: Rehman et al., Hybrid CNN-LSTM model using Word2Vec, LSTM, and CNN, Outperformed traditional methods in precision, recall, F1-score, and accuracy, Struggled to capture complex sequential interactions and long-range dependencies in text. Row 2: Dang et al., Hybrid deep learning models with BERT-based genre preprocessing, Improved recommender-system performance by integrating genre-based similarity with sentiment analysis, Prone to overfitting and reduced performance on unseen data due to learning noise and dataset-specific patterns. Row 3: Ramadhanet al., SVM-based sentiment classification using TF-IDF, Achieved 79 percent accuracy, 75 percent precision, and 87 percent recall, outperforming logistic regression, Inconsistent ratings and subtle sentiment expressions resulted in classification errors and misclassifications. Row 4: Dahiret et al., Machine learning models including Random Forest, SVM, and Logistic Regression, Logistic Regression with TF-IDF achieved 89.20 percent accuracy, 88.80 percent precision, and 89.80 percent recall, Limited ability to capture nuanced word interactions and complex semantic relationships. Row 5: Steinke et al., SVM, Random Forest, and Decision Tree models, SVM achieved the highest accuracy (86.18 percent), followed by Random Forest (85.27 percent). The study also examined COVID-19’s impact on sentiment, Subjectivity and inconsistencies in sentiment labels introduced ambiguity in sentiment classification. Row 6: Zhu et al., Attention-based Bi-LSTM with spatialized word embeddings, Achieved 91 percent accuracy and an F1-score of 0.91 on more than 60,000 movie reviews, Relied exclusively on textual information, limiting the capture of audio and visual emotional cues.
As a result, existing literature reveals that traditional sentiment analysis models face significant limits in recognizing long-range connections and intricate word interactions, which are crucial for accurate sentiment classification, especially in nuanced or mixed-emotion contexts like movie reviews. A number of reigning investigations have a tendency to ignore small interactions among words, miss nuanced multifaceted sentiments, and underutilize the richness of textual data. Further challenges arise from the vanishing gradient problem in dealing with long sequences and the natural subjectivity and ambiguity in sentiment labels, which impact performance. These challenges ultimately lead to poor and inconsistent sentiment predictions.
3. Proposed methodology
SA in movie reviews offers useful insight for audiences and funders alike, allowing for strategic marketing, better engagement, and enhanced decision-making. While popular SA systems can help audiences and organizations in their decision-making, the current models suffer from major problems, especially in preprocessing or classification. The most common problems with the basic SA system include (1) models retaining too much noie, for example, pronunciations, typos, slang, or mistakes; (2) limited or ineffective negation handling; (3) low-level representation of the language; and (4) overly simplistic feature extraction to parse content derived from semantic meanings, essentially losing any contextual ordering. The last two points relate to the loss of nuanced meaning or perspective and difficulties in modeling contexts that can strengthen computational complexity. In this paper, we present a solution for this problem in two phases: the HASN: Phase 1 is structured preprocessing of the dataset, and Phase 2 consists of a hybrid classification model. In Phase 1, we conduct a systematic procedure to clean the text, conduct lemmatization, eliminate stop words, keep negation, and delete low-frequency or irrelevant terms from the corpus using TF-IDF. We then convert the text into semantically rich numerical representations and ensure the contextual meaning can be preserved using tokenization and Word2Vec embeddings. The modeling phase employs a feature extraction module called Tri-Stream Attention Recurrent Extractor (TARE) to holistically identify the sentiment tokens and a stable and efficient sequential refinement using a residual-normalized GRU (ResNorm-GRU) with gradient propagation. An Attn-CRF is used for classification. This framework merges a long-range dependency based on attention-based weighting with label transition modeling with enhanced sequence consistency and interpretability. The integration of these components allows the framework to take care of long-range dependencies, minimize vanishing gradient issues, contain semantic integrity, and produce coherent sentiment predictions for complicated and fine-grained movie reviews. Figure 1 illustrates the block diagram of the suggested methodology.
Block diagram of the proposed methodology.

3.1 Dataset description
The IMDB movie reviews dataset, originally utilized by Pang et al. (Reference Pang, Lee and Vaithyanathan2002) and later expanded as a benchmark for sentiment analysis, is available at http://rottentomatoes.com. This information was sourced from a large database of movie evaluations maintained by the Department of Computer Science at Stanford University. It contains 50,000 labeled sentiment texts, with reviews categorized into two sentiment classes: positive and negative. The sample contains an equal number of positive and negative evaluations. It is divided into three sets: unlabeled data, test data, and training data. Of the 41,758 ratings in the training set, 20,652 are positive, and 21,106 are negative. Of the 25,000 reviews in the test set, 12,500 are favorable, and 12,500 are negative. Before being used for analysis, the review data must undergo a preprocessing step to clean and prepare it for further processing. The following Table 2 represents the characteristics of the dataset, and Table 3 represents an example dataset.
Dataset characteristics

Table 2. Long description
A table with three rows and three columns. The columns are labeled No., Features, and Types. Row 1: No. 1, Features Tag review, Types Text. Row 2: No. 2, Features Comment review, Types Text. Row 3: No. 3, Features Rating, Types Numeric.
Example dataset

Table 3. Long description
The table has four rows and three columns. The columns are labeled Tag review, Comment review, and Rating. Row 1: Tag review, Amazing show; Comment review, This show truly lived up to the hype for me. The concept was intense and unflinching, and the ending was absolutely heartbreaking. My only minor complaint is that I started to lose a bit of interest during the final few episodes. Still, overall, I highly recommend it.; Rating, 8. Row 2: Tag review, I don’t get this; Comment review, I’m honestly not sure what’s all the hype about? As one could anticipate from gifted Korean actors and actresses, the performance is strong, but the plot didn’t strike me as anything particularly remarkable. Sure, there are a few twists here and there, but there are also too many plot holes for this to be considered a “classic” or a “masterpiece” in my opinion.; Rating, 6. Row 3: Tag review, Lame; Comment review, Acting: 3 out of 10. Story: 1 out of 10. Visuals: 6 out of 10. To be honest, it was like a mediocre 1980s Hollywood film. Makes me wonder—is the hype coming from Reddit or Achan again.; Rating, 2. Row 4: Tag review, Overhyped and boring; Comment review, I really don’t understand the hype around this show. The story felt boring and predictable, the VIP characters were poorly acted, and most of the other characters came off as irritating. As I mentioned earlier, I just can’t wrap my head around why this is so highly rated—an 8.3 feels incredibly generous.; Rating, 4.
3.2 Structured preprocessing technique
In preparing movie reviews for sentiment analysis, a structured preprocessing approach is essential to refine the dataset. This process begins with text cleaning to eliminate noise such as special characters, HTML tags, and irrelevant symbols. Language localization is then applied to ensure consistency across the dataset, followed by the removal of stop words to retain only the most informative content. Lemmatization is the practice of reducing words to their most simple or root form. Negation handling is also incorporated so that the semantic use of phrases such as “not good” is preserved. Low-frequency words are dropped using things like TF-IDF to ensure that the text has more meaningful words. The text is then broken down into smaller chunks for a more in-depth look at the text. Finally, Word2Vec embeddings are run on to convert the texts to meaningful numerical representations. Overall, this complete preprocessing pipeline provides a clean, systematic, and enriched semantic dataset for consistency in sentimental analysis.
3.2.1 Text cleaning
Text cleaning is an important practice in the world of NLP and text analysis. Text cleaning refers to the process of changing unstructured text into a more standardized and usable format through the removal or modification of unnecessary entities. By unnecessary entities, we typically mean special characters, HTML tags, punctuation, or other symbols that do not provide any meaningful content. For example, typical raw text from an IMDb review may contain special characters such as exclamation marks (!), emojis, or HTML tags, which should be cleaned to improve text quality and consistency. Text cleaning aims to standardize the text by removing noise and also irrelevant data so that the improved data can help a model’s performance and reduce computation time spent on the model. For example, the review “I LOVED this movie!! It was amazing!!1” would appear more as “I loved this movie it was amazing.” Once the unnecessary punctuation, HTML tags, and emoji are removed, and all text is made lowercase. This process enhances the data quality and allows ML models to focus on the content without interference from irrelevant considerations. There are multiple ways of cleaning up text (e.g., regular expression, NLP libraries, creating rules, or human intervention), but challenges can arise depending on the task, e.g., if context or sentiment can be determined by characters like an emoji. It is critical to evaluate the cleaning process based on the task needed and that only meaningful information is retained.
3.2.2 Language localization
Language localization (standardization) refers to the general process of taking multiple variants (such as British English and American English) of languages and converting them into standardized forms to create consistency in textual data. In this process, the size of overall vocabulary is decreased through standardizing words that have the same meaning but different spelling (e.g., “favourite” to “favorite”), and it makes the growth and efficacy of NLP models more effective. It enables NLP models to learn correctly by knowing different words are the same type of token rather than separate tokens. Generally, standardization is usually carried out using mapping dictionaries or language tools and is imperative for ensuring that there is linguistic consistency across sets of data.
3.2.3 Stopword removal
Stop word removal is taking away common words, or stop words, like “the,” “is,” and “was” that appear frequently in text but do not add substantially meaningful information. Removing stop words reduces noise and guarantees important stemming words are kept, which helps determining sentiment or meaning. Stop words are helpful at clarifying what the model is trying to do by consolidating their vocabulary and focusing on the primary structure typically removed. There are instances, such as “not,” where the stop word is kept if it alters the meaning of the sentence.
3.2.4 Lemmatization
Lemmatization (lemma) is the process of reducing words to their dictionary or base form using vocabulary and grammar rules. It helps group related words (e.g., “running” and “ran”) under a single form (“run”) while preserving meaning, improving model accuracy, and reducing redundancy.
3.2.5 Negation handling
Negation handling links negation words (like “not” and “don’t”) to the words they modify (e.g., “not good”) to preserve negative sentiment. This prevents misinterpretation, especially when stop words are removed, and ensures models accurately capture the intended meaning in tasks like sentiment analysis.
3.2.6 Term frequency–inverse document frequency (TF-IDF)
A statistical method called TF-IDF is used to evaluate a word’s significance in a single document in relation to how frequently it occurs in a corpus, which is a collection of documents (Dai et al., Reference Dai, Li, Luo, Zhao, Hong, Zhu and Liu2024). It combines two essential elements: IDF, which evaluates a word’s individuality or rarity across the corpus, and TF, which measures how often a term appears in a specific document. The TF-IDF value is calculated using the following mathematical expression:
Where
Here,
$|\textrm {D}|$
denotes the overall quantity of documents,
$|\{d\epsilon D\;:\;t\epsilon d\}|$
denotes the number of documents that include term t, and f(t,d) indicates how often the phrase “t” appears in document “d.” TF-IDF highlights terms that are more pertinent to a given text by giving phrases that occur often in a text but typically throughout the corpus greater scores.
3.2.7 Word embedding using word2Vec
A word embedding method based on neural networks is called Word2Vec, which uses a large text corpus for training to create vector representations of words (Johnson et al., Reference Johnson, Murty and Navakanth2024). It produces dense vectors that effectively record the semantic connections between words. The two main techniques used by Word2Vec are skip-gram and CBOW. The CBOW model aims to predict a target word based on its surrounding context words, whereas the skip-gram model forecasts context. The following expressions define the objective functions for each of these models:
Here,
$w_{t}$
denotes the target word, while
$w_{t-m},\ldots ,w_{t-1},w_{t+1},\ldots ,w_{t+m}$
signify the surrounding context-related terms. The subsequent word embeddings are dense vectors that effectively capture semantic linkages, with nearby vectors in the vector space representing words with similar meanings.
3.3 Tri-stream attention recurrent extractor
Traditional sentiment analysis models often fail to capture complex word relationships and long-range dependencies, leading to poor performance on texts with mixed or subtle sentiments. They struggle with feature utilization, vanishing gradients in long sequences, and inconsistent labeling. To address these limitations, the proposed TARE integrates stacked Bi-LSTM layers to understand word contexts in the past and the future, along with a MHA mechanism that highlights key sentiment-driving elements. This hierarchical and attention-based approach enhances contextual understanding and improves sentiment classification accuracy.
3.3.1 Stacked bidirectional LSTM
The typical design of the LSTM cell (Wang et al., Reference Wang, Qiao, Yan, Tang, Li and Ning2022), as depicted in Figure 2, is structured to effectively mitigate the vanishing gradient problem while enabling the efficient flow of important details throughout the LSTM network. Traditional Recurrent Neural Networks (RNNs) often struggle to learn long-term relationships between feature vectors as a result of the vanishing gradient issue during training [30]. To address this, the LSTM architecture introduces three key gates: the input gate
$(i_{t})$
, the forget gate
$(f_{t})$
, and the output gate
$(o_{t})$
, which collectively controls the flow of information through the activation vector for memory cells.
Forget gate: The purpose of this process is to decide how much data from the prior cell state
$c_{t-1}$
ought to be kept or eliminated, according to the prior hidden state
$h_{t-1}$
and the present input
$x_{t}$
. The forget gate produces an output ranging from 0 to 1, indicating the degree of information retention, and is mathematically represented by Equation (6).
Here,
$b_{f}$
represents the bias vector,
$w_{xf}$
signifies the weight matrix connecting the current input
$x_{t}$
to the forget gate
$f_{t}$
, and
$w_{xf}$
represents the matrix of weights linking the prior hidden state
$h_{t-1}$
to the forget gate
$f_{t}$
.
Structure of LSTM.

Input gate: This component establishes the amount of current input
$x_{t\ }$
that ought to become part of the cell state
$c_{t}$
. The behavior of the input gate is defined by Equation (7).
Here,
$b_{f}$
denotes the bias vector, the input
$x_{t}$
is connected to the input gate
$i_{t\ }$
by a weight matrix called
$w_{xi}$
and
$w_{hi}$
is the weight matrix linking the previous hidden state
$h_{t-1}$
to the input gate
$i_{t\ }$
.
Output Gate: This gate regulates how much information from the current cell state
$c_{t}$
is passed to the LSTM network through the output
$h_{t}$
. Each LSTM gate functions as a fully connected network, receiving a vector as input and producing a real-valued output. The output gate is defined by Equation (8).
Here,
$b_{f}$
signifies the bias vector,
$w_{xo}$
$x_{t}$
to the output gate
$O_{t}$
, and
$w_{ho}$
is the weight matrix linking the previous hidden state
$h_{t-1}$
to the output gate
$O_{t}$
.
The LSTM cell produces two final outputs: the cell state
$c_{t}$
and the hidden layer output
$h_{t}$
, which are represented by Equations (9) and (10), respectively.
The equation (11) for
${\widetilde {C}}_{t}$
, which represents the intermediate cell input state as
Structure of Bi-LSTM.

Here,
$b_{f}$
denotes the bias vector,
$w_{xc}$
represents the matrix of weights that relates the input
$x_{t}$
to the candidate cell state, and
${\widetilde {C}}_{t}$
and
$w_{hc}$
represent the matrix of weights that links the preceding hidden state
$h_{t-1}$
to the candidate cell state
${\widetilde {C}}_{t}$
.
LSTM networks are limited in their ability to get context from upcoming tokens on webpages. To address this, a Bidirectional LSTM (Bi-LSTM) layer is employed, comprising two independent LSTM layers that reverse the direction of input processing and contribute to a shared output (Graves et al., Reference Graves, Jaitly and Mohamed2013). Because of this framework, the model may take use of long-term dependencies from both past and future text contexts on web pages.
Two distinct LSTM layers, which analyze the input sequence in opposite directions—from the future to the past and from the past to the future—constitute a bi-LSTM network, as shown in Figure 3. Accurately interpreting sentiment in text requires the model to gather contextual information from both previous and subsequent words, which is made possible by bidirectional processing. Using the present input
$x_{t}$
and the previous hidden state
${\vec {h}}_{t-1}$
the forward LSTM computes the hidden state
${\vec {h}}_{t}$
as it processes the sequence from left to right. The word embeddings are the same for both the forward and backward LSTM parameters, despite their separation. At each time step t, the forward and backward hidden states are concatenated to create the final hidden state in the Bi-LSTM as defined in Equation (12).
For SA, a deep hierarchical model can significantly enhance performance (Wang et al., Reference Wang, Gan, Sun, Zhang, Lu and Kang2019). However, stacking BiLSTM layers proves to be particularly effective within shallow learning frameworks. Both local contextual cues and complex latent symmetrical patterns in text are captured by the suggested model using a layered BiLSTM architecture. In this setup, each lower BiLSTM output of one layer is sent to the subsequent layer as input, allowing the model to progressively extract richer and more abstract features relevant to sentiment understanding. The Figure 4 below demonstrates the architectural framework of the Stacked Bidirectional LSTM model.
Structure of stacked Bi-LSTM.

Figure 4. Long description
A diagram of the structure of stacked Bi-LSTM. The diagram shows the flow of data through multiple layers of a Bi-LSTM network. The input layer consists of a sequence of inputs labeled as X subscript t-1, X subscript t, and X subscript t+1. These inputs are fed into the first bidirectional LSTM layer, which contains multiple LSTM units processing the data in both forward and backward directions. The output from the first layer is then passed to the third bidirectional LSTM layer, which also processes the data in both forward and backward directions using LSTM units. Finally, the output layer receives the processed data and generates a sequence of outputs labeled as Y subscript t-1, Y subscript t, Y subscript t+1, and Y subscript t+2. The diagram illustrates the bidirectional flow of information through the LSTM layers, highlighting the interaction between forward and backward processing units.
3.3.2 Multi-head attention mechanism (MHA)
The MHA mechanism improves SA by allowing the method to concentrate on several key words and phrases at once, capturing diverse contextual cues and prioritizing key sentiment-driving components for improved accuracy and performance. Figure 5 shows the MHA mechanism’s structure.
In SA, traditional attention mechanisms fall short by capturing emotional cues from only a single representational level, limiting the model’s understanding of nuanced expressions. To address this, the MHA mechanism is employed, which applies the input feature matrix and undergoes several linear transformations. This enables the model to pick up sentiment-relevant patterns from various subspaces, enabling a more in-depth and diverse interpretation of the text’s emotional content.
Fundamentally, MHA is composed of several self-attention units, each designed to extract distinct sentiment cues. Three core matrices are used in each unit: the global feature vector matrix T, the query (Q), the key (K), and the value (V) are the results of a multi-channel CNN that captures significant sentiment-related textual features. According to Equation (12):
At the basis of the self-attention mechanism found in SA is the Scald Dot-product Attention (SDA). This method assists the model to assess how important each word is with respect to all the other words in a sentence, which is important to understand the emotional tone of the sentence and its contextual sentiment. The SDA function achieves this by calculating the measure of similarity using the dot product between the query (Q) and the key (K). The dot product indicates how much focus one word should have on another word. In order to avoid the outcome being too large and prevent the model from returning the result exploding, the number is divided by the square root of the dimensionality of the key to scale it down (
$\sqrt {dk}$
). The scaled values are passed through a Softmax function, which transforms them into a set of attention weights. The value matrix (V) is then weighted by these attention weights, leading to a weighted representation highlighting the most sentiment-related portions of the text. This process is formally defined in Equation (13):
\begin{align} SDA\left (Q,K,V\right )=SoftMax\left (\frac {{QK}^{T}}{\sqrt {d_{k}}}\right )V \end{align}
In SA, the MHA approach enhances the model sensitivity to different emotional cues by applying different linear transformations to Q, K, and V by three different sets of learnable parameters called
$W_{i}^{Q},W_{i}^{K},W_{i}^{V}$
for each attention head. The results of the linear transformations to Q, K, and V are then put into the SDA module. These transformed matrices are then fed into the Scaled Dot-Product Attention (SDA) module. Each head gains the ability to concentrate on certain sentiment-relevant elements of the input text, such as emotion-bearing words, negations, or context-specific polarity. The output from each head, denoted as
${head}_{i}$
, captures a unique perspective on the sentiment dynamics within the sequence, as shown in Equation (14):
The outputs from each attention head,
${head}_{1}\ to {head}_{h}$
, are concatenated to form a single matrix. This aggregated representation is then multiplied by a learnable weight matrix W to perform a final linear transformation. The result is the complete output of the MHA mechanism, as defined in Equation (17), where h denotes the number of attention heads involved.
Structure of the multi-head attention mechanism.

3.3.3 Residual-normalized GRU (ResNorm-GRU)
Following the attention layers, the ResNorm-GRU layer is integrated to refine the sequential representation. A GRU (Graves et al., Reference Graves, Jaitly and Mohamed2013) is a specialized architecture within the RNN family, developed to handle sequential data more efficiently. The accompanying figure demonstrates the internal structure of a GRU. Notably, GRUs differ from LSTM networks in several key ways: they use fewer parameters, which simplifies the training process, and they employ two distinct gates—the update gate
$Z_{t}$
and the reset gate
$r_{t}$
. GRU-based models face key challenges with long and complex sequences, including vanishing or exploding gradients that hinder long-range dependency learning, unstable gate activations causing inconsistent training, and performance degradation when stacking multiple layers. These issues limit the effectiveness and robustness of standard GRU architectures in sentiment analysis of lengthy, nuanced reviews. To address these limitations, a residual-normalized GRU (ResNorm-GRU) is introduced.
(i) Layer Normalization (LN):
Applied to the update gate, reset gate, and candidate hidden state. LN normalizes pre-activations, making the model less sensitive to weight initialization and ensuring stable gradient flow.
(ii) Residual Enhancement:
After computing the GRU hidden state, a shortcut connection adds the input
$x_{t}$
directly to the GRU output.
where
$P\left (x_{t}\right )$
is an identity mapping if dimensions match, or a linear projection if they differ.
After feature extraction, the next step involves using Conditional Random Fields (CRFs) to refine the predictions by modeling the dependencies between output labels and improving overall classification accuracy.
3.3.4 Attentive conditional random field (Attn-CRF)
Traditional CRF are widely used in sequence labeling tasks because they model dependencies between output labels. However, CRFs treat all input features equally, which limits performance when the input contains sentiment-driving words mixed with irrelevant terms.
To address this, the Attn-CRF is proposed. It integrates attention weighting into the CRF framework, utilizing CRF’s proficiency in modelling label dependencies while enabling the model to concentrate on more significant tokens.
(i) Attention Integration:
Attention weights
$({\alpha }_{t})$
are computed from hidden states
$h_{t}$
.
Where the score
$ (h_{t} )$
is computed using dot product or feedforward attention.
(ii) Weighted Features for CRF:
The attention weights refine the hidden states:
The weighted features are fed into the CRF layer.
(iii) CRF Sequence Modeling:
The CRF computes the conditional probability of a label sequence
$y=(y_{1},y_{2},\ldots ..,y_{T})$
given weighted features h:
\begin{align} P(y \mid \hat {h}) = \frac {\exp \left (\sum _{t}\psi (y_{t-1},y_t,\hat {h}_t)\right )} {\sum _{y'}\exp \left (\sum _{t}\psi (y'_{t-1},y'_t,\hat {h}_t)\right )} \end{align}
where
$\psi$
is the potential function that considers both unary scores and pairwise scores
(iv). Decoding:
The Viterbi algorithm with attention-weighted features is used to determine the most likely label sequence.
The following algorithm 1 represents the Attn-CRF.
Attentive conditional random field

Algorithm 1 Long description
An equation representing an algorithm for attentive conditional random field. The input is X, which is a sequence of elements X1, X2, up to XT. The output is Y star, which is a sequence of elements Y1, Y2, up to YT. The algorithm starts by encoding the input X into H. Then, for each time step t from 1 to T, it calculates an attention score based on the encoded value ht. Next, it applies a softmax function to the attention scores to get at. It then updates ht to get h hat t, which is a product of at and ht. Finally, for each time step t from 1 to T, it calculates unary scores for each label y in the label set, considering the previous label y prev. It then computes the potential as the sum of the unary score and the transition score. The Viterbi decoding is applied to the potential to get the final output Y star.
4. Result and discussion
This section provides the findings and discussion of the proposed SA system. It offers a thorough analysis of the system’s performance across various datasets, emphasizing its precision in polarity and intensity classification of sentiment. Additionally, this section includes a comparative analysis that evaluates the efficiency of the proposed model in comparison to existing state-of-the-art techniques or benchmark approaches. This comparison evaluates the model’s efficacy advantages and possible drawbacks, offering valuable insights into how well it performs in real-world sentimental analysis tasks.
4.1 System tools and configuration
In this work, sentimental analysis was performed using DL models implemented in Python 3.10. All development, training, and evaluation of the DL models were performed in a Jupyter notebook, which afforded an interactive, hands-on framework for processing and evaluating different hyperparameters for illustrative purposes. The implementation leveraged libraries for DL and ML that are common and highly used within the research community: Scikit-learn was used to preprocess the data, extract features, and evaluate performance; TensorFlow was used to create and train the neural network architecture. The experimentation was conducted on a computer that ran 64-bit window 10 with a 7th-generation Intel Core i7 CPU that operated at a base clock speed of 2.8 GHz. Given this hardware, there were sufficient computational resources to effectively read and process the training of DL models on text data. 20% of the dataset was reserved for testing, and the remaining 80% was used for training.
4.2 Hyperparameter configuration
The study has shown the importance of hyperparameter tuning in the efficiency of DL. Specifically, key parameters included learning rate, batch size, epochs, dropout rate, the embedding dimension, and LSTM units. All parameters were turned iteratively in conjunction with experimentation and validation while using the IMBb dataset. This section presented the parameter configuration chosen with the reasoning and the resulting performance of the proposed framework. The following Table 4 represents the hyperparameter configuration.
Hyperparameter configuration

Table 4. Long description
A table titled ‘Hyperparameter configuration’ with two columns: Tuning parameters and Value. The table has eight rows, each listing a different parameter and its corresponding value. Row 1: Learning rate, 0.001. Row 2: Dropout, 0.3. Row 3: Epochs, 100. Row 4: Optimizer, Adam. Row 5: LSTM unit, 64. Row 6: Activation, Tanh. Row 7: Loss, Binary cross entropy. Row 8: Batch size, 21.
4.3 Performance evaluation
The effectiveness of the proposed classification model for SA was evaluated using the popular metrics listed in Equations (22)–(25). During training, the model was optimized, and its overall accuracy was determined using the Adam optimizer. The evaluation metrics are defined as follows:
4.3.1 Cross-validation performance
To ensure the reliability of the stability of the proposed sentimental analysis framework, k-fold cross validation was employed. Cross-validation separates the dataset into k equal subsets as opposed to a single train-test split. One fold is used for testing, and the other k-1 folds for training in each round. To reduce the possibility of a biased evaluation brought on by a specific split, this process is repeated k times, and the final performance is reported as the average across all folds. This method provides a more robust estimate of the model’s generalization ability. The following Table 5 represents the 5-fold cross-validation evaluation.
5-fold cross validation

Table 5. Long description
A table with five rows and five columns comparing performance metrics across five folds. The columns are labeled Accuracy (percent), Precision (percent), Recall (percent), and F1-score (percent). The rows are labeled with fold numbers from 1 to 5. Row 1: Accuracy, 97.92 percent; Precision, 98.35 percent; Recall, 97.65 percent; F1-score, 98.00 percent. Row 2: Accuracy, 98.05 percent; Precision, 98.40 percent; Recall, 97.80 percent; F1-score, 98.10 percent. Row 3: Accuracy, 98.20 percent; Precision, 98.55 percent; Recall, 97.75 percent; F1-score, 98.15 percent. Row 4: Accuracy, 98.15 percent; Precision, 98.60 percent; Recall, 97.70 percent; F1-score, 98.12 percent. Row 5: Accuracy, 98.12 percent; Precision, 98.45 percent; Recall, 97.60 percent; F1-score, 98.05 percent.
To guarantee robustness and generalization beyond a single train-test split, the performance of the suggested model was further validated using 5-fold cross validation; the accuracy across all folds remained consistently above 97.9%, with precision and recall values demonstrating only minor variations. The mean accuracy was 98.09%, while the mean precision, recall, and F1-score were 98.47%, 97.70%, and 98.08%, correspondingly. These results highlight the approach’s stability and reliability, as indicated by the very low standard deviation across folds. The findings confirm that the proposed hierarchical attention framework consistently maintains high performance across different data splits, thereby proving its robustness, resistance to overfitting, and generalization capability on unseen data.
Training and validation accuracy of the proposed methodology.

Figure 6 above illustrates the accuracy of the suggested training and validation SA model over 36 epochs. As shown, effective learning is evidenced by the consistent improvement in training and validation accuracy during the initial epochs. Beginning at around 84%, the training accuracy progressively rises to a high of about 98% by the end of the period. Similarly, the validation accuracy starts at about 87% and stabilizes at approximately 96% toward the end of training.
Training and validation loss of the proposed methodology.

Figure 7 above demonstrates the loss in training and validation of the proposed sentiment analysis model over 36 epochs. The consistent decline in training and validation loss as the number of epochs increases demonstrates the model’s improving performance during training. By the last epoch, the training loss has smoothly decreased from its initial value of about 0.35 to about 0.05. Likewise, the validation loss exhibits strong generalization to unknown data, beginning at around 0.28 and decreasing to roughly 0.09. Table 6 displays the model’s overall performance metrics.
4.3.2 Confusion matrix
The confusion matrix is shown in Figure 8 above for the sentiment analysis model, illustrating its classification performance on the test dataset. The model correctly classified 4,925 negative samples as negative and 4,894 positive samples as positive. There were positive samples that were wrongly labeled as negative in 112 false negatives, while negative samples were mistakenly classified as positive in 69 false positives. The high percentage of correctly classified samples and the comparatively low number of misclassifications show how well the model separates positive and negative sentiments. The matrix also highlights the model’s slightly better performance on negative samples compared to positive ones.
Overall performance metrics

Table 6. Long description
A table with two columns and four rows. The columns are labeled Parameter and Values (percent). The rows are as follows: Row 1: Parameter, Accuracy; Values (percent), 98.09. Row 2: Parameter, Precision; Values (percent), 98.47. Row 3: Parameter, Recall; Values (percent), 97.70. Row 4: Parameter, F1-Score; Values (percent), 98.08.
Confusion matrix.

4.3.3 ROC curve
Figure 9 above presents the ROC curve for the SA model. When the TPR is shown against the FPR at different classification levels, the ROC curve shows how well the model can differentiate between positive and negative sentiment classes. With an impressive AUC score of 0.9839, the model demonstrates exceptional discriminative power. The method continuously maintains a high TPR with a low FPR, as evidenced by the curve’s close adherence to the plot’s upper-left corner. The high ROC performance demonstrates the model’s dependability and resilience in sentiment categorization tasks.
ROC curve.

4.4 Comparative analysis
This section presents a detailed comparison of the efficacy of the proposed methods in terms of performance against some well-known classification models conducted on the IMDb dataset. The tabular data provides a detailed breakdown of the variety of classification methods as they performed on the sentimental analysis task. The methods being compared included both traditional ML and DL algorithms, including Rahman et al. (Reference Rahman, Shiplu, Watanobe and Alam2024), Navie Bayes (NB), Logistic Regression (LR), Decision Trees (DT), K-Nearest Neighbors (KNN), AdaBoost, GRU, LSTM, BiLSTM, CNN-LSTM, and RoBERTa-BiLSTM. In this comparison, the proposed method has demonstrated remarkable performance on all metrics of evaluation and not only matches the competitor methods but also exceeds them, firmly establishing the proposed method as the most effective method for the task at hand. These results illustrate the effectiveness and robustness of the proposed methods, with accuracy and reliability of classification compared to other methods.
Accuracy comparison with existing classifiers.

Figure 10 presents the accuracy comparisons of several classification models using the IMDb dataset. The following models were examined: NB, LR, KNN, AdaBoost, GRU, LSTM, BiLSTM, CNN-LSTM, CNN-BiLSTM, displayed by NB of 87.07%, LR of 87.12%, DT of 7.46%, KNN of 77.37%, AdaBoost of 83.37%, GRU of 87.88%, LSTM of 85.11%, BiLSTM of 86.28%, CNN-LSTM of 88.60%, CNN-BiLSTM of 86.16%, and RoBERTa-BiLSTM of 92.36%. As noted, the proposed model outperformed all others with an accuracy of 98%. These results demonstrated the effectiveness, strength, and efficiency of the proposed method in providing high classification accuracy against traditional methods.
Precision comparison with existing classifiers.

The precision scores of several classification models are contrasted in Figure 11. The precision of the NB model is 87%, while the precision of the LR model is slightly higher at 90%. DT shows a significant drop to 74%, while KNN improves to 78%. AdaBoost reaches 83%, and the GRU model improves further to 88%. LSTM achieves 85%, and BiLSTM follows closely at 87%. Both CNN-LSTM and CNN-BiLSTM record a precision of 86%. The RoBERTa-BiLSTM model shows a strong performance with 92.46%. The highest precision is achieved by the proposed model at 98.47%, indicating its superior effectiveness over the other models.
Recall comparison with existing classifiers.

The recall performance of various models in terms of their accuracy in identifying pertinent instances is shown in Figure 12. The NB model achieves a recall of 87%, with LR slightly higher at 90%. DT performs the weakest among all with 73%. KNN scores 77%, while AdaBoost improves recall to 83%. GRU achieves 88%, indicating strong recall performance. LSTM records 85%, followed by BiLSTM, CNN-LSTM, and CNN-BiLSTM—all tied at 86%. RoBERTa-BiLSTM shows a significantly better recall of 92.36%, while the proposed model outperforms all others with a recall of 97.70%, demonstrating its robustness in retrieving relevant data instances.
F1-score comparison with existing classifiers.

The F1-score comparison is represented in Figure 13. It highlights the harmonic balance between precision and recall for various models. NB achieves an F1-score of 87%, and LR follows slightly ahead at 90%. DT lags significantly at 73%, indicating poor balance between precision and recall. KNN performs modestly with 77%, while AdaBoost improves the score to 83%. GRU delivers a strong performance at 88%, whereas LSTM settles at 85%. BiLSTM, CNN-LSTM, and CNN-BiLSTM each maintain a consistent F1-score of 86%. RoBERTa-BiLSTM performs very well with an F1-score of 92.35%, but the proposed model surpasses all, achieving the highest F1-score of 98.08%, signifying its overall superior classification performance across metrics. The following, Table 7, represents the overall comparison for the proposed methodology.
4.5 Ablation study
To evaluate the contribution of each element in the suggested SA framework, a series of ablation experiments were carried out on the IMDb dataset. The experiments systematically removed or modified key components in both the preprocessing and classification stages to measure their individual impact on overall performance. The following, Table 8, represents the ablation experiment.
The ablation results clearly demonstrate that each component of the proposed framework—advanced preprocessing, stacked Bi-LSTM, multi-head attention, GRU layer, and CRFs—contributes incrementally and significantly to the overall performance. The full framework consistently outperforms its simplified versions, confirming the effectiveness of the integrated design.
4.6 Discussion
The superiority of the proposed HASN over traditional ML models like NB (87.01%), LR (87.12%), and DT (73.46%), as well as deep learning baselines including GRU (87.88%), LSTM (85.11%), BiLSTM (86.28%), CNN-LSTM (88.60%), and CNN-BiLSTM (86.16%). Even the strong transformer-based hybrid, RoBERTa-BiLSTM, achieved only 92.36% accuracy, which is considerably lower than the 98.09% accuracy of the proposed model. Similar trends were observed across other performance metrics, with HASN attaining the highest precision (98.47%), recall (97.70%), and F1-score (98.08%). These outcomes distinguish the suggested method from both traditional and cutting-edge baselines by confirming its efficacy and robustness. The incremental contribution of each element in the HASN framework is further validated by the ablation study. The baseline Bi-LSTM without preprocessing and attention achieved only 87.20% accuracy, indicating the limited capacity of simple recurrent models to capture nuanced sentiments. Incorporating the structured preprocessing pipeline alone boosted accuracy to 91.65%, underscoring the importance of noise reduction, negation handling, and semantic consistency. Adding stacked Bi-LSTMs with preprocessing improved performance to 94.50%, while the integration of multi-head attention raised accuracy further to 96.85%, demonstrating the benefit of highlighting sentiment-driving tokens. The inclusion of the ResNorm-GRU layer enhanced temporal refinement, yielding 97.55% accuracy. Finally, the Attentive CRF layer delivered the highest accuracy of 98.09%, ensuring coherent label predictions through sequence dependency modeling. Overall, both the comparative and ablation studies provide strong evidence that the combination of advanced preprocessing, hierarchical recurrent networks, attention mechanisms, ResNorm-GRU refinement, and Attn-CRF classification enables HASN to attain state-of-the-art performance on SA tasks. The results also highlight that no single component alone could achieve such performance; instead, it is the synergistic integration of these modules that ensures both accuracy and stability.
Overall comparison for proposed methodology

Table 7. Long description
A table comparing the performance of various models using accuracy, precision, recall, and F1-score metrics. The table has 12 rows and 5 columns. The columns are labeled Models, Accuracy (%), Precision (%), Recall (%), and F1-score (%). The rows list different models and their corresponding performance metrics. Row 1: NB, 87.01, 87.00, 87.00, 87.00. Row 2: LR, 87.12, 90.00, 90.00, 90.00. Row 3: DT, 73.46, 74.00, 73.00, 73.00. Row 4: KNN, 77.37, 78.00, 77.00, 77.00. Row 5: AdaBoost, 83.37, 83.00, 83.00, 83.00. Row 6: GRU, 87.88, 88.00, 88.00, 88.00. Row 7: LSTM, 85.11, 85.00, 85.00, 85.00. Row 8: BiLSTM, 86.28, 87.00, 86.00, 86.00. Row 9: CNN-LSTM, 88.60, 86.00, 86.00, 86.00. Row 10: CNN-BiLSTM, 86.16, 86.00, 86.00, 86.00. Row 11: RoBERTa-BiLSTM, 92.36, 92.46, 92.36, 92.35. Row 12: Proposed, 98.09, 98.47, 97.70, 98.08.
Ablation Experiment

Table 8. Long description
The table evaluates each configuration based on Accuracy (%), Precision (%), Recall (%), and F1-score (%). The performance progressively improves with each added component, culminating in the highest scores for the full model.
5. Conclusion
This study introduces the HASN, a new, two-phase framework created to overcome the shortcomings of conventional sentiment analysis models in the interpretation of movie reviews. In the first stage, a structured preprocessing pipeline ensures semantic consistency through text cleaning, lemmatization, stop-word removal, negation preservation, TF-IDF-based filtering, and Word2Vec embeddings. In the second stage, the TARE integrates stacked Bi-LSTMs, multi-head attention, and a residual-normalized GRU (ResNorm-GRU) to capture both syntactic and semantic dependencies. For classification, the attentive conditional random field (Attn-CRF) enhances sequence coherence by combining attention weighting with label transition modeling. Experimental evaluation on the IMDb dataset demonstrates the superiority of HASN, attaining a 98.08% F1-score, 98.47% precision, 97.70% recall, and 98.09% accuracy. These consequences highlight the framework’s robustness, scalability, and interpretability, making it well-suited for real-world applications like audience feedback analysis, personalized marketing, and investment decision-making in the film industry. Future research will focus on extending HASN to multilingual and cross-domain sentiment analysis, as well as integrating transformer-based architectures like BERT and RoBERTa to further improve contextual understanding and adaptability across diverse linguistic and application scenarios.





















