# Sentiment Analysis of Comment Texts on Online Courses Based on Hierarchical Attention Mechanism
## 1 Introduction
Represented by RNN, LSTM, and other classical neural networks, deep learning-based sentiment analysis methods can not only solve the shortcomings of traditional machine learning but also have significant classification effects. CNN can obtain the local information of a text, whereas recurrent neural networks such as LSTM can obtain the global information of a text. On the one hand, sequence-based neural networks such as LSTM have been restricted by the sequence length and computational memory. Attention mechanisms, on the other hand, could alleviate this problem since it allows modeling of the dependency output sequence without considering the distance between texts [13; 14; 15]. As a result, there are some sentiment analysis methods that use classical neural networks combined with an attention mechanism. [PERSON] et al. [16] and [PERSON] et al. [17] shows that the combination of an attention mechanism and LSTM can improve the accuracy of the model. The single-layer attention mechanism tends to focus on the words with strong sentiment expression and ignore the words with weak sentiment expression and opposite polarity, leading to the misjudgment of sentiment polarity. Take a real comment, for example:  
Internet era, teachers' personal knowledge is connected with online resources. The problem now is not that there are too few resources, but that there are too many, and it is hard to choose from these resources as they are of mixed qualities. This course explains the system structure of teachers' personal knowledge management, the classification of resources and integrated approaches to management, which is of great benefit for teachers to clarify their personal knowledge system and improve their work and learning efficiency. )As the single-layer attention mechanism often focuses on the words with strong sentiment expressions, such as \" (too few resources),\" \" (mixed resources differ in quality)\", and \" (there is no way to choose)\", resulting in the misjudgment of sentiment polarity. Therefore, this paper proposes the use of a hierarchical attention mechanism to deal with the sentiment analysis of online course reviews. Though CNN and LSTM are often combined for text sentiment analysis, such as [18; 19], there is still a lack of effective ways to take advantage of useful information (e.g., historical, global, and local information) extracted by them. Therefore, this paper uses the gate mechanism to further select useful local information. The significance of this study may be declared as follows:  
First, this study indicated that the single-layer attention mechanism cannot accurately identify the sentiment words that are useful for global information. When human beings know that they need to carry out sentiment analysis task of short texts, they will first pay attention to the sentiment words in the sentence and then read the sentence from the beginning to the end to judge which sentiment words are more important, and to obtain the sentiment polarity of the sentence. According to this and the human's way of sentiment analysis of reading text, this study designs a hierarchical interactive attention mechanism, obtains the local features of sentences through CNN, and obtains the global information and the temporal features of sentences by using LSTM. Then the gate mechanism filters the local sentiment information. At the same time, the local sentiment word information extracted by CNN can enrich the hidden layer representation extracted by LSTM, and then the sentiment polarity of the sentence can be obtained after the information is weighted by the hierarchical attention mechanism. Second, in the design of the attention mechanism, this study preserves original information through the connection way of residuals. The experiment shows that the hierarchical attention mechanism is effective in the sentiment analysis of online course reviews.