Please wait a minute...
浙江大学学报(工学版)  2026, Vol. 60 Issue (6): 1269-1276    DOI: 10.3785/j.issn.1008-973X.2026.06.014
计算机技术     
知识增强图Transformer的方面级情感分析
郑文军1,2(),黎志昆1,韩守飞1,2,3,*()
1. 安徽理工大学 人工智能学院,安徽 合肥 231131
2. 安徽理工大学 煤炭无人化开采数智技术全国重点实验室,安徽 淮南 232001
3. 齐鲁工业大学(山东省科学院) 算力互联网与信息安全教育部重点实验室,山东 济南 250300
Aspect-based sentiment analysis via knowledge-enhanced graph Transformer
Wenjun ZHENG1,2(),Zhikun LI1,Shoufei HAN1,2,3,*()
1. School of Artificial Intelligence, Anhui University of Science and Technology, Hefei 231131, China
2. State Key Laboratory of Digital Intelligent Technology for Unmanned Coal Mining, Anhui University of Science and Technology, Huainan 232001, China
3. Key Laboratory of Computing Power Network and Information Security, Ministry of Education, Qilu University of Technology (Shandong Academy of Sciences), Jinan 250300, China
 全文: PDF(865 KB)   HTML
摘要:

针对现有方面级情感分析方法因特征交互不足与知识利用缺失而导致的推理局限,提出知识增强的图Transformer网络(K-GTNet). 通过构建“先验知识引导—局部句法建模—全局语义推理”的逻辑框架,实现对复杂文本情感的深入理解. 该方法融合外部情感知识与内部句法结构,构建带有边依赖权重的图表示. 通过图神经网络在该图上进行邻域信息聚合,捕捉以方面词为中心的局部情感特征. 将提取的局部感知特征序列输入Transformer,通过自注意力机制建立全局上下文依赖,实现鲁棒的方面情感极性判别. 在5个基准数据集上进行实验验证,K-GTNet的平均准确率达到84.95%,F1达到77.96%,优于主流的基线模型.

关键词: 自然语言处理情感分析知识增强图神经网络Transformer    
Abstract:

A knowledge-enhanced graph Transformer network (K-GTNet) was proposed in order to address the reasoning limitation of existing aspect-based sentiment analysis method caused by insufficient feature interaction and lack of knowledge utilization. A logical framework of “prior knowledge guidance–local syntactic modeling–global semantic reasoning” was constructed to achieve a deep understanding of complex textual sentiment. External sentiment knowledge and internal syntactic structure were fused to construct a graph representation with edge dependency weight. Neighborhood information was aggregated on this graph through a graph neural network, and local sentiment feature centered on aspect term was captured. The extracted local-aware feature sequence was fed into a Transformer. Global contextual dependency was built through self-attention mechanism, and robust aspect sentiment polarity classification was achieved. Experiments conducted on five benchmark datasets demonstrated that K-GTNet achieved average accuracy of 84.95% and F1 of 77.96%, outperforming mainstream baseline model.

Key words: natural language processing    sentiment analysis    knowledge enhancement    graph neural network    Transformer
收稿日期: 2025-08-02 出版日期: 2026-05-06
CLC:  TP 391  
基金资助: 安徽理工大学青年基金资助项目(QNYB202204);国家自然科学基金资助项目(62306279);中国博士后面上基金资助项目(2424M760592);算力互联网与信息安全教育部重点实验室开放基金资助项目(2024Y005).
通讯作者: 韩守飞     E-mail: zwj@aust.edu.cn;hanshoufei@gmail.com
作者简介: 郑文军(1994—),男,讲师,从事情感计算研究. orcid.org/0000-0002-1135-0212. E-mail:zwj@aust.edu.cn
服务  
把本文推荐给朋友
加入引用管理器
E-mail Alert
作者相关文章  
郑文军
黎志昆
韩守飞

引用本文:

郑文军,黎志昆,韩守飞. 知识增强图Transformer的方面级情感分析[J]. 浙江大学学报(工学版), 2026, 60(6): 1269-1276.

Wenjun ZHENG,Zhikun LI,Shoufei HAN. Aspect-based sentiment analysis via knowledge-enhanced graph Transformer. Journal of ZheJiang University (Engineering Science), 2026, 60(6): 1269-1276.

链接本文:

https://www.zjujournals.com/eng/CN/10.3785/j.issn.1008-973X.2026.06.014        https://www.zjujournals.com/eng/CN/Y2026/V60/I6/1269

