Journal of Frontiers of Computer Science and Technology ›› 2020, Vol. 14 ›› Issue (4): 619-627.DOI: 10.3778/j.issn.1673-9418.1904049

Previous Articles     Next Articles

Using Position-Enhanced Attention Mechanism for Aspect-Based Sentiment Classi-fication

ZHANG Zhoubin, XIANG Yan, LIANG Junge, YANG Jialin, MA Lei   

  1. 1. Faculty of Information Engineering and Automation, Kunming University of Science and Technology, Kunming 650504, China
    2. Kunming University of Science and Technology Asset Management Company Limited, Kunming 650051, China
  • Online:2020-04-01 Published:2020-04-10



  1. 1. 昆明理工大学 信息工程与自动化学院,昆明 650504
    2. 昆明理工大学资产经营有限公司,昆明 650051


Aspect-based sentiment classification is designed to accurately identify the emotional polarity of aspect in a comment. Most existing long short term memory (LSTM) network uses only the semantic information of aspects and contexts, while ignoring the function of relative position information between the aspect and the context. To solve this problem, this paper proposes an LSTM-based model that uses relative position information to enhance attention and solves the aspect-based sentiment classification problem. First, the position vector is added to the input layer of the context, and the context and the aspect are separately encoded by using two LSTM networks. Then, the position vector is stitched again to the hidden layer of the context, and the hidden layer vector of the aspect is used to calculate the attention weight of different words in the context. Finally, sentiment classification is performed using a valid representation generated by the context. The model is tested on the Restaurant and Laptop datasets of SemEval 2014 Task4. In the three-category experiments, the accuracies of the proposed model are 79.7% and 72.1% respectively. In the two-category experiments, the accuracies reach 92.1% and 88.3% respectively. The proposed model has a certain improvement in accuracy compared to multiple baseline models.

Key words: aspect, sentiment classification, attention mechanism, long short term memory (LSTM) network, position information


属性级情感分类旨在准确识别评论中属性的情感极性。现有的基于长短时记忆网络(LSTM)的方法大多只利用了属性和上下文的语义信息,而忽视了属性与上下文相对位置信息。针对此问题,提出一种利用相对位置信息来增强注意力的LSTM网络模型,解决属性级情感分类问题。首先,对上下文的输入层加入位置向量,利用两个LSTM网络对上下文和属性分别进行独立语义编码;然后,对上下文的隐藏层再次拼接位置向量,并利用属性隐藏层向量参与上下文不同词注意力权重的计算;最后,利用上下文生成的有效表示进行情感分类。该模型在SemEval 2014 Task4 Restaurant和Laptop两个不同领域数据集上进行了实验,在三分类实验中,准确率分别达到79.7%和72.1%。在二分类实验中,准确率分别达到92.1%和88.3%。相比多个基线模型,在准确率上都有一定的提升。

关键词: 属性, 情感分类, 注意力机制, 长短时记忆网络(LSTM), 位置信息