A method, system, medium and computing device for fine-grained text sentiment analysis

By combining the BERT, BiLSTM, BiGRU, and LDA models, the deep semantics and contextual information of the text are extracted, which solves the problem of insufficient accuracy of fine-grained sentiment analysis in existing technologies and achieves more efficient text sentiment analysis.

CN116108840BActive Publication Date: 2025-09-09BEIJING UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310124542.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-16
Publication Date
2025-09-09
Estimated Expiration
2043-02-16

AI Technical Summary

Technical Problem

Existing fine-grained sentiment analysis methods still have room for improvement in accuracy, especially as deep learning technology is less used, making it difficult to effectively analyze the various emotional tendencies in text reviews.

Method used

The BERT model is used for word vectorization, combined with the BiLSTM and BiGRU models to extract global and local feature information, and optimized through the attention mechanism, combined with the LDA topic model for topic extraction and fine-grained sentiment analysis.

Benefits of technology

It improves the accuracy of fine-grained sentiment analysis of texts, can more accurately predict the sentiment tendencies and thematic sentiment tendencies of texts, and enhances the accuracy of sentiment classification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116108840B_ABST
    Figure CN116108840B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, system, medium, and computing device for fine-grained text sentiment analysis. The method comprises: using a BERT model to perform word vectorization on comment text in a preprocessed dataset; using a BiLSTM+Attention and BiGRU+Attention dual-channel model to extract global and local features of the comment text word vectors, respectively, and training a neural network model for sentiment analysis; using an LDA topic model to perform topic extraction on the preprocessed dataset to obtain topic-attribute words; screening short sentences in the dataset that contain attribute words and labeling the corresponding topics; and inputting the topic-labeled short sentence set into the trained neural network model to obtain the sentiment tendency of each topic. The present invention's fine-grained sentiment analysis method based on BERT+BiLSTM+BiGRU+LDA can effectively improve the accuracy of fine-grained text sentiment analysis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of natural language processing, and relates to a text fine-grained sentiment analysis method, and specifically to a text fine-grained sentiment analysis method, system, medium and computing device based on Bert+BiLSTM+BiGRU+LDA. Background Art

[0002] In today's world, with the rapid development of science and technology and the continuous innovation of information technology, the internet is playing an increasingly important role in people's daily work, study, and life, profoundly changing their lifestyles. With the development of mobile network devices, people's production, life, and work are becoming increasingly intelligent. The number of various types of apps is increasing day by day, gradually covering all aspects of people's lives. When people use apps, they have various feelings, and they express their experience through online reviews of the apps they use. Text reviews generally contain sentiment across multiple aspects. For example, apps may include evaluations of various aspects such as functionality and page layout. Reviewers may have positive sentiment towards functionality but negative sentiment towards page layout. Analyzing the sentiment of text reviews across various aspects is called fine-grained sentiment analysis, which is a difficult area in natural language processing.

[0003] Sentiment analysis primarily involves predicting the sentiment of texts with subjective emotional tendencies through text preprocessing, semantic analysis, and summarization. Based on the granularity of the analysis, it can be categorized into paragraph-level sentiment analysis, sentence-level sentiment analysis, and attribute-level sentiment analysis. Attribute-level sentiment analysis is also known as fine-grained sentiment analysis. Fine-grained sentiment analysis can be divided into two main steps: extracting and identifying the topics (aspects) described in the text, and performing sentiment analysis on the sentiment of each topic. Topic extraction generally uses machine learning methods, such as the PageRank algorithm, the LDA topic model, and HowNet-based text clustering. Sentiment analysis on the sentiment of each topic is primarily based on sentiment lexicons, machine learning, and deep learning. Sentiment analysis based on sentiment lexicons relies heavily on the construction of sentiment lexicons, which require continuous updating and maintenance to ensure their quality. Traditional machine learning methods primarily utilize classifiers such as Naive Bayes, Support Vector Machines, and K-Nearest Neighbors for sentiment analysis.