图 1  知识增强图Transformer的方面级情感分析模型架构
数据集正向负向中性
训练集测试集训练集测试集训练集测试集
Restaurant142164728807196637196
Laptop14994341870128464169
Twitter156117315601733127346
Restaurant159123262561823634
Restaurant1612404694391176930
表 1  方面级情感分析数据集的统计信息
嵌入方式模型Restaurant14Laptop14TwitterRestaurant15Restaurant16
AccF1AccF1AccF1AccF1AccF1
GloVeSenticGCN (2021)0.81340.73070.76020.72070.72540.70460.80630.65110.88960.7096
SSEGCN (2022)0.82930.75390.78480.74530.76120.74790.80260.65250.90580.7579
KGAN (2023)0.83250.75260.78280.74520.77270.76190.80760.62330.89220.7151
DualGCN (2024)0.82660.74450.76740.73560.75180.73710.80260.66850.89120.7416
TextGT (2024)0.83290.76640.77370.73420.75480.74090.79340.61610.87340.7273
DAGCN (2024)0.82040.73940.75790.71850.76670.75420.81370.65780.87180.6855
K-GTNet (本文)0.84270.77600.78160.74850.76930.75500.81470.66410.89980.7681
BERTSenticGCN (2021)0.85800.78400.77740.73360.74280.73290.84130.68030.90750.7461
SSEGCN (2022)0.85180.77420.80490.76830.77030.75990.84870.72610.92370.7654
GMF-SKIA (2023)0.84190.78360.78690.75570.74120.7321
KGAN (2023)0.86180.80850.81090.77770.80260.79390.85840.72940.92810.8141
TextGT (2024)0.85610.79940.81170.77710.77400.76160.85980.70750.91560.7762
DAGCN (2024)0.81950.70100.80850.77220.73410.72070.82840.63340.92370.7901
WordTransABSA (2024)0.85540.79110.78400.74830.74880.7651
LSOIT (2024)0.86070.80370.78990.75580.77600.7651
K-GTNet (本文)0.86420.81150.82010.78620.77870.76740.85690.72130.92750.8116
表 2  在5个数据集上与基线模型的对比结果
模型Restaurant14Laptop14Twitter
AccF1AccF1AccF1
K-GTNet0.84270.77600.78160.74850.76930.7550
K-GTNet w/o Graph0.81960.72590.75480.71980.73630.7249
K-GTNet w/o Transformer0.80250.71020.73420.69360.71850.7082
K-TGNet0.81110.72880.75000.71200.73030.7211
K-GTNet w/o AK0.83290.76640.77370.73420.75480.7409
K-GTNet w/o SK0.82580.73070.76020.72130.74290.7228
表 3  K-GTNet的消融实验结果
图 2  GTM层数对准确率的影响
图 3  注意力可视化结果
模型ttrain/sttest/s
SenticNet531.730.44
SSEGCN695.940.33
KGAN2786.242.44
DualGCN747.940.64
TextGT864.970.78
DAGCN1021.290.55
K-GTNet775.430.64
表 4  在Laptop14数据集上的运行时间结果
序号句子真实极性SenticGCNKGANTextGTLSOITK-GTNet
1I trust the people at Go Sushi , it never disappoints .正向×
2mariah carey Welocmes Twins : Price William asked Kate Middleton if their
first public kiss as a married couple was ' , , .
中性×
3Put a SSD and use a 21 ' ' LED screen , this set up is silky smooth !中性,中性,正向√,×,√√,√,×√,×,×√,√,×√,√,√
4The Apple engineers have not yet discovered the delete key .负向×
5just started liking two songs i hated when they first came out - britney spears ,
sexy bitch - david guetta feat akon .
负向××
表 5  K-GTNet与对比模型在数据集上的案例分析结果
21 ZHAO A, YU Y Knowledge-enabled BERT for aspect-based sentiment analysis[J]. Knowledge-Based Systems, 2021, 227: 107220
doi: 10.1016/j.knosys.2021.107220
22 ZHANG Z, ZHOU Z, WANG Y. SSEGCN: syntactic and semantic enhanced graph convolutional network for aspect-based sentiment analysis [C]//Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies. Seattle: ACL, 2022: 4916–4925.
23 HAN Y, ZHOU X, WANG G, et al Fusing sentiment knowledge and inter-aspect dependency based on gated mechanism for aspect-level sentiment classification[J]. Neurocomputing, 2023, 551: 126462
doi: 10.1016/j.neucom.2023.126462
24 WU H, ZHOU D, SUN C, et al LSOIT: lexicon and syntax enhanced opinion induction tree for aspect-based sentiment analysis[J]. Expert Systems with Applications, 2024, 235: 121137
doi: 10.1016/j.eswa.2023.121137
1 LIU X, HOU R, GAN Y, et al. Aspect-oriented opinion alignment network for aspect-based sentiment classification [C]//Proceedings of the 26th European Conference on Artificial Intelligence. Ohmsha: IOS, 2023: 1552-1559.
2 陈巧红, 孙佳锦, 漏杨波, 等 基于多任务学习与层叠Transformer的多模态情感分析模型[J]. 浙江大学学报: 工学版, 2023, 57 (12): 2421- 2429
CHEN Qiaohong, SUN Jiajin, LOU Yangbo, et al Multimodal sentiment analysis model based on multi-task learning and stacked cross-modal Transformer[J]. Journal of Zhejiang University: Engineering Science, 2023, 57 (12): 2421- 2429
3 WANG Y, HUANG M, ZHU X, et al. Attention-based LSTM for aspect-level sentiment classification [C]//Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing. Austin: ACL, 2016: 606–615.
4 ZHU C, YI B, LUO L Base on contextual phrases with cross-correlation attention for aspect-level sentiment analysis[J]. Expert Systems with Applications, 2024, 241: 122683
doi: 10.1016/j.eswa.2023.122683
5 程艳, 胡建生, 赵松华, 等 融合Transformer和交互注意力网络的方面级情感分类模型[J]. 智能系统学报, 2024, 19 (3): 728- 737
CHENG Yan, HU Jiansheng, ZHAO Songhua, et al Aspect-level sentiment classification model combining Transformer and interactive attention network[J]. CAAI Transactions on Intelligent Systems, 2024, 19 (3): 728- 737
doi: 10.11992/tis.202303016
6 PHAN H T, NGUYEN N T, HWANG D Aspect-level sentiment analysis: a survey of graph convolutional network methods[J]. Information Fusion, 2023, 91: 149- 172
doi: 10.1016/j.inffus.2022.10.004
7 SHANG W, CHAI J, CAO J, et al Aspect-level sentiment analysis based on aspect-sentence graph convolution network[J]. Information Fusion, 2024, 104: 102143
doi: 10.1016/j.inffus.2023.102143
8 程艳芬, 吴家俊, 何凡 基于关系门控图卷积网络的方面级情感分析[J]. 浙江大学学报: 工学版, 2023, 57 (3): 437- 445
CHENG Yanfen, WU Jiajun, HE Fan Aspect level sentiment analysis based on relation gated graph convolutional network[J]. Journal of Zhejiang University: Engineering Science, 2023, 57 (3): 437- 445
9 ZHAO X, PENG H, DAI Q, et al. RDGCN: reinforced dependency graph convolutional network for aspect-based sentiment analysis [C]//Proceedings of the 17th ACM International Conference on Web Search and Data Mining. Merida, Mexico: ACM, 2024: 976-984.
10 LI R, CHEN H, FENG F, et al DualGCN: exploring syntactic and semantic information for aspect-based sentiment analysis[J]. IEEE Transactions on Neural Networks and Learning Systems, 2024, 35 (6): 7642- 7656
doi: 10.1109/TNNLS.2022.3219615
11 WANG Z, ZHANG B, YANG R, et al. DAGCN: distance-based and aspect-oriented graph convolutional network for aspect-based sentiment analysis [C]//Proceedings of the Findings of the Association for Computational Linguistics: NAACL 2024. Mexico City: ACL, 2024: 1863–1876.
12 CHEN B, OUYANG Q, LUO Y, et al. S2GSL: incorporating segment to syntactic enhanced graph structure learning for aspect-based sentiment analysis [C]//Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). Bangkok: ACL, 2024: 13366–13379.
13 YIN S, ZHONG G. TextGT: a double-view graph transformer on text for aspect-based sentiment analysis [C]//Proceedings of the AAAI Conference on Artificial Intelligence. Palo Alto: AAAI, 2024: 19404-19412.
14 LIANG B, SU H, GUI L, et al Aspect-based sentiment analysis via affective knowledge enhanced graph convolutional networks[J]. Knowledge-Based Systems, 2022, 235: 107643
doi: 10.1016/j.knosys.2021.107643
15 段文杰, 邓金科, 张顺香, 等 基于多层次知识增强的方面级情感分析模型[J]. 智能系统学报, 2024, 19 (5): 1287- 1297
DUAN Wenjie, DENG Jinke, ZHANG Shunxiang, et al Aspect-based sentiment analysis model based on multilevel knowledge enhancement[J]. CAAI Transactions on Intelligent Systems, 2024, 19 (5): 1287- 1297
doi: 10.11992/tis.202308044
16 ZHONG Q, DING L, LIU J, et al Knowledge graph augmented network towards multiview representation learning for aspect-based sentiment analysis[J]. IEEE Transactions on Knowledge and Data Engineering, 2023, 35 (10): 10098- 10111
doi: 10.1109/TKDE.2023.3250499
17 何勇禧, 韩虎, 孔博 基于多依赖图和知识融合的方面级情感分析模型[J]. 浙江大学学报: 工学版, 2024, 58 (4): 737- 747
HE Yongxi, HAN Hu, KONG Bo Aspect-based sentiment analysis model based on multi-dependency graph and knowledge fusion[J]. Journal of Zhejiang University: Engineering Science, 2024, 58 (4): 737- 747
18 WAN B, WU P, HAN P, et al Aspect-based sentiment analysis by knowledge and attention integrated graph convolutional network[J]. Applied Soft Computing, 2025, 171: 112763
doi: 10.1016/j.asoc.2025.112763
19 BAI H, WANG D L, FENG S, et al EKBSA: a Chinese sentiment analysis model by enhancing K-BERT[J]. Journal of Computer Science and Technology, 2025, 40 (1): 60- 72
doi: 10.1007/s11390-024-2870-9
[1] 边文远,火久元,常琛. 基于改进的插补扩散模型与LSTM的风电数据清洗方法[J]. 浙江大学学报(工学版), 2026, 60(5): 1016-1026.
[2] 彭静,闫佳荣,刘佳英,魏子易,白珊,邓亚红. 多尺度残差学习结合Dilformer的双流医学图像配准网络[J]. 浙江大学学报(工学版), 2026, 60(5): 1082-1091.
[3] 侯玉珍,沈晓红,李莉,杨明源,张彩明. 基于掩模和非局部注意力的双阶段去雨网络[J]. 浙江大学学报(工学版), 2026, 60(4): 791-799.
[4] 万刚,王小波,石纲,叶德震,朱思思,司帆. 基于特征细化与注意力增强重构的水下图像增强算法[J]. 浙江大学学报(工学版), 2026, 60(4): 800-811.
[5] 陈文强,冯琳越,王东丹,顾玉磊,赵轩. 融合动态风险图与多变量注意力机制的车辆轨迹预测模型[J]. 浙江大学学报(工学版), 2026, 60(3): 455-467.
[6] 李延松,陈宁,刘锋光,陈盼,黄晓峰,葛慧丽. 基于分阶段语义感知的事件抽取大语言模型框架[J]. 浙江大学学报(工学版), 2026, 60(3): 527-535.
[7] 王彦乐,张瑞峰,李锵. 融合全局信息和对比学习的图神经网络推荐模型[J]. 浙江大学学报(工学版), 2026, 60(2): 351-359.
[8] 包晓安,彭书友,张娜,涂小妹,张庆琪,吴彪. 基于多方位感知深度融合检测头的目标检测算法[J]. 浙江大学学报(工学版), 2026, 60(1): 32-42.
[9] 孟璇,张雪英,孙颖,周雅茹. 基于电极排列和Transformer的脑电情感识别[J]. 浙江大学学报(工学版), 2025, 59(9): 1872-1880.
[10] 林宜山,左景,卢树华. 基于多头自注意力机制与MLP-Interactor的多模态情感分析[J]. 浙江大学学报(工学版), 2025, 59(8): 1653-1661.
[11] 刘杰,吴优,田佳禾,韩轲. 改进Transformer的肺部CT图像超分辨率重建[J]. 浙江大学学报(工学版), 2025, 59(7): 1434-1442.
[12] 蔡永青,韩成,权巍,陈兀迪. 基于注意力机制的视觉诱导晕动症评估模型[J]. 浙江大学学报(工学版), 2025, 59(6): 1110-1118.
[13] 张梦瑶,周杰,李文婷,赵勇. 结合全局信息和局部信息的三维网格分割框架[J]. 浙江大学学报(工学版), 2025, 59(5): 912-919.
[14] 张德军,白燕子,曹锋,吴亦奇,徐战亚. 面向密集预测任务的点云Transformer适配器[J]. 浙江大学学报(工学版), 2025, 59(5): 920-928.
[15] 马莉,王永顺,胡瑶,范磊. 预训练长短时空交错Transformer在交通流预测中的应用[J]. 浙江大学学报(工学版), 2025, 59(4): 669-678.