计算机工程与应用 ›› 2025, Vol. 61 ›› Issue (11): 216-226.DOI: 10.3778/j.issn.1002-8331.2403-0082

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

中文短文本情感分类:融入位置感知强化的Transformer-TextCNN模型研究

李浩君,王耀东,汪旭辉   

  1. 浙江工业大学 教育科学与技术学院,杭州 310023
  • 出版日期:2025-06-01 发布日期:2025-05-30

Chinese Short Text Sentiment Classification: Research on Transformer-TextCNN Model with Location-Aware Enhancement

LI Haojun, WANG Yaodong, WANG Xuhui   

  1. College of Educational Science and Technology, Zhejiang University of Technology, Hangzhou 310023, China
  • Online:2025-06-01 Published:2025-05-30

摘要: 针对当前中文短文本情感分类模型文本位置信息与关键特征获取不足的问题,提出了一种融入位置感知强化的Transformer-TextCNN情感分类模型。利用BERT可学习绝对位置编码与正弦位置编码强化模型的位置感知能力,融合Transformer的全局上下文理解能力与TextCNN的局部特征捕捉能力,分别提取中文短文本全局特征与局部特征,构建位置感知强化与特征协同的情感特征输出服务,实现中文短文本情感准确分类。实验结果表明,该模型在视频弹幕数据集上的准确率达到90.23%,在SMP2020数据集上的准确率达到87.38%。相较于最优的基线模型,准确率在视频弹幕数据集和SMP2020数据集上分别提高了1.98和0.44个百分点,在中文短文本情感分类任务中取得更好的分类效果。

关键词: 文本情感分类, BERT, Transformer, textCNN, 位置编码

Abstract: Aiming at the problem of insufficient acquisition of text location information and key features in the current Chinese short text sentiment classification model, a Transformer-TextCNN sentiment classification model integrated with location-aware enhancement is proposed. Firstly, BERT’s learnable absolute position encoding and sinusoidal position coding are used to enhance the position perception ability of the model. Then, the global context understanding ability of Transformer and the local feature capture ability of TextCNN are combined to extract the global and local features of Chinese short text respectively. Finally, the emotional feature output service of position perception reinforcement and feature collaboration is constructed to realize the accurate classification of Chinese short text emotion. The experimental results show that the accuracy of the model on the video barrage data set reaches 90.23%, and the accuracy on the SMP2020 data set reaches 87.38%. Compared with the optimal baseline model, the accuracy rate is increased by 1.98 and 0.44 percentage points on the video barrage dataset and SMP2020 dataset, respectively, and better classification results are achieved in the Chinese short text sentiment classification task.

Key words: text sentiment classification, BERT, Transformer, textCNN, positional encoding