计算机科学与探索 ›› 2023, Vol. 17 ›› Issue (4): 902-911.DOI: 10.3778/j.issn.1673-9418.2107069

• 人工智能·模式识别 • 上一篇    下一篇

局部与全局特征融合的方面情感分析网络模型

夏鸿斌,李强,刘渊   

  1. 1. 江南大学 人工智能与计算机学院,江苏 无锡 214122
    2. 江苏省媒体设计与软件技术重点实验室,江苏 无锡 214122
  • 出版日期:2023-04-01 发布日期:2023-04-01

Local and Global Feature Fusion Network Model for Aspect-Based Sentiment Analysis

XIA Hongbin, LI Qiang, LIU Yuan   

  1. 1. School of Artificial Intelligence and Computer Science, Jiangnan University, Wuxi, Jiangsu 214122, China
    2. Jiangsu Key Laboratory of Media Design and Software Technology, Wuxi, Jiangsu 214122, China
  • Online:2023-04-01 Published:2023-04-01

摘要: 方面情感分析旨在预测句子或文档中一个特定方面的情感极性。最近大部分的研究都是通过使用注意力机制及外部语义知识对全局上下文进行建模,以完成这项工作。方面的情感极性往往取决于与方面高度相关的局部上下文,但大多数模型将过多的注意力集中于全局上下文,这使得模型的参数量普遍比较大,导致计算量也随之增大。为此,提出一种基于多头注意力机制的轻量化网络模型——局部与全局特征融合网络模型。首先,使用双向门控循环单元来对上下文进行编码。其次,根据与方面项的语义相关距离掩蔽掉与方面项相关度较小的上下文词,以此得到局部上下文表示。最后,通过多头Aspect-aware注意力网络对局部和全局上下文分别进行提取,将两者提取的结果进行结合。此外,还将预先训练的BERT应用于这项任务,并获得了更好的结果。在三个数据集Twitter、Laptop、Restaurant上进行实验,采用Accuracy和[F1]指标进行评估。实验结果表明,该模型在参数量较小的情况下,取得了比其他基于方面的情感分类算法更好的结果。

关键词: 注意力机制, 局部上下文注意, 情感分析, 文本分类

Abstract: Aspect-based sentiment analysis aims to predict the sentiment polarity of a specific aspect in a sentence or document. Most of the recent research is to use attention mechanism and external semantic knowledge to model the global context. The sentiment polarity of an aspect often depends on the local context which is highly related to the aspect, but most models focus too much on the global context, which makes the parameter amount of the model generally larger, resulting in an increase in the amount of calculation. To this end, this paper proposes a lightweight network model based on multi-head attention mechanism, which is named local and global feature fusion network. Firstly, a bidirectional gated recurrent unit is used to encode the context. Secondly, context words that are less relevant to the aspect term are masked out according to the semantic relation distance with the aspect term, so as to obtain the local context representation. Finally, the local and global context are extracted respectively by multi-head Aspect-aware attention network, and the results of the two extraction are combined. In addition, the pre-trained BERT is also applied to the proposed model and better results are obtained. Experiments are conducted on three datasets: Twitter, Laptop, and Restaurant. Accuracy and F1 indicators are used for evaluation. Experimental results show that the proposed model achieves better results than other aspect-based sentiment classification algorithms with a small amount of parameters.

Key words: attention mechanism, local context attention, sentiment analysis, text classification