[0004] Recently, deep learning techniques have been increasingly applied to natural language research. Convolutional neural networks, long-short-term memory networks, and attention mechanisms are widely used in this field, particularly in sentiment analysis. These techniques can learn deep information from text, improving the accuracy of sentiment classification to a certain extent. However, deep learning methods are still relatively unused in fine-grained sentiment analysis, and there is room for further improvement in accuracy. Summary of the Invention

[0005] In response to the deficiencies in the prior art, the present invention provides a method, system, medium and computing device for fine-grained text sentiment analysis.

[0006] The present invention discloses a text fine-grained sentiment analysis method, comprising:

[0007] Get the review text dataset;

[0008] Preprocessing the review text dataset, wherein the preprocessing includes data cleaning and data labeling;

[0009] The Bert model is used to vectorize the comment text in the preprocessed data set to obtain the comment text word vector;

[0010] The word vectors of the review text are input into the BiLSTM+Attention model for coarse-grained sentiment analysis, which extracts the global feature information of the text and optimizes the global features through the attention mechanism.

[0011] The word vectors of the review text are input into the BiGRU+Attention model for coarse-grained sentiment analysis, which extracts local feature information of the text and optimizes the local features through the attention mechanism.

[0012] The optimized global features and local features are fused to obtain the final text sentiment feature representation; the fused feature representation is output through a fully connected layer and a softmax activation function to predict the sentiment tendency of the entire sentence; and finally, a neural network model for sentiment analysis is obtained after training.

[0013] The LDA topic model is used to extract topics from the preprocessed dataset to obtain topic-attribute words; short sentences containing attribute words in the dataset are screened and the corresponding topics are marked;

[0014] The set of short sentences marked with topics is input into the trained neural network model for fine-grained sentiment analysis to obtain the sentiment tendency of each topic.

[0015] As a further improvement of the present invention, a web crawler technology is used to obtain a review text dataset.

[0016] As a further improvement of the present invention, the data cleaning includes removing irrelevant text and repeated comment text, wherein the irrelevant text includes but is not limited to abbreviations, emoticons, repeated punctuation marks and unclear sentences;

[0017] The data annotation method includes but is not limited to annotating the reviews with the review rating information, where 0-2 points are marked as negative, 3 points are marked as neutral, and 4-5 points are marked as positive.

[0018] As a further improvement of the present invention, the word vector of the review text is input into the BiLSTM+Attention model to perform coarse-grained sentiment analysis, extract the global feature information of the text, and optimize the global features through the attention mechanism; including:

[0019] Based on the hidden state of the previous moment and the word vector of the comment text at the current moment, calculate the forget gate, memory gate and temporary cell state at the current moment;

[0020] Calculate the current cell state based on the forget gate, memory gate, temporary cell state, and cell state at the previous moment;

[0021] Calculate the hidden state at the previous moment based on the hidden state at the previous moment, the input word at the current moment, and the cell state at the current moment;

[0022] The hidden states calculated by the BiLSTM forward sequence and backward sequence are concatenated to obtain global feature information;

[0023] The global feature information is input into the attention layer, and the global features are optimized through the attention mechanism to obtain the optimized global features.

[0024] As a further improvement of the present invention, the word vector of the review text is input into the BiGRU+Attention model to perform coarse-grained sentiment analysis, extract local feature information of the text, and optimize the local features through the attention mechanism; including:

[0025] Input the comment text word vector into BiGRU, where BiGRU consists of a forward and backward GRU sequence;

[0026] Concatenate the hidden states calculated by the BiGRU forward sequence and backward sequence to obtain local feature information;

[0027] The local feature information is input into the attention layer, and the local features are optimized through the attention mechanism to obtain the optimized local features.

[0028] As a further improvement of the present invention, the optimized global features and local features are fused to obtain a final text sentiment feature representation; the fused feature representation is output through a fully connected layer and a softmax activation function to predict the sentiment tendency of the entire sentence; and finally a neural network model for sentiment analysis is obtained through training; including:

