Graph Neural Network Framework for Sentiment Analysis Using Syntactic Feature

Linxiao Wu, Yuanshuai Luo, Binrong Zhu, Guiran Liu, Rui Wang, Qian Yu · DOI

Abstract

Traditional sentiment analysis often fails to capture the nuanced relationships between specific aspects of a sentence and their corresponding descriptors. This paper presents a Hybrid Model Graph Neural Network (HM-GNN) designed for aspect-based sentiment analysis (ABSA). By integrating syntactic parse trees with positional encoding, the framework maps grammatical structures into a graph and weights words based on their proximity to target topics. Experimental results across three benchmark datasets demonstrate that this hybrid approach achieves state-of-the-art accuracy by effectively combining structural logic with sequential flow.

Introduction

In sentiment analysis, identifying the overall polarity of a sentence is often insufficient for complex reviews. Aspect-based sentiment analysis (ABSA) addresses this by determining sentiment toward specific targets within a sentence (e.g., "The food was excellent, but the service was lacking").

Standard deep learning models typically treat text as linear sequences. This approach suffers from two primary limitations:

  1. Syntactic Neglect: Linear models often overlook the structural relationships defined by grammar, such as which specific adjective modifies a distant noun.
  2. Proximity Blindness: They may fail to prioritize words physically or grammatically closer to the focal aspect, which usually carry the most significant sentiment weight.

The HM-GNN framework addresses these flaws by utilizing Graph Neural Networks (GNNs) to interpret the grammatical architecture of a sentence rather than relying solely on word order.

Methodology

The HM-GNN architecture is a multi-layered framework that fuses syntactic structural data with sequential context. The process involves several key stages:

1. Syntactic Parsing and Adjacency Mapping

The model converts each sentence into a syntactic parse tree. This tree is transformed into an adjacency matrix, providing a structural "map" that allows the GNN to identify relationships between words that may be far apart in a linear sequence.

2. Positional Encoding

To maintain context regarding word order, the model calculates the relative distance of every word from the target aspect. This distance is embedded as a feature vector, ensuring the model recognizes that words closer to the aspect are generally more relevant to its sentiment.

3. The Hybrid GNN Engine

The core processing is handled by two distinct graph layers:

  • Graph Attention Network (GAT): This layer enables the model to assign varying levels of importance to neighboring nodes in the syntactic tree, learning which grammatical dependencies are most critical.
  • Graph Convolutional Network (GCN): This layer refines features by aggregating information from the broader context surrounding the focal terms.

4. BiLSTM-Attention Integration

In parallel with the GNN, a standard Bidirectional Long Short-Term Memory (BiLSTM) layer processes the text to capture sequential dependencies. An attention mechanism then fuses the GNN’s structural insights with the BiLSTM’s sequential flow.

Experimental Results

The HM-GNN model was evaluated against three canonical NLP benchmarks: the SemEval 2014 Laptop and Restaurant datasets, and the ACL 2014 Twitter dataset. The Twitter dataset is particularly challenging due to its informal language and frequent use of slang.

Dataset Metric HM-GNN (Ours) Best Baseline (BATX)
Twitter Accuracy 74.36% 73.97%
Laptop Accuracy 77.43% 76.38%
Restaurant Accuracy 81.87% 80.97%

The HM-GNN consistently outperformed strong baselines like ASGCN and BATX. The performance was most notable on the Restaurant dataset, where the model achieved nearly 82% accuracy, highlighting its proficiency in handling descriptive, multi-aspect language.

Discussion and Key Insights

The success of the HM-GNN highlights the value of syntax as a shortcut. By utilizing a parse tree, the model can "jump" across a sentence; if a sentiment-bearing word is grammatically linked to an aspect ten words away, the GNN treats them as immediate neighbors. Furthermore, the integration of proximity weighting helps the model filter out noise from irrelevant parts of the sentence.

The findings suggest that GNNs are most effective when used to augment, rather than replace, sequential models. While the GNN captures the underlying logic and structure, the BiLSTM preserves the natural flow of the language.

Conclusion and Future Work

While the HM-GNN framework sets a new benchmark for ABSA, it remains dependent on the accuracy of initial syntactic parsers. Errors in parsing—common in informal social media text—can lead to a "broken map" for the GNN. Additionally, the computational cost of generating graph matrices for every sentence is higher than traditional sequence modeling.

Future research will focus on refining the scope of information aggregation around focal terms and exploring cross-domain adaptation to determine if models trained on specific industries (e.g., restaurants) can be effectively applied to others (e.g., electronics) without significant retraining.

Summary updated

BibTeX
@inproceedings{wu2024graph,
  author = {Linxiao Wu and Yuanshuai Luo and Binrong Zhu and Guiran Liu and Rui Wang and Qian Yu},
  title = {{Graph Neural Network Framework for Sentiment Analysis Using Syntactic Feature}},
  booktitle = {ICBASE},
  year = {2024},
  doi = {10.1109/icbase63199.2024.10762511},
}
Figure