Text sentiment analysis method and system of M-BiLSTM model
Through the integration of multiple syntax parsers and the combination of M-BiLSTM model, the problem of inaccurate syntax analysis of a single syntax parser in complex long sentences is solved, the accuracy of emotion classification and the utilization of context information are improved, and more accurate emotion analysis is achieved .
Patent Information
- Application Number
- CN202410839690.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-12-13
AI Technical Summary
In the prior art, a single syntax parser has the problem of inaccurate syntax analysis results when processing complex long sentences, which leads to a reduction in the accuracy of sentiment analysis and makes it difficult to make full use of the context information of the text.
The M-BiLSTM model is fused with multiple syntax parsers. The input data is syntactically parsed through multiple external syntax parsers. The parsing tree is fused to generate a new syntax parsing tree, and a syntax enhancement graph is constructed, combining the BERT model and graph convolution network. (GCN) extracts rich aspect-level emotional representations.
It effectively improves the accuracy of emotion classification, reduces syntactic analysis errors, makes full use of the context information of the text, provides a more fine-grained and rich emotional representation, and enhances the robustness and generalization ability of the system.
Smart Images

Figure CN119129576A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of natural language processing, and in particular relates to a text sentiment analysis method and system based on an M-BiLSTM model fused with multiple syntactic parsers. Background Art
[0002] Sentiment analysis refers to the use of data mining algorithms to automatically analyze and judge the sentiment tendency of texts containing emotional attitudes. This technology can help people better understand the public opinion on a certain event or product. In recent years, with the rapid development of information technology, users have expressed and conveyed emotions through online platforms, generating a large amount of user-involved comment information. This information contains people's emotional colors such as joy, anger, sadness, and happiness, as well as emotional tendencies such as criticism and praise. The application of sentiment analysis is very wide and can be used in many fields such as business, politics, and social interaction.
[0003] In natural language processing (NLP), syntactic analysis is an important technology that reveals syntactic structure by analyzing the dependencies between components within a language unit. The accuracy of syntactic structure has an important impact on sentiment analysis tasks. When processing complex and long sentences, syntactic ambiguity often occurs, resulting in inaccurate syntactic analysis results, which in turn affects the accuracy of sentiment analysis. Current studies have shown that integrating aspect semantic information with opinion word information can effectively improve the accuracy of aspect word classification. However, most of the current graph neural network models directly construct graph structures on the syntactic parse tree. Once the parsing result of the syntactic parser is wrong, the noise will spread from the output of the model to the final classification result, causing negative impacts.
[0004] Through the above analysis, the problems and defects of the prior art are as follows:
[0005] A single syntax parser has the problem of inaccurate syntactic analysis results when parsing complex and long sentences with syntactic ambiguity. Summary of the invention
[0006] In view of the problems existing in the prior art, the present invention provides a text sentiment analysis method and system based on an M-BiLSTM model fused with multiple syntactic parsers.
[0007] The present invention is implemented in this way: a text sentiment analysis method based on an M-BiLSTM model fused with multiple syntactic parsers, wherein the text sentiment analysis method based on the M-BiLSTM model fused with multiple syntactic parsers first uses multiple external syntactic parsers to perform syntactic parsing on input data to obtain multiple syntactic parsing trees, and adaptively selects the most suitable parser or parser combination according to the type and complexity of the sentence; then executes a syntactic parsing tree fusion algorithm on the multiple parse trees to obtain a new syntactic parsing tree, and then constructs a corresponding graph structure for the new syntactic parsing tree to obtain a syntactic enhancement graph; the preprocessed text is input into a Bert layer module to obtain a dynamic word vector, and then a bidirectional long short-term memory neural network LSTM fused with a Mogrifier structure is used to capture an important part of the text context information to obtain a hidden context representation of the input sentence, and then the hidden context representation and the syntactic enhancement of the sentence are combined. Figure 1 The data is then input into the graph convolutional network GCN to extract important sentiment dependencies about specific aspects, and finally the final sentiment classification is performed. The specific steps include:
[0008] Step 1: After receiving the original text, segment the original text to obtain multiple words or phrases;
[0009] Step 2: Divide the processed words or phrases into training sets and test sets according to a certain ratio;
[0010] Step 3: Use the Bert model to vectorize the above words or phrases;
[0011] Step 4: Send the above words or phrases to multiple external syntactic parsers to perform syntactic parsing on the input data to obtain multiple syntactic parse trees, and then execute the syntactic parse tree fusion algorithm on the multiple parse trees to obtain a new syntactic parse tree, and then construct a corresponding graph structure for the new syntactic parse tree to obtain a syntactic enhancement graph;
[0012] Step 5: After obtaining the text vectorization representation provided by the Bert model, pass the data to the M-BiLSTM model to capture the bidirectional context information of the text, extract and combine important features in the text, and obtain the hidden context representation of the input sentence;
[0013] Step 6: Represent the hidden context and syntactic enhancement of the sentence Figure 1 The resulting datasets are fed into a graph convolutional network (GCN) to exploit the syntactic information of the context and the word dependencies of the aspects and extract rich aspect-level sentiment representations.
[0014] Furthermore, in step 4, the specific implementation method of the syntactic fusion algorithm is:
[0015] (1) Use three parsers to analyze a sentence W nPerform dependency parsing to obtain three parsing arrays S1, S2, and S3;
[0016] (2) Create an empty array empty = [];
[0017] (3) The length of the array is L. The elements at the i-th position in the three analytical arrays are traversed to form a comparison array array i ;
[0018] (4) Traverse the comparison array array obtained from all positions of the parsed array i , count and compare the number of times each element appears in the array. If it is greater than half of the number of array elements, add it to empty[]. If it is less than half of the number of array elements, select the parser result with the most successful voting and screening as the result of this fusion. The syntactic fusion effect is as follows:
[0019]
[0020] Furthermore, in step 5, when the M-BiLSTM model is used to capture context information, the M-BiLSTM model is divided into an input layer, a forward layer, a backward layer and an output layer. The update formula of the M-BiLSTM from forward to backward is:
[0021] x K =2σ(Q K h prev K-1)⊙x K-2 for odd K∈[1,…,r]
[0022]
[0023] Among them, the current input and hidden state are represented as x=x -1 and h prev -1 =h prev 0 ; The superscript K indicates the corresponding variable of the Kth interaction update; r is a hyperparameter, which indicates the number of interaction cycles. Different numbers of cycles produce different interaction effects. When the number of cycles is 0, it indicates an ordinary long short-term memory network.
[0024] Furthermore, in step 6, the syntactic enhancement graph is fed to the graph convolutional network (GCN) layer to learn the sentiment dependency of the given aspect, and then each node in the l-th layer GCN is updated according to the hidden representation of its neighborhood:
[0025]
[0026]
[0027] in is the hidden representation evolved from the previous GCN layer, F(·) is a position-aware transformation function, A i It is the syntactic enhancement graph obtained by fusing multiple syntactic parsers.
[0028] Another object of the present invention is to provide a text sentiment analysis system based on the M-BiLSTM model fused by multiple syntactic parsers, the text sentiment analysis system based on the M-BiLSTM model fused by multiple syntactic parsers comprising:
[0029] Input module, used to receive raw text and perform preprocessing;
[0030] Bert module, which uses Bert model vocabulary or phrases for vectorization processing;
[0031] Syntax parsing module, used to perform syntax parsing on input data;
[0032] The M-BiLSTM module uses the M-BiLSTM model to capture the bidirectional context information of the text, extract and combine important features in the text, and obtain the hidden context representation of the input sentence;
[0033] The GCN module uses the graph convolutional network (GCN) to exploit the syntactic information of the context and the word dependencies of the aspects to extract rich aspect-level sentiment representations.
[0034] Another object of the present invention is to provide a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the text sentiment analysis method based on the M-BiLSTM model fused with multiple syntactic parsers.
[0035] Another object of the present invention is to provide a computer-readable storage medium storing a computer program, which, when executed by a processor, enables the processor to perform the steps of the text sentiment analysis method based on the M-BiLSTM model fused with multiple syntactic parsers.
[0036] Another object of the present invention is to provide an information data processing terminal, which is used to implement the text sentiment analysis system based on the M-BiLSTM model fused with multiple syntactic parsers.
[0037] In combination with the above technical solutions and the technical problems solved, the advantages and positive effects of the technical solutions to be protected by the present invention are as follows:
[0038] First, the present invention proposes a solution to the problem of inaccurate syntactic analysis in existing sentiment analysis technologies. Most of the current graph neural network models directly construct graph structures on the syntactic parse tree. When a single syntactic parser processes complex and long sentences, syntactic ambiguity is prone to occur, resulting in inaccurate syntactic analysis results. Once the parsing result of the syntactic parser is wrong, the noise will spread from the output of the model to the final classification result, causing a negative impact and reducing the accuracy of sentiment classification. In addition, traditional sentiment analysis methods often find it difficult to fully utilize the contextual information of the text, resulting in poor performance when processing complex semantic relationships.
[0039] The present invention can effectively solve the problem of inaccurate syntactic analysis results when a single syntactic parser is used to parse complex and long sentences with syntactic ambiguity by combining the fusion of multiple syntactic parsers and the M-BiLSTM model, thereby improving the accuracy of sentiment classification. The present invention uses multiple external syntactic parsers to perform syntactic analysis on input data to obtain multiple syntactic parse trees. By adopting the method of fusion of multiple syntactic parsers, the advantages of different parsers can be comprehensively considered, the errors caused by a single parser can be reduced, and the error rate of syntactic analysis can be effectively reduced, thereby improving the accuracy of sentiment analysis.
[0040] The syntactic parse tree fusion algorithm is executed on multiple parse trees to generate a new syntactic parse tree. The specific method includes comparing the elements in the three parse arrays, counting the number of occurrences, and using a voting mechanism to select the optimal result to ensure that the fused syntactic parse tree is more accurate. The corresponding graph structure is constructed based on the new syntactic parse tree to form a syntactic enhancement graph. This graph structure can better reflect the dependency relationship and grammatical structure of the sentence, and provide more accurate grammatical information for subsequent sentiment analysis. This fusion strategy can make full use of the information of multiple parsers to obtain more comprehensive and accurate syntactic parsing results. The BERT model is used to vectorize the preprocessed text to obtain dynamic word vectors and capture the context information of each word in the text. By integrating the bidirectional long short-term memory neural network (M-BiLSTM) with the Mogrifier structure, the bidirectional context information of the text is further captured, important features are extracted and combined, and the hidden context representation of the input sentence is obtained, so that the sentiment analysis not only considers the syntactic information, but also makes full use of the context of the text, so as to more accurately analyze the sentiment tendency of the text. Introducing a graph convolutional network (GCN) to leverage the contextual syntactic information and word dependencies in the syntactic enhancement graph helps extract richer aspect-level sentiment representations. This approach can more deeply mine the semantic information of the text and provide stronger support for sentiment analysis.
[0041] The method of the present invention integrates a variety of syntactic parsers, has strong flexibility, and can adaptively select the most appropriate syntactic parser or parser combination according to different sentence types and complexities, so as to be applicable to text sentiment analysis tasks of different types and difficulties. The combination of the BERT model and the M-BiLSTM model enables the system to make full use of the contextual information of the text and more accurately capture the semantic features of the text. The GCN module extracts important sentiment dependencies in specific aspects through the syntactic enhancement graph, which can provide a more fine-grained and richer sentiment representation, providing more powerful support for sentiment analysis. By combining multiple models and algorithms, the robustness and generalization ability of the system are improved, so that it performs well in different application scenarios.
[0042] Second, the expected benefits and commercial value of the technical solution of the present invention after transformation are:
[0043] The present invention greatly improves the accuracy of text sentiment analysis and reduces classification errors caused by inaccurate syntactic parsing by combining multiple syntactic parsers and M-BiLSTM models. Accurate sentiment analysis can help companies better understand user emotions and feedback, thereby improving products and services and enhancing user satisfaction and loyalty. High-precision sentiment analysis results can provide strong data support for business decisions and help companies formulate more accurate marketing and customer service strategies. Sentiment analysis is widely used in e-commerce, social media, customer service systems, market research and other fields, and has huge market potential. By improving the accuracy of analysis, the present invention can significantly enhance the competitiveness of enterprises in these fields. As an innovative technical solution, the present invention can apply for relevant patent protection, add important technical assets to the company's intellectual property portfolio, and enhance its market value.
[0044] The technical solution of the present invention fills the technical gap in the industry at home and abroad: Most sentiment analysis technologies on the market currently rely on a single syntactic parser. The present invention effectively fills the technical gap of inaccurate syntactic analysis caused by a single parser by fusing multiple syntactic parsers. Traditional sentiment analysis methods often find it difficult to fully utilize contextual information. The present invention captures bidirectional contextual information through M-BiLSTM, and combines GCN to extract sentiment dependencies in the syntactic enhancement graph, filling the technical gap of insufficient use of contextual information. A new syntactic parse tree fusion algorithm is proposed, which integrates the parsing results of multiple parsers to further improve the accuracy of syntactic analysis, filling the shortcomings of existing methods in parsing complex and long sentences.
[0045] The technical solution of the present invention solves a technical problem that people have been eager to solve but have never succeeded in solving: syntactic ambiguity has always been a difficult problem in the field of natural language processing, especially in sentiment analysis, where accurate parsing of syntactic structure is crucial for sentiment classification. The present invention effectively solves the problem of inaccurate parsing caused by syntactic ambiguity through multi-syntactic parser fusion and parse tree fusion algorithms. In sentiment analysis, capturing accurate contextual information is crucial for understanding sentiment tendencies. The present invention successfully captures the bidirectional contextual information of the text through the combination of BERT and M-BiLSTM models, solving the problem that traditional methods are difficult to fully utilize contextual information. Parsing errors of a single parser will cause noise to propagate to the final classification result, which is an important problem in sentiment analysis. The present invention effectively reduces the noise propagation caused by parsing errors through multi-parser fusion and voting mechanisms.
[0046] The technical solution of the present invention overcomes technical bias: traditional sentiment analysis methods rely on a single parser, have certain technical biases, and cannot integrate the advantages of different parsers. The present invention overcomes the limitations of a single parser by fusing the parsing results of multiple parsers and provides a more comprehensive syntactic analysis. The present invention cleverly combines multiple advanced technologies such as BERT, M-BiLSTM and GCN, breaks through the limitations of a single technical path, and overcomes the technical bias of traditional methods in capturing contextual information and extracting sentiment dependencies. By introducing a voting mechanism to select the best parsing result, the present invention overcomes the excessive reliance on the results of a single parser and ensures the reliability and accuracy of the parsing results.
[0047] Third, the embodiment of the present invention provides an innovative text sentiment analysis method based on the M-BiLSTM model of multi-syntactic parser fusion. This method effectively improves the accuracy and efficiency of text sentiment analysis by combining the advantages of multiple syntactic parsers.
[0048] First, the present invention solves the problem of single syntactic parser and poor adaptability in traditional text sentiment analysis methods. By using multiple external syntactic parsers to perform syntactic parsing on input data and adaptively selecting the most appropriate parser or parser combination according to the type and complexity of the sentence, the present invention can more accurately capture the syntactic structure information in the text.
[0049] Secondly, the present invention uses a syntactic parse tree fusion algorithm to fuse multiple syntactic parse trees into a new syntactic parse tree and construct a corresponding syntactic enhancement graph, thereby enhancing and supplementing syntactic information. This method can more comprehensively reflect the syntactic features of the text and provide a richer basis for subsequent sentiment analysis.
[0050] Next, the present invention adopts a bidirectional long short-term memory neural network (M-BiLSTM) integrated with the Mogrifier structure to capture the bidirectional context information of the text. By introducing the Mogrifier structure, the M-BiLSTM model can better handle the long-term dependencies in the text, extract and combine important features in the text, and obtain a more accurate hidden context representation of the input sentence.
[0051] Finally, the present invention combines the hidden context representation and syntactic enhancement of the sentence Figure 1 The text is then input into a graph convolutional network (GCN) to extract rich aspect-level sentiment representations using the contextual syntactic information and the word dependencies of the aspects. This method can deeply mine the sentiment information in the text and achieve more refined and accurate sentiment classification. Through this series of technological innovations, the present invention has made significant technological progress in the field of text sentiment analysis and provided new ideas and methods for research and application in related fields. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 It is a flow chart of a text sentiment analysis method based on an M-BiLSTM model fused with multiple syntactic parsers provided in an embodiment of the present invention;
[0053] Figure 2 It is a structural diagram of a text sentiment analysis method based on an M-BiLSTM model fused with multiple syntactic parsers provided in an embodiment of the present invention;
[0054] Figure 3 is a diagram of the M-BiLSTM network structure provided by an embodiment of the present invention;
[0055] Figure 4 It is a module diagram of a text sentiment analysis system based on an M-BiLSTM model fused with multiple syntactic parsers provided in an embodiment of the present invention.
[0056] Figure 5 This is the dependency tree correlation effect generated by parsing with the spacy parser provided by the embodiment of the present invention.
[0057] Figure 6 This is the effect that the relevance of the fusion parse trees provided by the embodiment of the present invention is enhanced. DETAILED DESCRIPTION
[0058] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0059] Application Example 1: Product Review Sentiment Analysis
[0060] On e-commerce platforms, user reviews of products have important commercial value. By analyzing the sentiment of these reviews, merchants can understand user satisfaction with products and optimize their products and services.
[0061] 1. Receive raw text: Collect user comments on a product on an e-commerce platform, such as "The phone has a strong battery life, but the camera isn't as effective."
[0062] 2. Segment the original text: Segment the review text to get words or phrases, such as 'The', 'phone', 'has', 'a', 'strong', 'battery', 'life', ',', 'but', 'the', 'camera', 'isn't', 'as', 'effective', '.'
[0063] 3. Divide into training set and test set: Divide the review data into training set and test set in a ratio of 8:2 to ensure the effectiveness of model training and evaluation.
[0064] 4. Vectorization: Use the Bert model to vectorize the words or phrases after word segmentation to generate dynamic word vectors for the words.
[0065] 5. Syntactic parsing: The vectorized vocabulary is fed into multiple external syntactic parsers, such as StandfordNLP and SpaCy, to generate multiple syntactic parse trees.
[0066] Execute the syntactic parse tree fusion algorithm to generate a new syntactic parse tree and construct a syntactic enhancement graph.
[0067] 6. Capture contextual information: Obtain the text vectorization representation provided by the Bert model, pass the data to the bidirectional long short-term memory neural network (M-BiLSTM) integrated with the Mogrifier structure, capture the bidirectional contextual information of the text, extract important features, and generate the hidden context representation of the sentence.
[0068] 7. Extracting emotional dependencies: Representing the hidden context of sentences and enhancing syntax Figure 1 The resulting images are fed into a graph convolutional network (GCN) to extract rich aspect-level sentiment representations using the syntactic information of the context and the word dependencies of the aspects.
[0069] 8. Final sentiment classification: Classify the extracted sentiment representations and determine the sentiment tendency of each comment, such as positive, negative, or neutral. Example output: battery (Positive), camera (Negative).
[0070] Application Example 2: Social Media Emotion Monitoring
[0071] On social media platforms, users will express their opinions on hot events, brand activities, etc. By performing sentiment analysis on these comments, public sentiment can be monitored in real time to help brands conduct crisis public relations and adjust marketing strategies.
[0072] 1. Receive original text:
[0073] Collect user comments and posts on social media platforms, such as “I am very satisfied with the brand’s new product launch, but the after-sales service needs to be improved.”
[0074] 2. Segment the original text: Perform word segmentation on the review text to obtain words or phrases, such as 'I', 'am', 'very', 'satisfied', 'with', 'the', 'brand's', 'new', 'product', 'launch', ',', 'but', 'the', 'after-sales', 'service', 'needs', 'to', 'be', 'improved', '.'
[0075] 3. Divide into training set and test set: Divide the review data into training set and test set in a ratio of 7:3 to ensure the effectiveness of model training and evaluation.
[0076] 4. Vectorization: Use the Bert model to vectorize the words or phrases after word segmentation to generate dynamic word vectors for the words.
[0077] 5. Syntactic parsing: The vectorized vocabulary is sent to multiple external syntactic parsers to generate multiple syntactic parse trees respectively.
[0078] Execute the syntactic parse tree fusion algorithm to generate a new syntactic parse tree and construct a syntactic enhancement graph.
[0079] 6. Capture contextual information: Obtain the text vectorization representation provided by the Bert model, pass the data to the bidirectional long short-term memory neural network (M-BiLSTM) integrated with the Mogrifier structure, capture the bidirectional contextual information of the text, extract important features, and generate the hidden context representation of the sentence.
[0080] 7. Extracting emotional dependencies: Representing the hidden context of sentences and enhancing syntax Figure 1 The resulting images are fed into a graph convolutional network (GCN) to extract rich aspect-level sentiment representations using the syntactic information of the context and the word dependencies of the aspects.
[0081] 8. Final sentiment classification: classify the extracted sentiment representations and determine the sentiment tendency of each comment, such as positive, negative or neutral. Example output: New product launch (Positive), After-sales service
[0082] (Negative).
[0083] Through the above steps, fine-grained sentiment analysis of user comments can be effectively performed, providing a real-time sentiment monitoring and feedback mechanism for brands.
[0084] like Figure 1 , Figure 2 As shown, the text sentiment analysis method based on the M-BiLSTM model of multi-syntactic parser fusion provided by the embodiment of the present invention first uses multiple external syntactic parsers to perform syntactic parsing on the input data to obtain multiple syntactic parse trees, and adaptively selects the most appropriate parser or parser combination according to the type and complexity of the sentence. Then, the syntactic parse tree fusion algorithm is executed on the multiple parse trees to obtain a new syntactic parse tree, and then the corresponding graph structure is constructed for the new syntactic parse tree to obtain a syntactic enhancement graph. The preprocessed text is input into the Bert layer module to obtain a dynamic word vector, and then the bidirectional long short-term memory neural network LSTM (Long Short Term Memory) fused with the Mogrifier structure is used to capture the important part of the text context information to obtain the hidden context representation of the input sentence, and then the hidden context representation of the sentence and the syntactic enhancement are combined. Figure 1 The data is then input into the graph convolutional network (GCN) to extract important sentiment dependencies about specific aspects, and finally perform the final sentiment classification. The specific steps include:
[0085] S101, after receiving the original text, segment the original text to obtain multiple words or phrases;
[0086] S102, dividing the processed words or phrases into a training set and a test set according to a certain ratio;
[0087] S103, using the Bert model to perform vectorization processing on the above words or phrases;
[0088] S104, sending the above words or phrases to multiple external syntactic parsers to perform syntactic parsing on the input data to obtain multiple syntactic parse trees, then executing a syntactic parse tree fusion algorithm on the multiple parse trees to obtain a new syntactic parse tree, and then constructing a corresponding graph structure for the new syntactic parse tree to obtain a syntactic enhancement graph;
[0089] S105, after obtaining the text vectorization representation provided by the Bert model, the data is passed to the M-BiLSTM model to capture the bidirectional context information of the text, extract and combine important features in the text, and obtain the hidden context representation of the input sentence;
[0090] S106, the hidden context representation and syntactic enhancement of the sentence Figure 1 The resulting datasets are fed into a graph convolutional network (GCN) to exploit the syntactic information of the context and the word dependencies of the aspects and extract rich aspect-level sentiment representations.
[0091] In step 4 provided in the embodiment of the present invention, the specific implementation method of the syntactic fusion algorithm is:
[0092] (1) Use three parsers to analyze a sentence W n Perform dependency parsing to obtain three parsing arrays S1, S2, and S3;
[0093] (2) Create an empty array empty = [];
[0094] (3) The length of the array is L. The elements at the i-th position in the three analytical arrays are traversed to form a comparison array array i ;
[0095] (4) Traverse the comparison array array obtained from all positions of the parsed array i , count and compare the number of times each element appears in the array. If it is greater than half of the number of array elements, add it to empty[]. If it is less than half of the number of array elements, select the parser result with the most successful voting and filtering as the result of this fusion. This happens because when multiple parsers parse an edge, there is a lot of controversy and it is impossible to determine which parsing result to use. Therefore, it is necessary to select the parser with the most successful voting and filtering based on the previous judgment history, so as to maximize the syntactic parsing accuracy.
[0096] The syntactic fusion effect is as follows:
[0097]
[0098] In step 5 provided in the embodiment of the present invention, the M-BiLSTM network structure diagram is as follows: Figure 3 As shown in the figure, when using the M-BiLSTM model to capture context information, the M-BiLSTM model is divided into an input layer, a forward layer, a backward layer, and an output layer. The update formula of the M-BiLSTM from forward to backward is:
[0099] x K =2σ(Q K h prev K-1)⊙x K-2 for odd K∈[1,…,r]
[0100]
[0101] Among them, the current input and hidden state are represented as x=x -1 and h prev -1 =h prev 0 ; The superscript K indicates the corresponding variable of the Kth interaction update; r is a hyperparameter, which indicates the number of interaction cycles. Different numbers of cycles produce different interaction effects. When the number of cycles is 0, it indicates an ordinary long short-term memory network.
[0102] In step 6 provided by the embodiment of the present invention, the syntactic enhancement graph is fed to the graph convolutional network GCN layer to learn the sentiment dependency of a given aspect, and then each node in the lth layer GCN is updated according to the hidden representation of its neighborhood:
[0103]
[0104]
[0105] in is the hidden representation evolved from the previous GCN layer. F(·) is a position-aware transformation function, A i It is the syntactic enhancement graph obtained by fusing multiple syntactic parsers.
[0106] like Figure 4 As shown, the text sentiment analysis system based on the M-BiLSTM model of multi-syntactic parser fusion provided by the embodiment of the present invention includes:
[0107] Input module, used to receive raw text and perform preprocessing;
[0108] Bert module, which uses Bert model vocabulary or phrases for vectorization processing;
[0109] Syntax parsing module, used to perform syntax parsing on input data;
[0110] The M-BiLSTM module uses the M-BiLSTM model to capture the bidirectional context information of the text, extract and combine important features in the text, and obtain the hidden context representation of the input sentence;
[0111] The GCN module uses the graph convolutional network (GCN) to exploit the syntactic information of the context and the word dependencies of the aspects to extract rich aspect-level sentiment representations.
[0112] The embodiment of the present invention selects consumer review text for research, solves the problem that a single syntactic parser has inaccurate syntactic analysis results when parsing complex and long sentences with syntactic ambiguity, and proposes a text sentiment analysis method based on the M-BiLSTM model fused with multiple syntactic parsers. First, multiple external syntactic parsers are used to perform syntactic parsing on the input data to obtain multiple syntactic parse trees, and the most suitable parser or parser combination is adaptively selected according to the type and complexity of the sentence. Then, a syntactic parse tree fusion algorithm is executed on the multiple parse trees to obtain a new syntactic parse tree, and then a corresponding graph structure is constructed for the new syntactic parse tree to obtain a syntactic enhancement graph. The preprocessed text is input into the Bert layer module to obtain a dynamic word vector, and then the bidirectional long short-term memory neural network LSTM (Long Short Term Memory) fused with the Mogrifier structure is used to capture the important part of the text context information to obtain the hidden context representation of the input sentence, and then the hidden context representation of the sentence and the syntactic enhancement are combined. Figure 1 The images are then input into the graph convolutional network (GCN) to extract important sentiment dependencies about specific aspects, and finally perform the final sentiment classification.
[0113] The specific process is as follows:
[0114] Build a sentiment classification model to analyze the sentiment of restaurant reviews, including positive, negative, and neutral sentiment.
[0115] First, we select a public dataset containing restaurant reviews, which contains review texts with positive, negative, and neutral sentiments.
[0116] Data preprocessing module: standardize the character encoding of text data to ensure that all texts use the same character encoding method, such as UTF-8; perform uppercase to lowercase conversion to ensure that all data is lowercase;
[0117] Dataset partitioning module: The dataset containing positive, neutral and negative samples is divided into training set and test set according to a certain ratio. For example, 80% of the data is used for training and 20% of the data is used for testing.
[0118] Syntactic fusion module: Each data point in the data set is sent to three syntactic parsers for syntactic parsing, and then the syntactic fusion algorithm is executed to obtain the final dependency tree, and then the enhanced graph structure is generated based on the dependency tree.
[0119] Vectorization processing module and feature extraction module: After obtaining the vectorized representation of the text by the Bert model, these representations are passed to the M-BiLSTM model. The M-BiLSTM model encodes the input sequence from left to right and from right to left at the same time, capturing the bidirectional contextual information of the text. In the M-BiLSTM model, each input vector will undergo a series of complex calculations in the hidden layer and recursive layer:
[0120] x K =2σ(Q K h prev K-1)⊙x K-2 for odd K∈[1,…,r]
[0121]
[0122] Finally, the output of the M-BiLSTM model and the syntactic augmentation graph are fed to the graph convolutional network (GCN) layer to learn the sentiment dependencies of the given aspects, and then each node in the l-th layer GCN is updated according to the hidden representation of its neighbors:
[0123]
[0124]
[0125] Finally, the features are integrated through two fully connected layers to realize sentiment label prediction and then sent to the Sigmoid function to obtain the sentiment label.
[0126] The text sentiment analysis method based on the M-BiLSTM model of multi-syntactic parser fusion provided in the application embodiment of the present invention is applied to a computer device, wherein the computer device includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the text sentiment analysis method based on the M-BiLSTM model of multi-syntactic parser fusion.
[0127] The text sentiment analysis method of the M-BiLSTM model based on the fusion of multiple syntactic parsers provided in the application embodiment of the present invention is applied to an information data processing terminal, and the information data processing terminal is used to implement the text sentiment analysis system based on the M-BiLSTM model based on the fusion of multiple syntactic parsers.
[0128] It should be noted that the embodiments of the present invention can be implemented by hardware, software, or a combination of software and hardware. The hardware part can be implemented using dedicated logic; the software part can be stored in a memory and executed by an appropriate instruction execution system, such as a microprocessor or dedicated design hardware. It can be understood by a person of ordinary skill in the art that the above-mentioned devices and methods can be implemented using computer executable instructions and / or contained in a processor control code, such as a carrier medium such as a disk, CD or DVD-ROM, a programmable memory such as a read-only memory (firmware), or a data carrier such as an optical or electronic signal carrier. Such code is provided on the carrier medium. The device and its modules of the present invention can be implemented by hardware circuits such as very large-scale integrated circuits or gate arrays, semiconductors such as logic chips, transistors, etc., or programmable hardware devices such as field programmable gate arrays, programmable logic devices, etc., can also be implemented by software executed by various types of processors, and can also be implemented by a combination of the above-mentioned hardware circuits and software, such as firmware.
[0129] The present invention proposes a solution to the problem of inaccurate syntactic analysis in existing sentiment analysis technologies. Most of the current graph neural network models directly construct graph structures on the syntactic parse tree. When a single syntactic parser processes complex and long sentences, syntactic ambiguity is prone to occur, resulting in inaccurate syntactic analysis results. Once the parsing result of the syntactic parser is wrong, the noise will spread from the output of the model to the final classification result, causing a negative impact and reducing the accuracy of sentiment classification. In addition, traditional sentiment analysis methods often find it difficult to fully utilize the contextual information of the text, resulting in poor performance when processing complex semantic relationships.
[0130] The present invention can effectively solve the problem of inaccurate syntactic analysis results when a single syntactic parser is used to parse complex and long sentences with syntactic ambiguity by combining the fusion of multiple syntactic parsers and the M-BiLSTM model, thereby improving the accuracy of sentiment classification. The present invention uses multiple external syntactic parsers to perform syntactic analysis on input data to obtain multiple syntactic parse trees. By adopting the method of fusion of multiple syntactic parsers, the advantages of different parsers can be comprehensively considered, the errors caused by a single parser can be reduced, and the error rate of syntactic analysis can be effectively reduced, thereby improving the accuracy of sentiment analysis.
[0131] For the sentence "Great food but the service was dreadful!", Figure 5 The dependency tree generated by parsing with spacy parser shows that the sentiment word dreadful corresponding to service is far away and has no direct correlation. Figure 6 The parse tree after fusion is shown. We can clearly see the connection between the aspect word service and its sentiment word dreadful, and the correlation between them is enhanced.
[0132] The above description is only a specific implementation mode of the present invention, but the protection scope of the present invention is not limited thereto. Any modifications, equivalent substitutions and improvements made by any technician familiar with the technical field within the technical scope disclosed by the present invention and within the spirit and principle of the present invention should be covered by the protection scope of the present invention.
Claims
1. A text sentiment analysis method based on the M-BiLSTM model fused with multiple syntactic parsers, characterized in that: The analysis method uses multiple external syntactic parsers to perform syntactic parsing on input data to obtain multiple syntactic parse trees, and adaptively selects the most appropriate parser or parser combination according to the type and complexity of the sentence; then executes a syntactic parse tree fusion algorithm on the multiple parse trees to obtain a new syntactic parse tree, and then constructs a corresponding graph structure for the new syntactic parse tree to obtain a syntactic enhancement graph; inputs the preprocessed text into a Bert layer module to obtain a dynamic word vector, and then captures an important part of the text context information through a bidirectional long short-term memory neural network LSTM fused with a Mogrifier structure to obtain a hidden context representation of the input sentence, and then inputs the hidden context representation of the sentence and the syntactic enhancement graph into a graph convolutional network GCN together to extract important sentiment dependencies on specific aspects, and finally performs final sentiment classification.
2. The text sentiment analysis method based on the M-BiLSTM model of multi-syntactic parser fusion according to claim 1, characterized in that, The specific steps include: Step 1: After receiving the original text, segment the original text to obtain multiple words or phrases; Step 2: Divide the processed words or phrases into training sets and test sets according to a certain ratio; Step 3: Use the Bert model to vectorize the above words or phrases; Step 4: Send the above words or phrases to multiple external syntactic parsers to perform syntactic parsing on the input data to obtain multiple syntactic parse trees, and then execute the syntactic parse tree fusion algorithm on the multiple parse trees to obtain a new syntactic parse tree, and then construct a corresponding graph structure for the new syntactic parse tree to obtain a syntactic enhancement graph; Step 5: After obtaining the text vectorization representation provided by the Bert model, pass the data to the M-BiLSTM model to capture the bidirectional context information of the text, extract and combine important features in the text, and obtain the hidden context representation of the input sentence; In step 6, the hidden context representation of the sentence and the syntactic enhancement graph are input into the graph convolutional network (GCN) to utilize the syntactic information of the context and the word dependencies of the aspects to extract rich aspect-level sentiment representation.
3. The text sentiment analysis method based on the M-BiLSTM model of multi-syntactic parser fusion according to claim 1, characterized in that, In step 4, the specific implementation method of the syntactic fusion algorithm is: (1) Use three parsers to analyze a sentence W n Perform dependency parsing to obtain three parsing arrays S1, S2, and S3; (2) Create an empty array empty = []; (3) The length of the array is L. The elements at the i-th position in the three analytical arrays are traversed to form a comparison array array i ; (4) Traverse the comparison array array obtained from all positions of the parsed array i , count and compare the number of times each element appears in the array. If it is greater than half of the number of array elements, add it to empty[]. If it is less than half of the number of array elements, select the parser result with the most successful voting and screening as the result of this fusion. The syntactic fusion effect is as follows:
4. The text sentiment analysis method based on the M-BiLSTM model of multi-syntactic parser fusion according to claim 1, characterized in that, In step 5, when the M-BiLSTM model is used to capture context information, the M-BiLSTM model is divided into an input layer, a forward layer, a backward layer and an output layer. The update formula of the M-BiLSTM from forward to backward is: x K =2σ(Q K h prev K-1)⊙x K-2 for odd K∈[1,…,r] Among them, the current input and hidden state are represented as x=x -1 and h prev -1 =h prev 0 ; The superscript K indicates the corresponding variable of the Kth interaction update; r is a hyperparameter, which indicates the number of interaction cycles. Different numbers of cycles produce different interaction effects. When the number of cycles is 0, it indicates an ordinary long short-term memory network.
5. The text sentiment analysis method based on the M-BiLSTM model of multi-syntactic parser fusion according to claim 1, characterized in that, In step 6, the syntactic enhancement graph is fed to the graph convolutional network (GCN) layer to learn the sentiment dependency of a given aspect, and then each node in the lth layer GCN is updated according to the hidden representation of its neighborhood: in is the hidden representation evolved from the previous GCN layer, F(·) is a position-aware transformation function, A i It is the syntactic enhancement graph obtained by fusing multiple syntactic parsers.
6. A text sentiment analysis system implementing the M-BiLSTM model based on multi-syntactic parser fusion as described in any one of claims 1 to 5, characterized in that: The text sentiment analysis system based on the M-BiLSTM model of multi-syntactic parser fusion includes: Input module, used to receive raw text and perform preprocessing; Bert module, which uses Bert model vocabulary or phrases for vectorization processing; Syntax parsing module, used to perform syntax parsing on input data; The M-BiLSTM module uses the M-BiLSTM model to capture the bidirectional context information of the text, extract and combine important features in the text, and obtain the hidden context representation of the input sentence; The GCN module uses the graph convolutional network (GCN) to exploit the syntactic information of the context and the word dependencies of the aspects to extract rich aspect-level sentiment representations.
7. A computer device, characterized in that: The computer device includes a memory and a processor, the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the text sentiment analysis method based on the M-BiLSTM model fused with multiple syntactic parsers as described in any one of claims 1 to 5.
8. A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the processor executes the steps of the text sentiment analysis method based on the M-BiLSTM model fused with multiple syntactic parsers as described in any one of claims 1 to 5.
9. An information data processing terminal, characterized in that: The information data processing terminal is used to implement the text sentiment analysis system based on the M-BiLSTM model fused with multiple syntactic parsers as described in claim 6.
Citation Information
Cited By
Legal text information extraction enhancement method and system based on artificial intelligence
CN120258001A