[0029] The optimized global features and local features are fused in the form of row vector splicing to obtain the final text sentiment feature representation;

[0030] The fused feature representation is input into the fully connected layer and mapped into a vector of size 3;

[0031] The output of the fully connected layer is input into the Softmax activation function, and the sentiment classification calculation is performed through the Softmax layer and the sentiment classification result is output;

[0032] A neural network model for sentiment analysis is trained based on the sentiment classification results.

[0033] As a further improvement of the present invention, the LDA topic model is used to extract topics from the preprocessed data set to obtain topic-attribute words; short sentences containing attribute words in the data set are screened and marked with corresponding topics; including:

[0034] Perform word segmentation on the preprocessed data set;

[0035] Input the segmented text into the LDA topic model, extract topics based on the preset number of topics, and ultimately obtain N topics and M attribute words related to them;

[0036] Based on the attribute words obtained, short sentences with the attribute words are screened out, and the short sentences are labeled with corresponding topics based on the attribute words. Among them, when multiple attribute words are screened out in a comment, the comment needs to be segmented to obtain multiple short sentences with the attribute words.

[0037] The present invention also discloses a text fine-grained sentiment analysis system, comprising:

[0038] Acquisition module, used to obtain comment text dataset;

[0039] A preprocessing module, configured to preprocess the review text dataset, wherein the preprocessing includes data cleaning and data labeling;

[0040] The word vectorization module is used to use the BERT model to vectorize the comment text in the preprocessed dataset to obtain the comment text word vector;

[0041] The global feature extraction module is used to input the comment text word vectors into the BiLSTM+Attention model for coarse-grained sentiment analysis, extract the global feature information of the text, and optimize the global features through the attention mechanism;

[0042] The local feature extraction module is used to input the comment text word vector into the BiGRU+Attention model for coarse-grained sentiment analysis, extract the local feature information of the text, and optimize the local features through the attention mechanism;

[0043] The training module is used to fuse the optimized global features and local features to obtain the final text sentiment feature representation; the fused feature representation is output through a fully connected layer and a softmax activation function to predict the sentiment tendency of the entire sentence; and finally, the neural network model for sentiment analysis is obtained after training.

[0044] The topic extraction module is used to extract topics from the preprocessed dataset using the LDA topic model to obtain topic-attribute words; it also filters short sentences containing attribute words in the dataset and labels the corresponding topics;

[0045] The analysis module is used to input a set of short sentences labeled with topics into a trained neural network model for fine-grained sentiment analysis to obtain the sentiment tendency of each topic.

[0046] The present invention also discloses a computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, causes the processor to execute the above-mentioned text fine-grained sentiment analysis method.

[0047] The present invention also discloses a computing device, comprising: one or more memories storing executable instructions; and one or more processors executing the executable instructions to implement the above-mentioned text fine-grained sentiment analysis method.

[0048] Compared with the prior art, the present invention has the following beneficial effects:

[0049] The present invention introduces relevant technologies in deep learning to perform fine-grained sentiment analysis, such as using the BERT model to vectorize text words. The generated word vectors contain deep semantic information and also integrate contextual information; an attention mechanism is added after the BiLSTM model and the BiGRU model respectively. When the information of each word is integrated, the more important words have higher weights and integrate more information; the fine-grained sentiment analysis method finally constructed based on Bert+BiLSTM+BiGRU+LDA can effectively improve the accuracy of fine-grained sentiment analysis of text. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1This is a flowchart of a method for fine-grained sentiment analysis of text disclosed in an embodiment of the present invention;

[0051] Figure 2 This is a structural diagram of the Bert model disclosed in one embodiment of the present invention.

[0052] Figure 3 This is a structural diagram of a single LSTM neuron disclosed in one embodiment of the present invention.

[0053] Figure 4 This is a structural diagram of a BiLSTM disclosed in one embodiment of the present invention;

[0054] Figure 5 A schematic diagram of a GRU neuron structure disclosed in one embodiment of the present invention;

