Linguistic Encapsulation and Semantic Amalgamation based Sentiment Polarity Analysis Using Patient Reviews
Журнал: International Journal of Modern Education and Computer Science @ijmecs
Статья в выпуске: 5 vol.18, 2026 года.
Бесплатный доступ
Sentiment analysis of medication evaluations uses Natural Language Processing (NLP) techniques to analyze users' thoughts and feelings about medications (treatments) they have received, helping evaluate the effectiveness of therapy. Machine learning aids in evaluating medication effectiveness; however, it has limitations due to the context-dependent nature of medication-related sentiment. Even though deep learning provides a better ability to capture nuances in language, deep learning models will require larger datasets and considerable computational resources. A Hybrid Bidirectional Gated Recurrent Unit-Convolutional Neural Network (Bi-GRU-CNN) is proposed for sentiment analysis of medication evaluations to address these shortcomings. The evaluation of medicines from patients involved collecting reviews and compiling them into a structured dataset as the first step. The process uses various methods to preprocess the reviews, including lowercasing, stop-word removal, and punctuation removal. SentiWordNet is used to assign sentiment polarity to reviews after they have been pre-processed, classifying them as neutral, negative, or positive. The attention-based Bidirectional Long Short-Term Memory (Bi-LSTM) model is then applied for part-of-speech tagging to extract semantic information, and a dependency tree parser that uses Global Vectors for Word Representation (GloVe) to extract syntactic information. Bidirectional Encoder Representations from Transformers (BERT) are then used to fuse the two features into a single representation. A hybrid BiGRU-CNN model is then used to classify sentiment and accurately predict the polarity of drug reviews. The CNN layer captures many local patterns, and the BiGRU layer processes sequential dependencies in both directions. The features are combined and utilized in a series of dense layers to create classifications. The proposed method achieved an overall Accuracy of 97.50%, a False Omission Rate of 4.30%, and a selectivity of 94.20% in sentiment analysis of drug reviews. The proposed method improves contextual understanding and feature extraction for a more granular understanding of sentiment.
Короткий адрес: https://sciup.org/15020689
IDS: 15020689 | DOI: 10.5815/ijmecs.2026.05.07
Текст научной статьи Linguistic Encapsulation and Semantic Amalgamation based Sentiment Polarity Analysis Using Patient Reviews
Drug patient reviews describe impressions or input from individuals' experiences with medication use, including effectiveness, side effects, and satisfaction. Patient reviews provide insight into what users think and how this may inform medical decision-making [1]. Sentiment polarity will assess opinions from user-generated feedback on medications. It is meant to assess opinions on words while using the context of opinions as a unified component [2]. This can be seen in natural language processing, multimodal learning, and knowledge graph synthesis, where the aim is to increase dimensionality to improve understanding, reasoning, and decision-making across domains [3]. However, it may struggle with complex or unclear sentiments that are present, leading to possible information inaccuracies.
Drug patient reviews describe impressions or input from individuals' experiences with medication use, including
This work is open access and licensed under the Creative Commons CC BY 4.0 License.
effectiveness, side effects, and satisfaction. Patient reviews provide insight into what users think and how this may inform medical decision-making [1]. Sentiment polarity will assess opinions from user-generated feedback on medications. It is meant to assess opinions on words while using the context of opinions as a unified component [2]. This can be seen in natural language processing, multimodal learning, and knowledge graph synthesis, where the aim is to increase dimensionality to improve understanding, reasoning, and decision-making across domains [3]. However, it may struggle with complex or unclear sentiments, leading to potential inaccuracies.
Sentiment polarity analysis using patient reviews brings some challenges. Sentiment analysis can lead to discrepancies because sentiment is subjective and requires significant time when analyzing large datasets [4]. As data volume increases, reviewing data for analysis becomes untenable. There may also be errors due to neglect, ignoring bias, or revealing bias, and all of these errors reduce the quality of the results. Even when sentiment analysis can capture subtle contextual nuances, it is usually incomplete or unrepresentative [5]. Because of the many challenges associated with manual approaches, machine learning is better suited for effective analysis of patient reviews. High-dimensional feature spaces pose serious challenges for distance-based machine learning techniques such as K-Nearest Neighbors (KNN). Artificial Neural Networks (ANNs) can learn from data, but may not generalize well to subtle semantic contextual understanding. Extreme Gradient Boosting (XGBoost) has proven effective. However, it has limitations in dealing with semantic nuance and semantic composite complexities. Random Forests handle non-linearities fairly well but are generally poor at identifying subtle differences or nuances in polarity, especially in high-density semantic contexts [6]. Each machine learning technique has limitations, and the field often requires deep learning and other approaches to overcome them.
Deep learning is a type of machine learning that uses neural networks with many layers to learn complicated patterns in data. It has been highly successful in a variety of fields, such as image classification, natural language understanding, and speech processing, meaning it learns many relevant features from "raw" input data [7]. Emotion polarity detection from the semantic combination of patient reviews will pose unique challenges for deep learning models, which already face a shortage of contextual information for Deep Neural Networks (DNNs) [8]. Recurrent Neural Networks (RNNs) struggle with vanishing gradients and remembering long-term dependencies in long reviews, and while Long short-term memory (LSTM) may be capable of long-term memory, it usually has an overwhelming computational load and tends to overfit on large datasets [9]. Although Convolutional Neural Networks (CNNs) have been effectively used for local feature detection, they may miss key semantic relationships across sentences, which limits their understanding of multi-faceted sentiment transitions. This play on local and global features illustrates the need to understand model weaknesses and to address performance in sentiment analysis tasks [10]. To address these weaknesses, the proposed approach combines BERT and BiGRU-CNN, leveraging their respective strengths to accurately capture semantic and syntactic features. Ultimately, this will improve the analysis of sentiment polarity in relation to contextual disparities, long dependencies, and subtle transitions in polarity.
Major contributions of the work are given below:
• Existing models, such as LSTM, BiLSTM, and CNN, are often unable to encompass both contextual and subtler inter-token dependencies. To overcome these limitations, a hybrid deep-learning model based on BERT was proposed to analyze drug reviews, thereby improving contextual comprehension and sentiment prediction.
• The data is collected and preprocessed in an effort to support the categorization and ultimately improve the analysis of patient drug reviews.
• SentiWordNet is utilized for semantic sentiment alignment to enable accurate polarity analysis.
• Syntactic features are extracted using Dependency Tree Parsing with GloVe, and semantic features are obtained via POS tagging with a Bi-LSTM, for enhanced representation.
• BERT ensures contextual understanding and semantic cohesion by aligning features with its bidirectional architecture for rich, accurate representations.
• Together, these models form a powerful, context-sensitive system and a high-performance framework for sentiment analysis of drug reviews in a fine-grained and trustworthy manner.
2. Literature Survey
The remainder of this paper is arranged as follows: The second section examines numerous publications that effectively use machine learning and deep learning techniques for sentiment analysis of medication evaluations. The proposed approach for creating Semantic Amalgamation-Based Sentiment Polarity Analysis Using Patient Reviews is described in Section 3. The results of a proposed strategy are shown in Section 4. The findings of the study are presented in Section 5.
Machine learning and deep learning algorithms are used in various ways to analyse sentiment in medication evaluations. Below are a discussion and explanation of a few of these detection techniques.
Grissette and Nfaoui [11] have developed an LSTM-BiLSTM model that uses neural networks and sentiment analysis to encode patient narratives. The model uses neural networks and sentiment computing to create an emotional, biological concept-based encoding. By combining label propagation from an extensive biomedical vocabulary with online patient narratives to define, normalize, and synthesize medical entities, the method creates a biomedical embedding. General matching based on biological criteria served as the basis for selecting drug reaction samples. These characteristics facilitate the use of an extreme learning machine for emotional semantics and sentics recognition. The result achieved 87.5% accuracy. In biological sentiment analysis, comparisons show that the model outperforms emotional lexicons.
Grissette and Nfaoui [12] have developed neural networks with deep associative memory for biomedical sentiment analysis of extensive patient narratives. To improve sentiment decomposition by emphasizing biological items and contextual semantic relationships, a deep associative memory was incorporated into neural networks. This method uses distributed representations of formal medical connections from biomedical sources to handle invisible medical patterns and efficiently extract data-object attributes. The model's capacity to produce meaningful embeddings and identify complex medical patterns was demonstrated through experiments on a biomedical sentiment analysis task. With an average performance of 87%, the proven approach demonstrated its efficacy on a variety of large datasets.
Han et al. [13] proposed a Double BiGRU-based pretraining and multitask learning model (PM-DBiGRU) for aspect-level sentiment analysis in drug reviews. For initialization, the PM-DBiGRU model used pretrained weights from a brief text-level medication review sentiment categorization task. Target-specific representations are captured by an attention mechanism, and two BiGRU networks provide bidirectional semantic representations for the target and medication review. Short text-level medication review data were used to convey domain knowledge via multi-task learning. For aspect-level medication review sentiment categorization, where reviews may contain numerous targets, a new dataset called SentiDrugs was also released. Results from experiments on SentiDrugs demonstrate that PM-DBiGRU outperforms state-of-the-art models in this task, with an accuracy of 78.26%.
Ahmed et al. [14] proposed an embedded medication recommendation system based on Long Short-Term Memory (LSTM) networks. It presented a drug recommendation system with a heterogeneous network incorporated that categorizes user feelings according to reviews, medical conditions, drug ratings, and use dates. The framework consists of an LSTM-based classification model, preprocessing, and data exploration. Data exploration involves preparing and analyzing data using statistical methods and visualization. The LSTM model improves the efficacy of recommendations by processing sequential data and including feedback connections for long-term forecasts. The algorithm enhances the quality of recommendations by forecasting fresh user ratings based on current ones. With a 92% classification accuracy, the algorithm showed promise for medication recommendation tasks.
Nayak et al. [15] have demonstrated a multinomial naive Bayes classifier, a support vector machine, an extra tree classifier, and a decision tree classifier for a disease prediction and drug recommendation prototype, utilizing a variety of techniques. It tackles the difficulty of learning from diagnosis case data produced by hospital information systems (HIS). By entering symptoms, patients may rapidly determine potential diseases and appropriate drugs. Multinomial Naive Bayes, Extra Tree Classifier, Decision Tree Classifier, and Support Vector Machine are used to forecast illnesses and offer drug recommendations based on ratings and conditions. Reviews are analyzed with sentiment analysis using the Vader tool and NLP, and pharmaceutical recommendations are made using weighted-average and probabilistic approaches. The four classifiers showed promise for a range of medical applications with an accuracy of 86.84%.
2.1. Research Gap
3. Proposed Methodology3.1. Preprocessing
3.1.1. Lower Casing
Based on the reviews mentioned above, several existing models designed for sentiment polarity analysis using patient drug reviews have specific drawbacks; for example, they may face challenges in identifying implicit relationships between medical terms, particularly when patient narratives contain idiomatic expressions or unconventional phrasing [11]. Moreover, predefined vocabulary-based label propagation may limit the model's ability to adapt to dynamic shifts in terminology driven by advances in medical knowledge [12]. Additionally, using zero-shot classification for initial labelling may reduce robustness, especially when confronted with highly subjective or contradictory information in biomedical reviews [13]. Furthermore, dilated convolution might introduce artifacts in feature extraction, leading to misinterpretation of critical elements in highly contextual social media data [14]. Moreover, the model's reliance on pre-training on short, text-level datasets may hinder its ability to extract intricate patterns from extended medical reviews that encompass multiple related aspects [15]. To address the limitations, a BiGRU-CNN model based on BERT is developed for sentiment analysis of drug reviews, incorporating domainspecific adaptation through fine-tuning on larger, more diverse medical corpora to improve contextual understanding. Additionally, enhancing the model with attention mechanisms can better capture nuanced relationships and reduce the impact of idiomatic expressions.
Insights from drug reviews inform pharmaceutical companies about improvements in drug formulations, packaging, and dosage instructions, fostering innovation and better patient outcomes. This approach promotes safer healthcare practices and enhances patient safety. The BiGRU-CNN model is used to create a BERT-based model for sentiment analysis of medication evaluations to overcome these difficulties. The sentiment analysis process for patient reviews is shown in Figure 1.
Fig. 1. Architecture of the proposed sentiment analysis on patient reviews.
The model creates a structured dataset by collecting and organizing patient medication reviews. The reviews are first gathered and then preprocessed using techniques such as lowercasing, stop-word removal, and punctuation deletion to eliminate extraneous words, symbols, and punctuation. SentiWordNet is employed to determine the initial sentiment polarity of the cleaned reviews, thereby distinguishing among positive, negative, and neutral tones. Syntactic and semantic feature extraction techniques are then applied to these reviews. Dependency tree parsing using GloVe is employed to extract syntactic features, such as dependency relations, while part-of-speech tagging with an attentionbased Bi-LSTM model captures semantic information, including relations between entities and roles. BERT is used to align both aspects syntactically and semantically for a unified representation of the text. To classify the extracted features and sentiment polarity, the BiGRU-CNN model is used to predict sentiment accurately.
Preprocessing may include cleaning and standardizing text, specifying which noise to remove, removing irrelevant components such as punctuation and stop words, and ensuring uniformity via case conversion. The preprocessing phase involves the refinement of a text and involves stripping away components irrelevant to its nature - punctuation, stop words, and so on, as well as standardizing that text into a homogenous case. This then allows the language being analyzed to be properly termed text for the purposes of analysis, feature extraction, and sentiment analysis.
All special characters are removed, leaving only useful text in lowercase. The next step is to convert all uppercase letters to lowercase letters in every word [16]. This is helpful to reduce dimensionality. It eliminates differences based on the case. For example, "Aspirin" and "aspirin" are considered the same word. This will also help with the analytic process. More consistent data and analysis are valuable. Standardization of terms is easier with data standardized through lowercasing. This is also helpful for more effective use of the study when analysing patient notes with sentiment analysis.
-
3.1.2. Stop Word Removal
-
3.1.3. Punctuation
-
3.2. SentiWordNet
-
3.3. Syntactic Feature
-
3.3.1. Dependency Tree Parsing using GloVe
-
3.4. Semantic Features
-
3.4.1. Parts of Speech (POS) Tag Using Attention based BiLSTM
Stop-words are frequent, common words in review text that add little value to the analysis (for example: a, an, the, in, on, she, it, your). They are frequently removed because they do not provide useful insight into the review's sentiment or content. Stop-words are also language-specific, which are specific to the language of the reviews you are analysing. By removing the extraneous words, the analysis can be limited to the more meaningful words in the review. Removing stop words will improve the focus of your analysis and will make the classification of reviews faster and more accurate.
In identifying intense emotion in patient drug reviews, such as urgency or anger, punctuation is very often used as a marker, as in, "This medication is awful!" Although humans possess an inherent understanding of emotion, machines may not be able to convey the intensity of these sentiments [17]. However, in many text-mining tasks, including sentiment analysis, punctuation is often stripped from text to facilitate analysis, which can lead to the loss of emotional nuance. For example, changing the "!!!" to a category like "multiexclamation" will accommodate sentiment. However, in sentiment analysis, if the method repurposes the labels too, it does not keep punctuation at all, which would lose many important aspects of emotion, such as urgency in a review about the effects of a drug.
SentiWordNet is a lexical resource that ranks words with sentiment scores, in reference to their level of positivity, negativity, or objectivity. In the context of patient drug reviews, SentiWordNet was considered useful for analyzing them, as it identifies the sentiment of individual words that can be contextualized within the related review. Employing SentiWordNet provided sentiment scores for patient drug reviews by examining parts of speech (POS) and individual synsets for potentially positive, negative, and objective scores [18]. The model combines BERT-generated contextual embeddings with lexicon-based information, using the latter as directional signals rather than unconditional sentiment labels. This approach retains the flexibility of an end-to-end BiGRU-CNN workflow, allowing context sensitivity to be learnt from raw text while also benefiting from the context sensitivity of semantic clues provided by the lexicon. By using SentiWordNet in this way, the model avoids the bias and noise introduced by the direct application of static lexical scores, thereby making more precise and detailed sentiment predictions for medication reviews.
Syntactic features are the structural features that highlight grammatical relationships of words (typically, word order or dependency relationships). They are useful for analyzing sentence structure and word relationships to determine contextual meaning. When retrieved with GloVe and dependency tree parsing, syntactic features can inform sentence construction as they relate to words. The syntactic feature extraction will allow the model to deepen its understanding of grammar and context when analyzing drug reviews. The extraction of syntactic features works alongside the extraction of semantic features and contributes to accurate sentiment analysis by developing an understanding of word relationships and prior contextual meaning.
Dependency tree parsing analyzes the structural properties of sentences by analyzing the dependencies of words, where words are nodes and relationships are edges in the Dependency tree. In the case of patient drug reviews, transition-based parsers are a good way to perform sentiment analysis by constructing syntactic structures from transitions the parser predicts [19]. Transition-based parsers also improved the accuracy of sentiment prediction by utilizing important syntactic parameters, afforded real-time analysis, and helped explain how sentences were constructed in the analysis. Similarly, GloVe builds on sentiment analysis of patient-drug reviews, incorporating syntactic meaning and structure. GloVe provides an analysis of the semantic meaning of drug reviews by using wordembedding techniques based on global and local co-occurrences of each word, offering insight into the associated meanings of words and their sentiment [20]. GloVe allows a more accurate understanding and analysis of sentiment in patient drug reviews.
The extracted semantic features describe the meanings of, and relationships between, entities and roles in text, providing contextual information useful for sentiment tasks. The semantic features, such as relationships between entities and roles, can be extracted from the text using part-of-speech tagging and an attention-based Bi-LSTM. These features enable a contextual understanding of relationships among reviews, which could improve sentiment prediction.
The Parts of Speech (POS) system classifies words into nouns, verbs, adjectives, and adverbs according to their roles in sentences [21]. A weighted sum of all hidden states is computed as part of the soft-attention mechanism commonly employed in BiLSTM. The significance of each word in the sequence to the task at hand is the basis for continuously determining the weights. This is often achieved by combining hidden states into a context vector, which enables the model to focus on the most important parts of the input sequence.
Let the input vector representation of BiLSTM be C = [ C1, C2 ■■■ TT], where Ct represents the input at the time step . e Each LSTM unit has a set of internal gates: input, forget, and output gates controlled by learned parameters. The gates regulate the flow of information through the cell, updating the memory cell and hidden state at each time step based on the current input and the previous state, as shown below in eqns (1), (2), and (3).
it = c(w [whect]+bJ(1)
ft = ^(Wf [Wht _ 1,ct]+b i)(2)
ht = Ottanh(nt)(3)
Where, tt denotes the hidden layer, ft represents the forgotten gate, ht is the memory gate, ot denotes the output gate, tanh represents the hyperbolic tangent function, о is the sigmoid function, bd denotes the bias vector, w is the model parameter, ct represents the current input, Wh is the weight matrix, nd denotes the cell state.
-
3.5. Bert Alignment
-
3.6. Classification
-
3.6.1. Bi-GRU
BERT alignment reflects the contextual relationships between words, thereby allowing syntactic and semantic properties to be combined into a single feature representation. In both local and global contexts, it leverages BERT's bidirectional attention mechanism to capture word dependencies. This alignment ensures a richer, more specific representation, improving sentiment predictions for the resulting features.
The BERT (Bidirectional Encoder Representations from Transformers) deep learning model uses a bidirectional transformer architecture and understands words in context - using the surrounding text can help to analyze and understand the context of the words [22]. BERT has been helpful for many natural language processing tasks, including text classification, sentiment analysis, and question answering, due to its remarkable ability to model syntactic and semantic relationships, as shown below in Eqn. (4) and (5)
hl = LNhh1 ~ 1 + MHAtt(hl -1)) (4)
hl = LNhh1 + FFN^h1}) (5)
Where, I indicates the layer's depth, LN symbolizes the layer norm, HAAtt is the multi-head attention, FNN denotes the feed-forward network, h denotes the hidden encoding.
The classification is to categorize the data into a limited number of predefined groups or labels based on the attributes of the incoming data, grouping it as it arrives. The BiGRU-CNN model classifies sequences of syntactic and semantic data that are aligned, and classifies the data using the BiGRU layer to identify the sequence of features in two directions both backward and forward to include long range dependencies and context of the data, and the CNN layer is used to extract local patterns that are captured into the extracted features by extracting the key n-grams or word pairs. Then the CNN features and BiGRU outputs are fused to recognize temporal sequential and local features in the data. The fused features are then extracted from the sequential context and passed through the dense layers for final classification, and the model is compiled and trained to predict both sentiment/class and the drug category of the reviews. The hybrid classification method captures localized features while maintaining global context, improving the accuracy of drug reviews.
Bidirectional Gated Recurrent Units (Bi-GRU) are a type of recurrent neural network that facilitates sentiment analysis by leveraging relationships in text across both past and future contexts [23]. Bi-GRU examines word sequences from both upstream and downstream perspectives, aiding context understanding and helping identify patients' moods in their medication reviews. Bi-GRU uses both the forward and backward reads of the reviews to help work through the complex emotions they indicate. Two GRUs would not overfit the Bi-GRU, but instead indicate that, for the current time step, components of the reset gate are moderated by the combination of the incoming input with the previous HIDDEN state and influences next hidden state HIDDENt-1, which accounts for the incoming text or feedback from patients about their medications, as represented in Eqn. (6).
^ =j;wJh._?^|) (6)
Where, denotes the gate state, is the function of the sigmoid, represents the weights of the reset gate, h represents the state in hidden, reflects the present inputs.
This is expressed in Eqn. (7), where the gate regulates memory retention for accurate state updates.
Щ = O(Wu.[h(t_ i ),Xt]) (7)
Where, ut represents the update gate, о indicates the function of the sigmoid and wu is the update gate's weights.
The update gate influences the mixing of the candidate hidden state and the preceding hidden state to update the current hidden state. This enables the model to preserve significant historical data while adding pertinent new data, as seen in Eqn. (8) below.
ℎ t =(1- щ )ℎt-1 + щ ⨂ℎ´ t
Where, ℎ t is the current hidden state, (1- ^t )ℎt-1 indicates that the concealed state from the preceding moment has been selectively forgotten, lij ⨂ℎ t represents the selective memory of the hidden state, ℎ´ t is the candidate's hidden state at time step t .
-
3.6.2. CNN
Sentiment analysis of patient drug reviews using Convolutional Neural Networks is a classification approach that analyzes and categorizes sentiments, extracting and learning textual patterns to classify the sentiment (e.g., positive, neutral, or negative) in patient feedback about medications [24]. This approach identifies key phrases and emotions, enabling insights into patient experiences and medication effectiveness.
The three main layers of a CNN are convolution, pooling, and fully linked. While fully connected layers classify the input, convolutional and pooling layers extract key features. Two CNN models were created for binary and multiclass classification to analyze sentiment in medication reviews. The convolutional layer is essential for sentiment analysis of medication reviews, as it helps extract significant features from the text.
Filters (kernels) are applied to the text after it is converted into a matrix form, capturing key patterns such as sentiment-indicating words and phrases. The convolution operation helps identify contextual features that contribute to sentiment classification. These extracted features are then used by subsequent layers to classify the reviews into positive, negative, or neutral categories, as shown below in Eqn. (9)
M at ,i
+b m=l
Where, , indicates the corresponding activation, f denotes the non-linear function, , is the m × n Convolution kernel weight matrix, , symbolizes that the higher neurons attached to the cell are activated ( i , j ), b represents the bias value.
The activation function used to add non-linearity to the model is Leaky ReLU. When the input is negative, Leaky ReLU permits a small, non-zero gradient, unlike the standard ReLU. This makes it a good fit for the model's layers, as indicated below in Eqn. (10), as it helps avoid problems like dead neurons.
a ( x ) = max(0, x )
Where, (J ( X ) represents the ReLU activation function, X denotes the input value.
To increase model efficiency while retaining critical information, the pooling layer reduces feature map sizes. There are several pooling techniques, including sum, max, and average pooling. Max-pooling was employed in this investigation, choosing the biggest element as the output from each feature map region.
The fully connected layer performs classification by converting the extracted features into a one-dimensional vector. It consists of interconnected neurons and uses non-linear activation functions such as ReLU or Leaky ReLU. For binary classification, a sigmoid function is used, while softmax is applied for multiclass classification, as shown below in Eqn. (11)
eai
softmax ( X[ )= к---- ∑ i~ i s"1
Where, softmax ( xi ) represents a fully connected layer in the softmax, a is the output vector of the fully connected layer, к represents the number of classes, щ denotes the j - t ℎ value of the output vector.
The BERT-CNN-BiGRU sentiment classification model is shown in Figure 2. The input text is [CLS]+S+[SEP]+A+[SEP], where S denotes the sentence or review, and A shows the target aspect, while = { Wj_ , W2,…wn }, and A={wf , w“,…wn }. This sequence is subsequently fed into the BERT embedding layer, which produces contextualized representations that capture both syntactic and semantic information. The resulting embeddings are then passed through a CNN layer with a Rectified Linear Unit (ReLU) activation to identify salient local n-gram features, and a max-pooling layer is used to downsample the feature maps and retain the most salient patterns. These features are supplied to a Bidirectional Gated Recurrent Unit (BiGRU) layer, in which forward and backward GRU units model long‑range dependencies in both prior and future contexts. Finally, the model is used to classify sentiments by making an argument for one of the three classes: positive, neutral, or negative. Algorithm 1 explains the pseudo-code for sentiment analysis on drug reviews
Positive Neutral Negative
Fully Connected Layer
Л
। BiGRULa)'er )
itiwoodoo)• ••..........T......о о O O’)
Forward GUI Unit Backward GRU Unit
/ C N NLayer \
Convolutional +Relu
Extra Local Patterns ?
.__________1.
' Max Pooling Layer '
Downsamples important Features .
BERT Layer
7)oooooooj
( OQQOOOOQQQOQO)
BERT Embedding (Syntactic +Semantic Features) j
ICLS1+S+ISEP1+A+ISEP]
S=lw'',,^!..»',„}
Fig. 2. Flow diagram of the Classification.
Algorithm 1. Pseudo-code for sentiment analysis on drug reviews
Input: Patient drug reviews (TD)
-
# Text Processing
{
ER = Preprocess (TD) // Perform Lowercasing, stop word removal, and punctuation elimination to clean the reviews, making them ready for sentiment analysis.
}
-
# Sentiment Polarity
{
DF= SentiWordNet (ER)// Identify initial sentiment polarity (positive, negative, neutral) based on lexiconbased analysis.
}
-
# Syntactic Feature Extraction
{
HJ= GloVe (DF)// Extracted syntactic features representing the syntactic structure of each review.
}
-
# Semantic Feature Extraction
{
TO=Bi-LSTM-POS (DF)// Extracted semantic features representing the relationships and roles in the reviews using eqn (3)
}
-
# Features Alignment
{
}
-
# Sentiment Classification
EA= BiGRU-CNN (SD)// Classify the Sentiment prediction type using eqn (8-11)
If (EA=0)
Class 0= “Neutral”
Else (EA=1)
Class 1= "Positive"
If Else (EA=2)
Class 2= "Negative"
}
Output: Accurately predict the Sentiment polarity based on drug reviews.
END
4. Result and Discussion
The BiGRU-CNN model is developed for sentiment analysis of drug reviews based on sentiment polarity. The preprocessing step involves cleaning the reviews by converting them to lowercase, removing stop words, and eliminating punctuation. These cleaned reviews are then passed through SentiWordNet to identify the initial sentiment polarity. The sentiment polarity and extracted features are fed into the BiGRU-CNN model for classification. Together, these components ensure accurate sentiment prediction of the drug reviews. The proposed setup uses an Nvidia GeForce GTX 1650 GPU, an Intel Core i5 CPU, and 16GB of RAM, and is implemented in Python 3.8.
Table 1. Simulation parameters for Bi-GRU.
|
Parameter |
Values |
|
Optimizer |
SGD |
|
Learning rate |
0.01 |
|
momentum |
0.9 |
|
activation |
'softmax' |
|
epochs |
100 |
|
batch_size |
8 |
Table 2. Simulation parameter for CNN.
|
Parameter |
Values |
|
activation |
'softmax' |
|
optimizers |
Adam |
|
learning_rate |
0.001 |
|
epochs |
10 |
|
batch_size |
16 |
Table 3. Simulation parameter for CBRNN.
|
Activation |
Relu |
|
Dropout |
0.5 |
|
Batch size |
32 |
Table 4. Parameter for LSTM.
|
Optimizer |
Adam |
|
Number of hidden units |
32 |
|
Batch size |
1500 |
Table 5. Parameter for ED-BiLSTM.
|
Number of layers |
2 |
|
Dropout |
0.5 |
Table 6. Parameter for PM-DBiGRU.
|
Epoch |
200 |
|
Learning rate |
0.001 |
Tables 1, 2, 3, 4, 5, and 6 list the parameters used to simulate the Bi-GRU, CNN, CBRNN, LSTM, ED-BiLSTM, and PM-DBiGRU models, respectively: optimizer, learning rate, momentum, activation, epochs, and batch_size.
-
4.1. Dataset Description
The dataset consists of drug reviews for various drugs, along with their sentiment labels [25]. The reviews cover various medications, outlining their effectiveness, side effects, and satisfaction. Thus, the reviews indicate which medications work and which don't, as well as the extent of their effectiveness/side effects, and the label indicates whether the sentiment about the reviews is positive, negative, or neutral. Drug review is often used for sentiment analysis tasks in the healthcare domain and helps humans understand users' general opinions about drugs. The total number of reviews is 67,630. There were 19,985 neutral, 19,085 positive, and 28,560 negative reviews. The number of reviews used in training was 54104 (15988 neutral, 15268 positive, and 22848 negative), and it was 13526 (3997 neutral, 3817 positive, and 5712 negative) in tests. These tagged reviews are also commonly used in sentiment analysis within the healthcare domain and are useful for analyzing users' overall experiences and opinions about different medicines. The dataset size is 80 MB.
False Positive Rate
Fig. 3. The Proposed techniques for AUC and ROC plots.
The ROC (Receiver Operating Characteristic) curve is presented in Figure 3. The plot shows the True Positive Rate (TPR) versus the False Positive Rate (FPR) across different thresholds for a model's performance. The model's performance is shown as the green curve, while the dashed diagonal line represents random chance (AUC = 0.5). If the area under the curve (AUC) is close to 1, it indicates good classification performance, and the steeper the rise toward the top-left corner, the better the predicted probabilities for the two classes. The model is almost perfect at classifying the classes.
Neutral Positive Negative
Predicted Label
Fig. 4. Confusion matrix for the proposed method using the BiGRU-CNN model.
The confusion matrix for the BiGRU-CNN model shows strong performance in drug-review sentiment classification (see Figure 4). The neutral reviews were mostly correctly identified (3,862), and the misidentification was small (17 misclassified as positive and 118 as negative). The number of correctly identified positive reviews was 3,714, and the misclassified positive reviews were only 2 neutral and 101 negative. Reviews with negative ratings were the most accurate (5,622), with only 1 incorrectly categorized as neutral and 89 as positive. Despite the high accuracy, the class distribution is skewed, with positive and negative reviews outnumbering neutral ones. Adding class weights would also be beneficial for improving performance, as it would balance learning across the sentiment classes.
-
4.2. Comparison Analysis
The Bidirectional Gated Recurrent Unit-Convolutional Neural Network (BiGRU-CNN) model that has been proposed can be compared to other existing algorithms, including the Convolution Bi-directional Recurrent Neural Network (CBRNN) [26], Long Short-Term Memory (LSTM) [14], Encoder Decoder-Bidirectional Long Short-Term Memory (ED-BiLSTM), and the Double BiGRU-based PM-DBiGRU multi-task learning model [13]. Accuracy, Negative Predictive Value (NPV), Selectivity, F1 Score, False Omission Rate (FOR), False Discovery Rate (FDR), Fall Out, and Error are the performance metrics.
Fig. 5. Accuracy of BiGRU-CNN compared with existing algorithms.
Fig. 6. PPV Value of BiGRU-CNN compared with existing algorithms.
Figures 5 and 6 present a comparison of the accuracy value and PPV. The proposed BiGRU-CNN classifier has higher Accuracy (97.50%) and PPV (97.20%) values than the other approaches. The resulting Accuracy and PPV values for methods like CBRNN, LSTM, ED-BiLSTM, and PMDBiGRU are 93%, 92%, 85.20%, and 78.26% for Accuracy, and 94.60%, 89.20%, 91%, and 86.80% for PPV, respectively. These results indicate that the BiGRU-CNN algorithm has higher differentiation capabilities than other existing approaches. BiGRU effectively captures both past and future contextual information in the text, enabling a better understanding of the sentiments expressed in drug reviews.
Fig. 7. BiGRU-CNN Comparison of selectivity with current algorithms.
Fig. 8. F1_Score Value of BiGRU-CNN compared with existing algorithms.
Selectivity contrast is shown in Figure 7. With a 94.20% selectivity rate, the proposed BiGRU-CNN classifier outperformed current methods, including CBRNN, LSTM, ED-BiLSTM, and PMDBiGRU, which achieved selectivity rates of 86.80%, 81.40%, 78.50%, and 74.40%, respectively. Figure 8 demonstrates the Comparison of F1_Score. The proposed classifier, BiGRU-CNN, achieves a high F1_Score of 96.65%, which is higher than the existing techniques: 93.02% for CBRNN, 87.83% for LSTM, 90.09% for ED-BiLSTM, and 82.44% for PMDBiGRU. The BiGRU-CNN algorithm provides superior distinction compared to other existing algorithms. CNN component excels in extracting high-quality local features, such as key phrases or sentiment-rich n-grams, from the sequential output of BiGRU. This improves the sentiment classification performance.
Table 7. Performance Metrics Comparison for both (BiGRU-CNN) and existing techniques.
|
Parameter |
Methods |
||||
|
Proposed ( BiGRU-CNN ) |
CBRNN |
LSTM |
ED-BiLSTM |
PMDBiGRU |
|
|
Miss rate (%) |
3.90 |
8.50 |
13.50 |
10.80 |
21.50 |
|
NPV (%) |
95.70 |
86.50 |
92.30 |
82.80 |
79.40 |
|
Hit rate (%) |
96.10 |
91.50 |
86.50 |
89.20 |
78.50 |
|
FOR (%) |
4.30 |
13.50 |
7.70 |
17.20 |
20.60 |
|
FDR (%) |
2.80 |
5.40 |
10.80 |
9 |
13.20 |
|
Fall out (%) |
5.80 |
13.20 |
18.60 |
21.50 |
25.60 |
|
Error (%) |
2.50 |
7 |
8 |
14.80 |
21.74 |
The performance characteristics of the proposed BiGRU-CNN are contrasted with those of the current techniques (CBRNN, LSTM, ED-BiLSTM, and PMDBiGRU) in Table 7. The proposed method achieves a higher Hit rate and NPV, and lower error rates (FDR, FOR, Fallout, Error, and Miss rate) than other approaches, demonstrating superior performance.
Table 8. Cross-validation for the proposed model.
|
Runs |
Accuracy (%) |
Positive predictive values (%) |
Selectivity (%) |
F1-Score (%) |
|
1 |
92.5 |
91.5 |
95 |
94 |
|
2 |
91 |
90 |
94 |
93 |
|
3 |
95.20 |
94.65 |
97.29 |
96.10 |
|
4 |
97.50 |
97.20 |
94.20 |
96.65 |
|
5 |
91 |
90 |
93.5 |
92.1 |
Table 8 presents fivefold cross-validation results for the BiGRU-CNN model, with Run 4 yielding the best results. The model in this run had an accuracy of 97.50%, a positive predictive value of 97.20%, a sensitivity of 94.20%, and an F1-score of 96.65%. These metrics confirm that the proposed model can predict the sentiment of medication reviews with high reliability and accuracy.
-
4.3. Real-world scenario
In actual healthcare systems, e.g., hospital feedback systems, the constant flow of medication feedback from patients is unstructured, noisy, and context-dependent. Such reviews tend to include both positive and negative aspects in a single sentence, such as therapeutic improvement alongside side effects. Over time, reviews change in their writing style, use of informal appeals, medical terminology, and negative and evolving expressions; hence, they pose a serious challenge to traditional machine-learning and rule-based systems, which do not account for contextual meaning and long-range relationships. Deep-learning models are effective but pose challenges for practical implementation because they require large annotated datasets and substantial computational resources, which limit their flexibility across changing clinical settings. To overcome these issues, a hybrid deep learning model was proposed. A preprocessing pipeline is used to prepare these reviews for reliable analysis, including lowercasing, stop-word removal, and punctuation removal. The use of lowercasing ensures a uniform number of tokens and eliminates feature repetitions due to case differences, while stop-word removal eliminates frequent words that add no semantic information. Elimination of punctuation also refines the text by eliminating symbols that have no bearing on the reading of the context in terms of sentiments. SentiWordNet is used to add auxiliary sentiment cues to non-polar words, helping guide learning in uncertain situations. An attention-based Bidirectional LSTM is then used to focus on semantically significant words in symptoms and side effects, and dependency parsing with GloVe models is used to capture syntactic links that are vital for decoding negation and contrast in medical discourse. These semantic and syntactic properties are consolidated using BERT to produce rich, contextually informed articulations that respond to evolving patient language within the platform. Lastly, these representations are processed by the hybrid BiGRU-CNN architecture to learn both long-range representations and local sentiment patterns, yielding robust, context-aware sentiment classification that remains efficient over time as online healthcare platforms generate noisy, constantly changing data.
Table 9. Performance analysis for the proposed and existing models in the real-world scenario.
|
Model |
Accuracy (%) |
Positive predictive values (%) |
Selectivity (%) |
F1-Score (%) |
|
Proposed ( BiGRU-CNN ) |
96.85 |
96 |
93 |
95 |
|
CBRNN |
90.85 |
89.72 |
87.40 |
84 |
|
LSTM |
92.5 |
90.5 |
89.52 |
91.42 |
|
ED-BiLSTM |
94.5 |
93.60 |
94.5 |
89 |
|
PMDBiGRU |
95 |
94.5 |
92.5 |
88.6 |
Table 9 presents a performance comparison of the proposed BiGRU-CNN model with the existing methods, that is, CBRNN, LSTM, ED-BiLSTM, and PMDBiGRU, in classifying the sentiment of medication reviews. The suggested model has the best accuracy (96.85%), positive predictive value (96%), sensitivity (93%), and F1 -score (95%).
Table 10. Statistical test for the proposed model.
|
BiGRU-CNN |
Matrix |
Confidence Intervals |
Paired t-Test |
Wilcoxon |
Friedman |
|
Accuracy |
97.32-97.62 |
8.1364673 |
0.0625 |
0.000499 |
|
|
Precision |
88.47 - 95.128 |
0.2020 |
0.25 |
0.003 |
|
|
Recall |
82.7 - 92.88 |
0.343540 |
0.375 |
0.003910 |
|
|
Specificity |
77.1- 89.58 |
0.338035 |
0.375 |
0.00391 |
|
|
NPV |
82.18 - 92.5 |
0.7927 |
0.875 |
0.003 |
Table 10 presents the accuracy of the BiGRU-CNN model with confidence intervals, as well as the results from the Paired t-Test, Wilcoxon, and Friedman tests.
Table 11. Ablation study for the proposed model.
|
Accuracy (%) |
FOR (%) |
Selectivity (%) |
|
|
Lower casing+stop word removal+punctuation+ Sentiword+ BERT +CNN |
95 |
7.8 |
89 |
|
Lower casing+stop word+Sentiword+BERT+Bi-GRU |
96.6 |
8.4 |
92 |
|
Lower casing+stop word removal+punctuation+Sentiword+BE RT+Bi-GRU-CNN |
97.50 |
4.30 |
94.20 |
Table 11 presents the Ablation study of the model. The integrated BiGRU-CNN model achieves the best results, with an accuracy of 97.5%, a FOR of 4.3%, and a sensitivity of 94.2%, thereby demonstrating the effectiveness of the combined strategy.
5. Conclusion
Sentiment analysis of drug reviews involves extracting and evaluating users' opinions about drugs to classify sentiment as positive, neutral, or negative. It makes sense to look at sentiment analysis of drug reviews as a method to understand the user's experiences of using a medication or drug. Additionally, medical abbreviations and language can affect the effectiveness of generic models. To mitigate these concerns, we developed a BiGRU-CNN model for sentiment analysis on drug reviews, integrated with BERT to process specific terminology and its various nuances and context. This technique combats subjectivity and imbalance and uses context to assist with ambiguities. The process starts with aggregating patient drug reviews into a preprocessed dataset, converting to lowercase, removing stop words, and removing punctuation irrelevant to the task, with the intent of normalizing the text. At this point, apply a polaritybased sentiment analysis (SentiWordNet) to gauge a positive, negative, or neutral scoring on the words, which ultimately makes the interpretation of sentiment more explicit. Syntactic features with dependency tree parsing and GloVe embeddings, and semantic features with parts of speech tagging and attention Bi-LSTM model, aligning and contextualizing quotation formality through BERT, to make it more nuanced. Lastly, classification was performed using a hybrid BiGRU-CNN model that incorporated temporal dependencies and spatial patterns, enabling a thorough analysis of sentiment in drug reviews. With the effective proposed method, 97.50% Accuracy, 97.20% Precision, 2.50% error, 2.80% FDR, 4.30% FOR, and 96.65% F_1 score were achieved. The proposed method clearly outperforms prior methods, as indicated by the results in the previous figure. These results indicate that the proposed BiGRU-CNN outperforms other available methods.
-
5.1. Limitations and Future Scope
While there are constraints in this approach, using existing dictionaries as simple seeding may not capture additional nuances of SV sentiment context in domain-specific cases. Additionally, using word embeddings could lead to some loss of hierarchical contextual meaning in sentences, and aggregating model predictions may increase resource requirements. In the future, sentiment analysis in health care could enable highly precise feedback systems that leverage real-time patient ratings to optimize medication recommendations. Additionally, the novelty of these systems could provide real-time feedback on clinical data, including real-time tracking of drug effectiveness and adverse effects. In time, as neural models grow, so will the efficacy of their predictions, ensuring more personalized treatments for patients and leading to better healthcare outcomes.
All the Declarations and StatementsAuthor Contributions Statement
Syed Zabiulla SK – Conceptualization, Methodology, and Writing.
Mausumi Goswami – Review, Editing, and Supervision.
All authors have read and agreed to the published version of the manuscript.
Conflict of Interest Statement
The authors declare no conflicts of interest.
Funding Declaration
This research was supported by the grant "Project Number" "Project Full Name".
Data Availability Statement
This study analyzed publicly available datasets. The results obtained and datasets can be found here: "". Accessed on "05-10-2024".
Ethical Declarations
The authors should declare the following: Statements of ethical approval for studies involving human subjects and/or animals.
Acknowledgments
We sincerely thank the experts for their professional evaluation and valuable recommendations, which have helped improve the quality of the experiment and the reliability of its results.
Declaration of Generative AI in Scholarly Writing
During the preparation of this manuscript, the authors used generative AI–assisted tools to support grammar checking, sentence formation, and language refinement to improve the manuscript's clarity and readability. The authors carefully reviewed and edited the output and take full responsibility for the final content of the manuscript.
Abbreviations
The following abbreviations are used in this manuscript:
AUC - Area Under the Curve
ANNs - Artificial Neural Networks
BERT - Bidirectional Encoder Representations from Transformers
BiGRU - Bidirectional Gated Recurrent Unit
CBRNN - Convolution Bi‑directional Recurrent Neural Network
CNNs - Convolutional Neural Networks
DNNs - Deep Neural Networks
XGBoost - Extreme Gradient Boosting
FDR - False Discovery Rate
FPR - False Positive Rate
GloVe - Global Vectors for Word Representation
KNN - K‑Nearest Neighbors
LSTM - Long Short‑Term Memory
NLP - Natural Language Processing
NPV - Negative Predictive Value
POS - Parts of Speech
ROC - Receiver Operating Characteristic
ReLU - Rectified Linear Unit
TPR - True Positive Rate