[0055] Figure 6 A schematic diagram of the BiGRU network structure disclosed in an embodiment of the present invention. DETAILED DESCRIPTION

[0056] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.

[0057] The present invention is described in further detail below with reference to the accompanying drawings:

[0058] like Figure 1 As shown, the present invention provides a text fine-grained sentiment analysis method based on Bert+BiLSTM+BiGRU+LDA, comprising:

[0059] Step 1: Get the review text dataset;

[0060] Specifically:

[0061] Crawler technology is used to crawl the review content of an App in the software application store, and a review text dataset is manually constructed, with each review text as a sentence or short sentence.

[0062] Step 2: Preprocess the comment text dataset, which includes data cleaning and data labeling;

[0063] Specifically:

[0064] Data cleaning involves removing irrelevant text and duplicate comments. The raw data scraped by the crawler often contains a lot of irrelevant text, such as a large number of abbreviations, emoticons, repeated punctuation, ambiguous sentences, and comments that only contain star ratings but no text. These texts lack sentiment and useful information and only seriously interfere with text expression, making sentiment analysis difficult to perform accurately. Therefore, these interfering texts must be removed. Additionally, some comments in the dataset are duplicated, so these duplicate comments must be removed.

[0065] Data annotation includes but is not limited to labeling reviews with their rating information, such as marking 0-2 points as negative, 3 points as neutral, and 4-5 points as positive.

[0066] Step 3: Use the Bert model to vectorize the comment text in the preprocessed data set to obtain the comment text word vector;

[0067] Bert is a word vector pre-training model based on the bidirectional Transformer encoder structure. The input embedding of the Bert model consists of three embeddings: position embedding, fragment embedding and word embedding. Since Bert can take sentence pairs as input, the fragment embedding indicates whether the word is in the first sentence or the second sentence, and the position embedding indicates the position of the word in the sentence. The pre-training process of Bert mainly includes two tasks including the masked language model and the next sentence prediction, which can ensure that Bert can extract dynamic and deep information from the text. Bert can extract contextual information in the true sense by combining the two tasks to realize the vectorization of text and the extraction of semantic information. The input sequence of the Bert model consists of position embedding, word embedding and fragment embedding. The input is each comment data in the text dataset, and the output is the word vector calculated after the characters and words of the comment text are integrated with the global semantic information. Figure 2 As shown in the figure, X1, X2,…, Xn is the output word vector sequence of the BERT model.

[0068] Step 4: Use the word vectors from step 3 as the input of the BiLSTM model. The BiLSTM model extracts the global feature information of the text and follows the BiLSTM model with an attention layer to assign a larger weight score to sentiment words.

[0069] Specifically include:

[0070] Step 41: Since the LSTM model can only read text in a single direction and cannot effectively obtain context information, the present invention uses a BiLSTM model, i.e., a bidirectional long short-term memory network model, which consists of a forward LSTM and a backward LSTM, respectively used to train the forward sequence and the backward sequence, which can effectively solve the sequence problem. Figure 3 and Figure 4 shown.

[0071] The specific algorithm formula and analysis are as follows:

[0072] Calculation of the forget gate: f t =σ(W f ×[h t-1 , x t ]+b f ), the input contains the hidden state h of the previous moment t-1 and the current input word x t , after the calculation of the forget gate, the value of the forget gate f can be obtained t Among them, W f and b f are the weight matrix and bias vector respectively.

[0073] Memory gate calculation: i t =σ(W i ×[h t-1 , x t ]+b i ), The input contains the hidden state h of the previous moment t-1 and the current input word x t , after the calculation of the memory gate, the value of the memory gate i can be obtained t and temporary cell states Among them, W i and b i are the weight matrix and bias vector respectively.

[0074] Calculation of the cell state at the current moment: The input contains the value i of the memory gate t , the value of the forget gate f t , temporary cell state and the cell state C at the previous moment t-1 , the output is the cell state C at the current moment t .

[0075] Calculation of the output gate and the hidden state at the current moment: o t =σ(W o [h t-1 ,x t ]+bo ), h t =o t *tanh(C t ), the input contains the hidden state h of the previous moment t-1 , the input word x at the current moment t and the current cell state C t , the output is the value o of the output gate t and hidden state h t , where W o and b o are the weight matrix and bias vector respectively.

[0076] For the bidirectional long short-term memory network model, after training the forward sequence and the backward sequence, h can be obtained. L and h R , respectively h L and h R By splicing, we can get the output data h t (t=1,2,…,n).

[0077] Step 42: Use the output of step 41 as the input of the attention layer. Under the action of the global attention mechanism, important sentences in the entire review text can be assigned larger weight scores, highlighting their importance in the text sequence, thereby increasing the classification accuracy.

[0078] The specific algorithm formula and analysis are as follows:

[0079] u t =tanh(w s h t +b s )

[0080]

[0081]

[0082] Among them, W s and b s They are the weight matrix and offset vector of the global attention mechanism of the attention layer, h t is the output of the BiLSTM network. t The result is h t Each element in the sequence is related to h t The correlation of the sequence, α t Represents the attention score of the global feature, u s is an initial training parameter; V is the feature vector obtained by the attention layer under the action of the attention mechanism, that is, the output of the attention layer.

[0083] Step 5: Use the word vectors from step 3 as the input of the BiGRU model. The BiGRU model is used to extract local feature information of the text. An attention layer is added after the BiGRU model to capture words that contribute more to the sentiment semantics in a single sentence and assign a larger weight score to the sentiment words.

[0084] Specifically include:

[0085] Step 51, GRU is a deep learning network model that improves LSTM. It can also solve the problem of long-term dependence in recurrent neural networks. It is easier to calculate and implement than LSTM, and its internal structure is simpler than LSTM. Figure 5 As shown, the algorithm and analysis of GRU network update are as follows:

[0086] r t =σ(w r ·[h t-1 ,x t ])

[0087] z t =σ(w z ·[h t-1 ,x t ])

[0088]

[0089] h t =(1-z t )*h t-1 +z t *h t

[0090] Among them, r t and z t They are the reset gate and update gate at time t, h t-1 is the hidden state at time t-1, is the candidate activation state at time t, h t is the activation state at time t, w r 、w z , w are the corresponding weight matrices, and σ is the representation of the sigmoid activation function. The update gate is determined by the historical information that needs to be forgotten at the current moment and the new information received; the reset gate is determined by the information obtained by the candidate state from the historical information.

[0091] like Figure 6 As shown in Figure 1, BiGRU consists of a forward and backward GRU sequence, which can make full use of context information. The output state of the BiGRU network model at time t is composed of the output concatenation of the forward GRU network and the backward GRU network, and its calculation method is:

[0092]

[0093]

[0094]

[0095] Among them, x t Represents the output at the current moment, T represents the length of the time series, and the output of BiGRU can be obtained by concatenating the output of the forward GRU and the output of the backward GRU.

[0096] Step 52: Use the output of step 51 as the input of the attention layer. Under the action of the local attention mechanism, words with greater emotional semantics in a single sentence can be captured and assigned a larger weight score, highlighting their importance in the text sequence, thereby increasing the classification accuracy.

[0097] The specific algorithm formula and analysis are as follows:

[0098] u t =tanh(w w h t +b w )

[0099]

[0100]

[0101] Among them, W w with b w is the weight matrix and bias vector of the local attention mechanism of the attention layer, h t is the output of the BiGRU network. t The result is h t Each element in the sequence is related to h t The correlation of the sequence, α t Indicates the attention score of local features, u w is an initial training parameter; V is the feature vector obtained by the attention layer under the action of the attention mechanism, that is, the output of the attention layer.

[0102] Step 6: Fuse the optimized global features and local features to obtain the final text sentiment feature representation; pass the fused feature representation through the fully connected layer and softmax activation function to obtain the output and predict the sentiment tendency of the entire sentence; finally, after training, obtain the neural network model for sentiment analysis;

[0103] Specifically include:

[0104] Step 61: In order to facilitate the calculation of the model, the features of the dual-channel model are processed in the form of row vector splicing, that is, feature fusion. Construct a (r s +r e )×c matrix V*, the concatenated matrix is ​​used as the final emotional feature vector, where V s is the output of the BiLSTM channel plus attention layer, V e is the output of the BiGRU channel plus the attention layer, r s and r e They are V s Matrix and V e The number of rows in the matrix, c is V s Matrix or V e The number of columns in the matrix.

[0105] Step 62: Input the output of step 61 into a fully connected layer to map it into a vector of size 3, and then pass it through the softmax activation function to obtain the final output, which is the predicted probability distribution, that is, the predicted probability of the sentiment tendency of the input sentence being positive, neutral, or negative;

[0106] Step 63: Train a neural network model for sentiment analysis based on the sentiment classification results.

[0107] Step 7: Use the LDA topic model to extract topics from the dataset preprocessed in step 2 to obtain topic-attribute words. The attribute words clustered together are words that describe the same topic. The short sentences with these attribute words are commenting on this topic. Filter out the short sentences with attribute words and mark them with the corresponding topics.

[0108] Specifically include:

[0109] Step 71, the LDA topic model is mainly used to infer the topic distribution of documents and can be used to identify potential topic information in texts. The LDA model believes that topics can be represented by a vocabulary distribution, and articles can be represented by a topic distribution. According to the LDA model, if you want to generate an article, you need to determine the distribution of topics and vocabulary, determine the distribution of documents and topics, and then randomly generate a topic based on the distribution of documents and topics. Then, based on this topic, randomly generate a word through the distribution of topics and vocabulary, and repeat the process of generating words until a complete document is generated. The distribution of documents and topics is to sample the topic distribution of documents from the Dirichlet distribution α, while the distribution of topics and vocabulary is to sample the vocabulary distribution corresponding to the topic from the Dirichlet distribution β.

[0110] The jieba word segmentation tool is used to segment the data set preprocessed in step 2, and then the processed text is input into the LDA topic model. The number of topics generated after clustering is set to 5, and finally 5 topics are obtained. In addition, the attribute words under each topic are obtained. The attribute words clustered together are all describing the same topic. The 10 attribute words with the highest frequency under each topic are selected, and a suitable topic word is inferred based on these 10 attribute words. Finally, 5 topic words are obtained, and each topic word has 10 attribute words related to it.

[0111] Step 72: Based on the attribute words obtained in step 71, short sentences containing the attribute words are selected. Multiple attribute words may appear in a single comment, so the comment needs to be segmented to obtain multiple short sentences containing the attribute words. The short sentences are labeled with the corresponding topics based on the attribute words.

[0112] In step 8, the topic-labeled short sentences obtained in step 7 are fed into the model trained in step 6 for sentiment analysis. This allows us to determine the sentiment trends across various topics, thus achieving fine-grained sentiment analysis. For each review, the resulting short sentences can be used to determine the sentiment trends across the multiple topics described. By summarizing the sentiment trends across the entire short sentence set, we can also derive evaluations of various topics and aspects of the app, providing a comprehensive and systematic evaluation of the book.

[0113] Step 9: Experimental analysis

[0114] To verify the performance of the model, a sentiment binary classification experiment was conducted on the Tan Songbo hotel review dataset, which is a typical dataset in sentiment analysis tasks, and compared with other baseline models. The experiment used common evaluation indicators to evaluate the sentiment classification effect of the model, namely loss, accuracy Acc, correctness Pre, and comprehensive evaluation indicator F1. The F1 value is a combination of precision and recall. The comparison of these indicators obtained through comparative experiments verified the effectiveness of the method, thereby providing data support for the effectiveness of the model in fine-grained sentiment analysis.

[0115] The experimental results are shown in Table 1:

[0116] Table 1

[0117]

[0118] The present invention also provides a text fine-grained sentiment analysis system, comprising:

[0119] Obtain a module for implementing the above step 1;

[0120] A preprocessing module, used to implement the above step 2;

[0121] The word vectorization module is used to implement step 3 above;

[0122] Global feature extraction module, used to implement the above step 4;

[0123] Local feature extraction module, used to implement the above step 5;

[0124] A training module, used to implement the above step 6;

[0125] Theme extraction module, used to implement the above step 7;

[0126] The analysis module is used to implement the above step 8.

[0127] The present invention also provides a computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, causes the processor to execute the above-mentioned text fine-grained sentiment analysis method.

[0128] The present invention also provides a computing device, comprising: one or more memories storing executable instructions; and one or more processors executing the executable instructions to implement the above-mentioned text fine-grained sentiment analysis method.

[0129] The advantages of the present invention are:

[0130] The present invention first obtains word vectors containing deep semantic information through BERT word vectorization, and then inputs the word vectorized text into a dual-channel model composed of BiLSTM and BiGRU, wherein the global feature information of the comments is extracted by using the BiLSTM channel plus the attention layer, and the local feature information of the comments is extracted by using the BiGRU channel plus the attention layer. The feature information extracted by the two channels is then fused, which can fully extract the feature information of the comment text, thereby effectively improving the subsequent prediction effect of sentiment tendency. The topic clustering is performed through the LDA topic model to obtain the topic described in the text, so that sentiment analysis can be performed at the granularity of the topic level. Combined with the cutting-edge deep learning model of Bert+BiLSTM+BiGRU, the accuracy of fine-grained sentiment analysis of text is finally improved to a certain extent.

[0131] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention shall be included within the scope of protection of the present invention.

Claims

1. A fine-grained text sentiment analysis method, characterized in that: include: Get the review text dataset; Preprocessing the review text dataset, wherein the preprocessing includes data cleaning and data labeling; The Bert model is used to vectorize the comment text in the preprocessed data set to obtain the comment text word vector; The word vectors of the review text are input into the BiLSTM+Attention model for coarse-grained sentiment analysis, which extracts the global feature information of the text and optimizes the global features through the attention mechanism. The word vectors of the review text are input into the BiGRU+Attention model for coarse-grained sentiment analysis, which extracts local feature information of the text and optimizes the local features through the attention mechanism. The optimized global features and local features are fused to obtain the final text sentiment feature representation; the fused feature representation is output through a fully connected layer and a softmax activation function to predict the sentiment tendency of the entire sentence; and finally, a neural network model for sentiment analysis is obtained after training. The LDA topic model is used to extract topics from the preprocessed dataset to obtain topic-attribute words; short sentences containing attribute words in the dataset are screened and the corresponding topics are marked; The set of short sentences marked with topics is input into the trained neural network model for fine-grained sentiment analysis to obtain the sentiment tendency of each topic.

2. The text fine-grained sentiment analysis method according to claim 1, characterized in that Web crawler technology is used to obtain review text datasets.

3. The text fine-grained sentiment analysis method according to claim 1, characterized in that The data cleaning includes removing irrelevant text and repeated comment text, wherein the irrelevant text includes but is not limited to abbreviations, emoticons, repeated punctuation marks and unclear sentences; The data annotation method includes but is not limited to annotating the reviews with the review rating information, where 0-2 points are marked as negative, 3 points are marked as neutral, and 4-5 points are marked as positive.

4. The text fine-grained sentiment analysis method according to claim 1, characterized in that The review text word vectors are input into the BiLSTM+Attention model for coarse-grained sentiment analysis, global feature information of the text is extracted, and the global features are optimized through the attention mechanism; including: Based on the hidden state of the previous moment and the word vector of the comment text at the current moment, calculate the forget gate, memory gate and temporary cell state at the current moment; Calculate the current cell state based on the forget gate, memory gate, temporary cell state, and cell state at the previous moment; Calculate the hidden state at the previous moment based on the hidden state at the previous moment, the input word at the current moment, and the cell state at the current moment; The hidden states calculated by the BiLSTM forward sequence and backward sequence are concatenated to obtain global feature information; The global feature information is input into the attention layer, and the global features are optimized through the attention mechanism to obtain the optimized global features.

5. The text fine-grained sentiment analysis method according to claim 1, characterized in that The review text word vector is input into the BiGRU+Attention model for coarse-grained sentiment analysis, local feature information of the text is extracted, and the local features are optimized through the attention mechanism; including: Input the comment text word vector into BiGRU, where BiGRU consists of a forward and backward GRU sequence; Concatenate the hidden states calculated by the BiGRU forward sequence and backward sequence to obtain local feature information; The local feature information is input into the attention layer, and the local features are optimized through the attention mechanism to obtain the optimized local features.

6. The text fine-grained sentiment analysis method according to claim 1, characterized in that The optimized global features and local features are fused to obtain the final text sentiment feature representation; the fused feature representation is output through a fully connected layer and a softmax activation function to predict the sentiment tendency of the entire sentence; and finally, a neural network model for sentiment analysis is obtained through training; including: The optimized global features and local features are fused in the form of row vector splicing to obtain the final text sentiment feature representation; The fused feature representation is input into the fully connected layer and mapped into a vector of size 3; The output of the fully connected layer is input into the Softmax activation function, and the sentiment classification calculation is performed through the Softmax layer and the sentiment classification result is output; A neural network model for sentiment analysis is trained based on the sentiment classification results.

7. The text fine-grained sentiment analysis method according to claim 1, characterized in that The method uses the LDA topic model to extract topics from the preprocessed data set to obtain topic-attribute words; filters short sentences containing attribute words in the data set and marks the corresponding topics; including: Perform word segmentation on the preprocessed data set; Input the segmented text into the LDA topic model, extract topics based on the preset number of topics, and ultimately obtain N topics and M attribute words related to them; Based on the attribute words obtained, short sentences with the attribute words are screened out, and the short sentences are labeled with corresponding topics based on the attribute words. Among them, when multiple attribute words are screened out in a comment, the comment needs to be segmented to obtain multiple short sentences with the attribute words.

8. A text fine-grained sentiment analysis system that implements the text fine-grained sentiment analysis method according to any one of claims 1 to 7, characterized in that: include: Acquisition module, used to obtain comment text dataset; A preprocessing module, configured to preprocess the review text dataset, wherein the preprocessing includes data cleaning and data labeling; The word vectorization module is used to use the BERT model to vectorize the comment text in the preprocessed dataset to obtain the comment text word vector; The global feature extraction module is used to input the comment text word vectors into the BiLSTM+Attention model for coarse-grained sentiment analysis, extract the global feature information of the text, and optimize the global features through the attention mechanism; The local feature extraction module is used to input the comment text word vector into the BiGRU+Attention model for coarse-grained sentiment analysis, extract the local feature information of the text, and optimize the local features through the attention mechanism; The training module is used to fuse the optimized global features and local features to obtain the final text sentiment feature representation; the fused feature representation is output through a fully connected layer and a softmax activation function to predict the sentiment tendency of the entire sentence; and finally, the neural network model for sentiment analysis is obtained after training. The topic extraction module is used to extract topics from the preprocessed dataset using the LDA topic model to obtain topic-attribute words; it also filters short sentences containing attribute words in the dataset and labels the corresponding topics; The analysis module is used to input a set of short sentences labeled with topics into a trained neural network model for fine-grained sentiment analysis to obtain the sentiment tendency of each topic.

9. A computer-readable storage medium, characterized in that Executable instructions are stored thereon, and when the instructions are executed by a processor, the processor executes the text fine-grained sentiment analysis method according to any one of claims 1-7.

10. A computing device, characterized in that include: one or more memories storing executable instructions; One or more processors execute the executable instructions to implement the text fine-grained sentiment analysis method according to any one of claims 1-7.

Citation Information

Patent Citations

  • A topic text-oriented interactive attention coding sentiment analysis method

    CN109885670A

  • Emotion analysis method based on improved CNN-LDA

    CN109977413A