Aspect-level emotion triple extraction method and device, equipment and storage medium
The neural network model processes speech or text, generates high-dimensional semantic feature vectors and combines them to generate initial word pairs, which solves the problem of difficulty in processing long-distance dependencies and multiple aspects and emotional word relationships in the existing technology, and achieves a more accurate Sentiment analysis and user emotion understanding.
Patent Information
- Application Number
- CN202411358931.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2025-01-21
AI Technical Summary
The prior art is difficult to accurately handle long-distance dependence and the relationship between multiple aspects and emotional words in pronunciation or text sentiment analysis, resulting in increased difficulty in classification of emotional polarity and insufficient accuracy in understanding user emotions.
Enter the text through the encoder, generate high -dimensional semantic feature vectors, and convert it into the input sequence of neural network models. Use the preset neural network model combination to generate the initial word pair. Then the target level emotional ternary group is determined by the decoder. Essence
It improves the model's ability to handle long-distance dependencies and relationships between multiple aspects and emotional words, enhances feature extraction and generalization capabilities, and more accurately determines target aspect-level emotional triples, thereby improving the accuracy of understanding user emotions. sex.
Smart Images

Figure CN119337860A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of speech semantic technology, which is applied to the financial technology business field, and in particular to a method, device, equipment and storage medium for extracting aspect-level sentiment triples. Background Art
[0002] With the rapid development of artificial intelligence technology, it is crucial for businesses to quickly and accurately judge user emotions in speech or text to understand user needs. Aspect Sentiment Triplet Extraction (ASTE) is a fine-grained sentiment analysis task that aims to extract each aspect, sentiment words related to the aspect, and the sentiment polarity of the aspect from the text. Currently, many solutions use pre-trained models for fine-tuning to adapt to this task, but there are some problems, such as the complex fine-tuning process of Bert and the limited processing of very long texts, which requires the text to be staged or segmented or causes information loss. The LSTM model also has the problem that it is not as effective as other models in long-distance dependencies and has weak feature extraction capabilities. In complex sentences, there may be long-distance dependencies between aspects and sentiment words, and some traditional methods cannot capture the relationship in time. Moreover, a sentence may contain multiple aspects and sentiment words, which places high demands on the model capabilities and requires the model to be able to handle the relationship between multiple aspects and sentiment words at the same time. Sentiment polarity often depends on contextual information, such as complex language phenomena such as irony and metaphor, which increases the difficulty of sentiment polarity classification. Therefore, how to improve the accuracy of understanding user emotions through artificial intelligence technology has become a technical problem that needs to be solved urgently. Summary of the invention
[0003] The present application provides a method, apparatus, device and storage medium for extracting aspect-level sentiment triples, so as to improve the accuracy of understanding user sentiments through artificial intelligence technology.
[0004] In a first aspect, the present application provides a method for extracting aspect-level sentiment triples, the method comprising:
[0005] Parse the input text through the encoder to generate a high-dimensional semantic feature vector;
[0006] Converting each of the high-dimensional semantic feature vectors into an input sequence of a preset neural network model, and combining each of the input sequences based on the preset neural network model to generate an initial word pair;
[0007] The target aspect-level sentiment triple is determined by using a preset decoder and each of the initial word pairs.
[0008] In a second aspect, the present application further provides an aspect-level sentiment triple extraction device, the device comprising:
[0009] A high-dimensional semantic feature vector generation module is used to parse the input text through an encoder to generate a high-dimensional semantic feature vector;
[0010] An initial word pair generation module, used for converting each of the high-dimensional semantic feature vectors into an input sequence of a preset neural network model, and combining each of the input sequences based on the preset neural network model to generate an initial word pair;
[0011] The emotion triple extraction module is used to determine the target aspect-level emotion triple through a preset decoder and each of the initial word pairs.
[0012] In a third aspect, the present application also provides a computer device, comprising a memory and a processor; the memory is used to store a computer program; the processor is used to execute the computer program and implement the aspect-level sentiment triple extraction method as described above when executing the computer program.
[0013] In a fourth aspect, the present application further provides a computer-readable storage medium storing a computer program, which, when executed by a processor, enables the processor to implement the aspect-level sentiment triple extraction method as described above.
[0014] The present application discloses an aspect-level sentiment triple extraction method, device, equipment and storage medium. The aspect-level sentiment triple extraction method includes parsing the input text through an encoder to generate a high-dimensional semantic feature vector; converting each of the high-dimensional semantic feature vectors into an input sequence of a preset neural network model, and combining each of the input sequences based on the preset neural network model to generate an initial word pair; determining the target aspect-level sentiment triple through a preset decoder and each of the initial word pairs. In the above manner, the present application better handles long-distance dependencies and the relationship between multiple aspects and sentiment words by using a neural network model. At the same time, by using pre-trained knowledge of large-scale corpus, the feature extraction ability and generalization ability of the model can be improved, and the target aspect-level sentiment triple can be determined more accurately, thereby improving the accuracy of understanding user emotions. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0016] Figure 1 is a schematic flow chart of an aspect-level sentiment triple extraction method provided in the first embodiment of the present application;
[0017] Figure 2 is a schematic flow chart of an aspect-level sentiment triple extraction method provided in the second embodiment of the present application;
[0018] Figure 3 A schematic block diagram of an aspect-level sentiment triple extraction device provided in an embodiment of the present application;
[0019] Figure 4 A schematic block diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0020] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0021] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0022] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0023] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0024] The embodiments of the present application provide an aspect-level sentiment triple extraction method, device, equipment and storage medium. Among them, the aspect-level sentiment triple extraction method can be applied to a server, and by using a neural network model, long-distance dependencies and the relationship between multiple aspects and sentiment words can be better handled. At the same time, by using the pre-training knowledge of large-scale corpus, the feature extraction ability and generalization ability of the model can be improved, and the target aspect-level sentiment triples can be determined more accurately, thereby improving the accuracy of understanding user emotions. Among them, the server can be an independent server or a server cluster.
[0025] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0026] See also Figure 1 , Figure 1 This is a schematic flow chart of an aspect-level sentiment triple extraction method provided by the first embodiment of the present application. The aspect-level sentiment triple extraction method can be applied to a server to better handle long-distance dependencies and the relationship between multiple aspects and sentiment words by using a neural network model. At the same time, by using pre-trained knowledge of large-scale corpus, the feature extraction and generalization capabilities of the model can be improved, and the target aspect-level sentiment triples can be determined more accurately, thereby improving the accuracy of understanding user emotions.
[0027] like Figure 1 As shown, the aspect-level sentiment triple extraction method specifically includes steps S10 to S30.
[0028] Step S10, parsing the input text through the encoder to generate a high-dimensional semantic feature vector;
[0029] Specifically, the encoder converts the input text into a high-dimensional vector representation, which captures the semantic and structural information of the input text. The commonly used structure of the encoder part is Bert-Base-uncased model l (BERT, Bidirectional Encoder Representation from Transformers-pre-trained language representation model), and this embodiment also replaces the models of Roberta, GPT-2, SimCSE, etc. Compared with similar models that can achieve encoder effects, SimCSE has better effects in such tasks.
[0030] Step S20, converting each of the high-dimensional semantic feature vectors into an input sequence of a preset neural network model, and combining each of the input sequences based on the preset neural network model to generate an initial word pair;
[0031] Specifically, the output high-dimensional vector representation passes through MLP (Multiple Perceptron), uses two linear layers to process the representation of aspects and opinions respectively, and a dense layer is used as a linear layer to compress the features of high-dimensional vectors and provide input for the GCN layer. GCN (Graph Convolutional Network) is a neural network architecture specifically used to process graph structure data. Appropriate increase or decrease of output neurons affects the model's ability to represent features. In addition, this embodiment uses the KAI MING method to initialize weights instead of directly setting them to Gaussian distribution and deviation to 0.
[0032] The input of MLP is passed into the attentiveness mechanism, and the commonly used ones are the multi-head attention mechanism and the dual affine attention mechanism. The multi-head attention mechanism performs better in this task, because the dual affine transformation is more practical to model the relationship between two input sequences (such as between words in a sentence) and the relationship between two input elements. However, for the task of extracting sentiment analysis triplets from sentences and texts, there are multiple aspect-level words and sentiment words in a sentence, so the multi-head attention mechanism can better utilize multiple different attention heads to calculate in parallel to capture the representation of different feature subspaces in the input sequence, and can better capture the relationship between different words in a sentence.
[0033] Use tree-based distance, relative position distance, syntactic dependency, part-of-speech combination, and attention mechanism to form your own graph convolutional neural network, and use the idea of multi-channel graph convolutional network to combine these five. Or conduct ablation experiments on special data sets to find the combination ratio.
[0034] Step S30: Determine the target aspect-level sentiment triplet through a preset decoder and each of the initial word pairs.
[0035] In one embodiment, since there is a certain implicit relationship between aspects and opinions, a refinement strategy is used to improve the representation of word pairs and improve the accuracy of word pair matching. For a given word pair (wi, wj), the node representations are concatenated together with the respective node representations hi, hj, and the edge representation rij of the word pair (the edge of wi, wj) and the respective edges rii, rjj (the edge of wi, wi and the edge of wj, wj) are added, so that the implicit relationship extracted from aspects and opinions is used to refine the representation of word pairs.
[0036] Using the argmax method, select the first few with the greatest probability for matching and pairing, and finally get the triples in the form of a decoder.
[0037] The present embodiment discloses an aspect-level sentiment triple extraction method, apparatus, device and storage medium, the aspect-level sentiment triple extraction method comprising parsing an input text through an encoder to generate a high-dimensional semantic feature vector; converting each of the high-dimensional semantic feature vectors into an input sequence of a preset neural network model, and combining each of the input sequences based on the preset neural network model to generate an initial word pair; determining a target aspect-level sentiment triple through a preset decoder and each of the initial word pairs. In the above manner, the present application better handles long-distance dependencies and the relationship between multiple aspects and sentiment words by using a neural network model. At the same time, by using pre-trained knowledge of large-scale corpus, the feature extraction ability and generalization ability of the model can be improved, and the target aspect-level sentiment triple can be determined more accurately, thereby improving the accuracy of understanding user emotions.
[0038] based on Figure 1 In the embodiment shown, in this embodiment, step S20 includes:
[0039] Capturing the semantic aspect feature vector of the high-dimensional semantic feature vector through a first linear layer in a preset multi-layer perceptron MLP, wherein the preset neural network model includes the MLP;
[0040] Capturing a semantic viewpoint aspect feature vector of the high-dimensional semantic feature vector via a second linear layer in the MLP;
[0041] The input sequence is generated by compressing the semantic aspect feature vector and the semantic opinion aspect feature vector through dense layers in the MLP.
[0042] In one embodiment, the high-dimensional semantic feature vectors output by the encoder (such as BERT, GPT, etc.) are used as input, which contain rich semantic information of the text. The input high-dimensional semantic feature vector is converted into a semantic aspect feature vector through the first linear layer in the MLP. The purpose of this layer is to extract features related to "aspects" from the input vector. This can be achieved by learning the mapping of the input vector to the aspect feature space.
[0043] Next, the same high-dimensional semantic feature vector is further processed by the second linear layer in the MLP to extract feature vectors related to “opinion” or “sentiment words.” The goal of this layer is to identify features of specific sentiment or evaluation words associated with aspects.
[0044] After the two linear layers, the semantic aspect feature vector and the semantic opinion aspect feature vector are fed into the dense layer in the MLP. The dense layer (or fully connected layer) is used to compress and integrate these feature vectors to generate a comprehensive input sequence. This step helps reduce the feature dimension while retaining important semantic information.
[0045] The output of the dense layer is a comprehensive feature vector that integrates aspect and opinion information, which provides rich input for subsequent processing steps (such as sentiment polarity judgment, relationship modeling, etc.). Ultimately, the sequence output by the MLP can be used for further analysis or as input to other models (such as convolutional networks GCN) for more complex relationship extraction and classification tasks.
[0046] The present embodiment discloses an aspect-level sentiment triple extraction method, device, equipment and storage medium, the aspect-level sentiment triple extraction method includes parsing the input text through an encoder to generate a high-dimensional semantic feature vector; capturing the semantic aspect feature vector of the high-dimensional semantic feature vector through the first linear layer in the preset multi-layer perceptron MLP, wherein the preset neural network model includes the MLP; capturing the semantic viewpoint aspect feature vector of the high-dimensional semantic feature vector through the second linear layer in the MLP; compressing the semantic aspect feature vector and the semantic viewpoint aspect feature vector through the dense layer in the MLP to generate the input sequence, and combining each of the input sequences based on the preset neural network model to generate an initial word pair; determining the target aspect-level sentiment triple through the preset decoder and each of the initial word pairs. In the above manner, the present application can more accurately analyze the sentiment information in the input text by converting the input text into a high-dimensional semantic feature vector and using the multi-layer perceptron to capture the semantic aspect feature vector and the semantic viewpoint aspect feature vector therein. At the same time, the present embodiment can also combine multiple input sequences to generate a more comprehensive and accurate sentiment analysis result, thereby improving the accuracy of understanding user emotions.
[0047] See also Figure 2 , Figure 2 This is a schematic flow chart of an aspect-level sentiment triple extraction method provided by the second embodiment of the present application. The aspect-level sentiment triple extraction method can be applied to a server to better handle long-distance dependencies and the relationship between multiple aspects and sentiment words by using a neural network model. At the same time, by using pre-trained knowledge of large-scale corpus, the feature extraction and generalization capabilities of the model can be improved, and the target aspect-level sentiment triples can be determined more accurately, thereby improving the accuracy of understanding user emotions.
[0048] based on Figure 1 The embodiment shown, this embodiment Figure 2 As shown, step S20 includes steps S11 to S13.
[0049] Step S11, adjusting the number of output neurons in the initial neural network model;
[0050] Step S12: adjusting the initial weights of the initial neural network model by using the KAI MING method;
[0051] Step S13: determining the preset neural network model according to the number of the output neurons and the initial weights.
[0052] In one embodiment, the number of output layer neurons is determined according to specific application scenarios and task requirements (such as classification, regression, feature extraction, etc.). For example, for a multi-classification problem, the number of output neurons should be equal to the number of categories.
[0053] Design the initial neural network model, including determining the number of layers in the network, the number of neurons in each layer, the type of activation function, etc. Adjust the number of neurons in the output layer according to the task requirements. This usually involves modifying the code or configuration files of the network architecture. For multi-task learning, it may be necessary to design a separate output layer for each task.
[0054] For the case of using ReLU or its variants as the activation function, the Kaiming initialization method is used to initialize the network weights. Kaiming initialization usually initializes the weights with a normal distribution with a mean of 0 and a variance of 2 / n, where n is the number of neurons in the previous layer, and the bias is usually initialized to 0 or a small constant value.
[0055] In the implementation code of the neural network, the Kaiming initialization method is used to set the weights. This usually involves using the initialization function provided by the deep learning framework (such as TensorFlow, PyTorch, etc.). Based on the adjusted architecture and initialization settings, a complete neural network model is built.
[0056] The present embodiment discloses a method, device, equipment and storage medium for extracting aspect-level sentiment triples. The aspect-level sentiment triple extraction method includes parsing input text through an encoder to generate a high-dimensional semantic feature vector; adjusting the number of output neurons in the initial neural network model; adjusting the initial weight of the initial neural network model through the KAI MING method; determining the preset neural network model according to the number of output neurons and the initial weight; converting each of the high-dimensional semantic feature vectors into an input sequence of the preset neural network model, and combining each of the input sequences based on the preset neural network model to generate an initial word pair; determining the target aspect-level sentiment triple through a preset decoder and each of the initial word pairs. In the above manner, the present application can more accurately capture the semantic information in the input text and generate a more comprehensive and accurate sentiment analysis result by adjusting the number of output neurons and the initial weight. At the same time, the present application combines multiple input sequences to further improve the accuracy of sentiment analysis.
[0057] In a more preferred embodiment, step S20 includes:
[0058] Generate a node representation vector corresponding to each word through the preset neural network model and the input sequence;
[0059] Each of the node representation vectors is concatenated to generate at least one of the initial word pairs.
[0060] In one embodiment, the node representation vector can capture the semantic information of the word in the context, and concatenating these vectors helps the model better understand the relationship between words and the semantics of the entire sentence. By concatenating the node representations of word pairs, the model can more accurately identify and model the potential relationship between words, such as the association between aspect and sentiment words. The concatenation operation increases the dimension of the feature, allowing the model to learn from a richer feature space, thereby improving the expressiveness of the feature.
[0061] This approach can improve the performance of the model on specific tasks (such as sentiment analysis, relation extraction, etc.) because it provides a more fine-grained feature representation. It provides a flexible way to handle different language phenomena, such as processing complex sentence structures or multiple language features, and can easily expand or modify the model architecture to adapt to different tasks and datasets.
[0062] Compared to processing each word individually, concatenating node representation vectors can reduce the computational complexity of the model because it allows the model to process word pairs at a time instead of individual words.
[0063] The present embodiment discloses an aspect-level sentiment triple extraction method, device, equipment and storage medium, the aspect-level sentiment triple extraction method includes parsing the input text through an encoder to generate a high-dimensional semantic feature vector; converting each of the high-dimensional semantic feature vectors into an input sequence of a preset neural network model, and generating a node representation vector corresponding to each word through the preset neural network model and the input sequence; splicing each of the node representation vectors to generate at least one initial word pair; and determining the target aspect-level sentiment triple through a preset decoder and each of the initial word pairs. In the above manner, the present application better handles long-distance dependencies and the relationship between multiple aspects and sentiment words by using a neural network model. At the same time, by using the pre-training knowledge of a large-scale corpus, the feature extraction ability and generalization ability of the model can be improved, and the target aspect-level sentiment triple can be determined more accurately, thereby improving the accuracy of understanding user emotions.
[0064] In a more preferred embodiment, the node representation vectors are concatenated to generate at least one initial word pair, including:
[0065] Based on the preset neural network model and the node representation vectors corresponding to the words, determining the relative position distance and implicit relationship of the words;
[0066] Based on the relative position distance and the implicit relationship, the node representation vectors are concatenated to generate the initial word pair.
[0067] In one embodiment, a preset neural network model is used to process the input text, and a node representation vector is generated for each word in the text. These vectors usually contain semantic information and context information of the word, and determine the relative position distance of each word pair in the text. This can be achieved by calculating the position index difference of the word pair in the text.
[0068] The relative position distance can be an absolute distance (actual index difference) or a normalized distance (for example, normalized by the total number of words). The neural network model is used to analyze the implicit relationship between words, which may include syntactic dependencies, co-references, or other semantic relationships, and the calculated relative position distance and the analyzed implicit relationship are integrated into the node representation vector. This may involve encoding this information into an additional feature vector and concatenating or fusing it with the original node representation vector.
[0069] Generate initial word pairs based on node representation vectors that incorporate position and relationship information. Each word pair consists of two node representation vectors that contain rich information about the relationship between them. For each pair of words, concatenate their node representation vectors. This can be achieved by simple vector concatenation, or more complex fusion techniques can be used, such as weighted summation or using attention mechanisms.
[0070] The present embodiment discloses a method, device, equipment and storage medium for extracting aspect-level sentiment triples. The aspect-level sentiment triple extraction method includes parsing input text through an encoder to generate a high-dimensional semantic feature vector; converting each of the high-dimensional semantic feature vectors into an input sequence of a preset neural network model, and generating a node representation vector corresponding to each word through the preset neural network model and the input sequence; determining the relative position distance and implicit relationship of each word based on the preset neural network model and the node representation vector corresponding to each word; splicing each of the node representation vectors based on the relative position distance and implicit relationship to generate the initial word pair; determining the target aspect-level sentiment triple through a preset decoder and each of the initial word pairs. In the above manner, the present application better handles long-distance dependencies and the relationship between multiple aspects and sentiment words by using a neural network model. At the same time, by using the pre-training knowledge of large-scale corpus, the feature extraction ability and generalization ability of the model can be improved, and the target aspect-level sentiment triple can be determined more accurately, thereby improving the accuracy of understanding user emotions.
[0071] based on Figure 1 In the embodiment shown, in this embodiment, step S30 includes:
[0072] Calculating the probability value of the match between each of the aspect word pairs and each of the sentiment word pairs;
[0073] Determine the aspect word pair and the emotion word pair whose probability values are greater than a preset probability threshold as a target aspect word pair and a target emotion word pair respectively;
[0074] The target aspect-level word pair and the target emotion word pair are decoded by the preset decoder to generate the target aspect-level emotion triplet.
[0075] In one embodiment, a preset neural network model is used to generate node representation vectors for each word in the text, which contain semantic and contextual information of the word. Potential aspect word pairs and sentiment word pairs in the text are determined. This usually involves identifying noun phrases that may represent product features or service aspects, as well as sentiment adjectives or adverbs related to these aspects.
[0076] Use a neural network model (which may include an attention mechanism or matching layer) to calculate the matching probability value between each pair of aspect words and sentiment words. This may involve a classification task, where the model needs to determine whether the two words match semantically. Determine a probability threshold, and only when the calculated matching probability value is greater than this threshold, is it considered that there is a significant association between the aspect word and the sentiment word.
[0077] According to the calculated matching probability value and the preset probability threshold, the target aspect word pairs and the target sentiment word pairs are screened out. These word pairs will be further processed to generate sentiment triples. The target aspect word pairs and the target sentiment word pairs are decoded using a preset decoder. The decoder may include one or more neural network layers for converting the representation of the word pairs into aspect-level sentiment triples.
[0078] Based on the output of the decoder, aspect-level sentiment triples are generated. A triple usually contains aspect terms, sentiment words, and sentiment polarity (positive, negative, or neutral). The generated triples are post-processed to ensure their accuracy and consistency. This may include removing duplicate triples, merging similar triples, or verifying the rationality of triples using an external knowledge base.
[0079] The present embodiment discloses a method, device, equipment and storage medium for extracting aspect-level sentiment triples. The aspect-level sentiment triple extraction method includes parsing input text through an encoder to generate a high-dimensional semantic feature vector; converting each of the high-dimensional semantic feature vectors into an input sequence of a preset neural network model, and combining each of the input sequences based on the preset neural network model to generate an initial word pair; calculating the probability value of matching between each of the aspect word pairs and each of the sentiment word pairs; determining the aspect word pairs and the sentiment word pairs whose probability values are greater than a preset probability threshold as target aspect word pairs and target sentiment word pairs respectively; decoding the target aspect word pairs and the target sentiment word pairs through the preset decoder to generate the target aspect-level sentiment triple. In the above manner, the present application better handles long-distance dependencies and the relationship between multiple aspects and sentiment words by using a neural network model. At the same time, by using the pre-training knowledge of a large-scale corpus, the feature extraction ability and generalization ability of the model can be improved, and the target aspect-level sentiment triples can be determined more accurately, thereby improving the accuracy of understanding user emotions.
[0080] Based on any of the above embodiments, in this embodiment, step S10 includes:
[0081] Performing semantic segmentation on the input text to generate at least one text segment;
[0082] Each of the text segments is encoded by the encoder to generate the high-dimensional semantic feature vector.
[0083] In one embodiment, the input text is cleaned, including removing irrelevant symbols, punctuation, stop words, and performing stem extraction or word form restoration. The preprocessed text is semantically segmented to generate text fragments. This can be achieved based on sentence boundaries, semantic roles, syntactic structures or specific semantic segmentation algorithms. The purpose of semantic segmentation is to divide the text into smaller units with independent meanings for subsequent processing. Each text fragment is segmented to segment continuous text strings into independent words or word units.
[0084] Select a suitable encoder model, such as BERT, GPT, LSTM, etc. These models can convert text into high-dimensional semantic feature vectors, and input the segmented text fragments into the encoder for encoding. The encoder will learn the context information of the text fragment and generate a high-dimensional semantic feature vector.
[0085] For Transformer-based models (such as BERT), it is necessary to convert text fragments into a sequence of tokens that the model can understand and add necessary special tags (such as [CLS], [SEP]).
[0086] The encoder outputs a high-dimensional vector representation of each token, which captures the semantic information and contextual information of the token. For sentence-level representation, the vector of a special token (such as [CLS]) is usually used as the representation of the entire sentence; for word-level representation, the average of all token vectors or the sentence representation obtained through the attention mechanism can be used.
[0087] The present embodiment discloses an aspect-level sentiment triple extraction method, device, equipment and storage medium, the aspect-level sentiment triple extraction method includes semantically segmenting the input text to generate at least one text segment; encoding each of the text segments through the encoder to generate the high-dimensional semantic feature vector; converting each of the high-dimensional semantic feature vectors into an input sequence of a preset neural network model, and combining each of the input sequences based on the preset neural network model to generate an initial word pair; determining the target aspect-level sentiment triple through a preset decoder and each of the initial word pairs. In the above manner, the present application better handles long-distance dependencies and the relationship between multiple aspects and sentiment words by using a neural network model. At the same time, by using pre-trained knowledge of large-scale corpus, the feature extraction ability and generalization ability of the model can be improved, and the target aspect-level sentiment triple can be determined more accurately, thereby improving the accuracy of understanding user emotions.
[0088] See also Figure 3 , Figure 3 The embodiment of the present application provides a schematic block diagram of an aspect-level sentiment triple extraction device, which is used to execute the aforementioned aspect-level sentiment triple extraction method. The aspect-level sentiment triple extraction device can be configured on a server.
[0089] like Figure 3 As shown, the aspect-level sentiment triple extraction device 400 includes:
[0090] A high-dimensional semantic feature vector generation module 410 is used to parse the input text through an encoder to generate a high-dimensional semantic feature vector;
[0091] An initial word pair generation module 420, configured to convert each of the high-dimensional semantic feature vectors into an input sequence of a preset neural network model, and combine each of the input sequences based on the preset neural network model to generate an initial word pair;
[0092] The sentiment triple extraction module 430 is used to determine the target aspect-level sentiment triple through a preset decoder and each of the initial word pairs.
[0093] Furthermore, the initial word pair generation module 420 includes:
[0094] A semantic aspect feature vector capturing unit, configured to capture the semantic aspect feature vector of the high-dimensional semantic feature vector through a first linear layer in a preset multi-layer perceptron MLP, wherein the preset neural network model includes the MLP;
[0095] a semantic viewpoint aspect feature vector unit for capturing a semantic viewpoint aspect feature vector of the high-dimensional semantic feature vector through a second linear layer in the MLP;
[0096] An input sequence generating unit is used to compress the semantic aspect feature vector and the semantic viewpoint aspect feature vector through a dense layer in the MLP to generate the input sequence.
[0097] Furthermore, the aspect-level sentiment triple extraction device 400 comprises:
[0098] An output neuron number adjustment module is used to adjust the number of output neurons in the initial neural network model;
[0099] An initial weight adjustment module, used for adjusting the initial weight of the initial neural network model by using a KAI MI NG method;
[0100] The preset neural network model determination module is used to determine the preset neural network model according to the number of output neurons and the initial weights.
[0101] Furthermore, the initial word pair generation module 420 includes:
[0102] A node representation vector generating unit, used for generating a node representation vector corresponding to each word through the preset neural network model and the input sequence;
[0103] The initial word pair generating unit is used to concatenate the node representation vectors to generate at least one initial word pair.
[0104] Furthermore, the initial word pair generating unit comprises:
[0105] A distance and implicit relationship determination subunit, used to determine the relative position distance and implicit relationship of each of the words based on the preset neural network model and the node representation vector corresponding to each of the words;
[0106] The initial word pair generation subunit is used to splice the node representation vectors based on the relative position distance and the implicit relationship to generate the initial word pair.
[0107] Furthermore, the emotion triple extraction module 430 includes:
[0108] A probability value calculation unit, used to calculate the probability value of the match between each of the aspect word pairs and each of the emotion word pairs;
[0109] a target word pair determination unit, configured to determine the aspect word pair and the emotion word pair whose probability values are greater than a preset probability threshold as a target aspect word pair and a target emotion word pair, respectively;
[0110] The aspect-level sentiment triplet determination unit is used to decode the target aspect word pair and the target sentiment word pair through the preset decoder to generate the target aspect-level sentiment triplet.
[0111] Furthermore, the high-dimensional semantic feature vector generation module 410 includes:
[0112] A text segment generating unit, configured to perform semantic segmentation on the input text to generate at least one text segment;
[0113] A high-dimensional semantic feature vector generating unit is used to encode each of the text segments through the encoder to generate the high-dimensional semantic feature vector.
[0114] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device and each module can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0115] The above-mentioned device can be implemented in the form of a computer program. Figure 4 Runs on the computer device shown.
[0116] See also Figure 4 , Figure 4 1 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device may be a server.
[0117] See also Figure 4 The computer device includes a processor, a memory and a network interface connected through a system bus, wherein the memory may include a non-volatile storage medium and an internal memory.
[0118] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any aspect-level sentiment triple extraction method.
[0119] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.
[0120] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the processor can execute any aspect-level sentiment triple extraction method.
[0121] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0122] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0123] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:
[0124] Parse the input text through the encoder to generate a high-dimensional semantic feature vector;
[0125] Converting each of the high-dimensional semantic feature vectors into an input sequence of a preset neural network model, and combining each of the input sequences based on the preset neural network model to generate an initial word pair;
[0126] The target aspect-level sentiment triple is determined by using a preset decoder and each of the initial word pairs.
[0127] In one embodiment, each of the high-dimensional semantic feature vectors is converted into an input sequence of a preset neural network model to achieve:
[0128] Capturing the semantic aspect feature vector of the high-dimensional semantic feature vector through a first linear layer in a preset multi-layer perceptron MLP, wherein the preset neural network model includes the MLP;
[0129] Capturing a semantic viewpoint aspect feature vector of the high-dimensional semantic feature vector via a second linear layer in the MLP;
[0130] The input sequence is generated by compressing the semantic aspect feature vector and the semantic opinion aspect feature vector through dense layers in the MLP.
[0131] In one embodiment, before converting each of the high-dimensional semantic feature vectors into an input sequence of a preset neural network model, it is used to achieve:
[0132] Adjust the number of output neurons in the initial neural network model;
[0133] Adjusting the initial weights of the initial neural network model by the KAI MING method;
[0134] The preset neural network model is determined according to the number of the output neurons and the initial weights.
[0135] In one embodiment, the input sequences are combined based on the preset neural network model to generate initial word pairs, which are used to achieve:
[0136] Generate a node representation vector corresponding to each word through the preset neural network model and the input sequence;
[0137] Each of the node representation vectors is concatenated to generate at least one of the initial word pairs.
[0138] In one embodiment, each of the node representation vectors is concatenated to generate at least one initial word pair, which is used to achieve:
[0139] Based on the preset neural network model and the node representation vectors corresponding to the words, determining the relative position distance and implicit relationship of the words;
[0140] Based on the relative position distance and the implicit relationship, the node representation vectors are concatenated to generate the initial word pair.
[0141] In one embodiment, a target aspect-level sentiment triple is determined by a preset decoder and each of the initial word pairs, so as to achieve:
[0142] Calculating the probability value of the match between each of the aspect word pairs and each of the sentiment word pairs;
[0143] Determine the aspect word pair and the emotion word pair whose probability values are greater than a preset probability threshold as a target aspect word pair and a target emotion word pair respectively;
[0144] The target aspect-level word pair and the target emotion word pair are decoded by the preset decoder to generate the target aspect-level emotion triplet.
[0145] In one embodiment, the encoder parses the input text to generate a high-dimensional semantic feature vector for achieving:
[0146] Performing semantic segmentation on the input text to generate at least one text segment;
[0147] Each of the text segments is encoded by the encoder to generate the high-dimensional semantic feature vector.
[0148] A computer-readable storage medium is also provided in an embodiment of the present application, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and the processor executes the program instructions to implement any aspect-level sentiment triple extraction method provided in the embodiment of the present application.
[0149] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (Smart Medi a Card, SMC), a secure digital (Secure Digital, SD) card, a flash memory card (Flash Card), etc., equipped on the computer device.
[0150] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A method for extracting aspect-level sentiment triples, characterized in that: include: Parse the input text through the encoder to generate a high-dimensional semantic feature vector; Converting each of the high-dimensional semantic feature vectors into an input sequence of a preset neural network model, and combining each of the input sequences based on the preset neural network model to generate an initial word pair; The target aspect-level sentiment triple is determined by using a preset decoder and each of the initial word pairs.
2. The aspect-level sentiment triple extraction method according to claim 1, characterized in that: The step of converting each of the high-dimensional semantic feature vectors into an input sequence of a preset neural network model includes: Capturing the semantic aspect feature vector of the high-dimensional semantic feature vector through a first linear layer in a preset multi-layer perceptron MLP, wherein the preset neural network model includes the MLP; Capturing a semantic viewpoint aspect feature vector of the high-dimensional semantic feature vector via a second linear layer in the MLP; The input sequence is generated by compressing the semantic aspect feature vector and the semantic opinion aspect feature vector through dense layers in the MLP.
3. The aspect-level sentiment triple extraction method according to claim 2 is characterized in that: Before converting each of the high-dimensional semantic feature vectors into an input sequence of a preset neural network model, the method includes: Adjust the number of output neurons in the initial neural network model; Adjusting the initial weights of the initial neural network model by the KAIMING method; The preset neural network model is determined according to the number of the output neurons and the initial weights.
4. The aspect-level sentiment triple extraction method according to claim 2, characterized in that: The step of combining the input sequences based on the preset neural network model to generate initial word pairs includes: Generate a node representation vector corresponding to each word through the preset neural network model and the input sequence; Each of the node representation vectors is concatenated to generate at least one of the initial word pairs.
5. The aspect-level sentiment triple extraction method according to claim 4 is characterized in that: The step of concatenating the node representation vectors to generate at least one initial word pair includes: Based on the preset neural network model and the node representation vectors corresponding to the words, determining the relative position distance and implicit relationship of the words; Based on the relative position distance and the implicit relationship, the node representation vectors are concatenated to generate the initial word pair.
6. The aspect-level sentiment triple extraction method according to claim 1, characterized in that: The initial word pairs include aspect word pairs and sentiment word pairs, and the step of determining a target aspect-level sentiment triplet by using a preset decoder and each of the initial word pairs includes: Calculating the probability value of the match between each of the aspect word pairs and each of the sentiment word pairs; Determine the aspect word pair and the emotion word pair whose probability values are greater than a preset probability threshold as a target aspect word pair and a target emotion word pair respectively; The target aspect-level word pair and the target emotion word pair are decoded by the preset decoder to generate the target aspect-level emotion triplet.
7. The aspect-level sentiment triple extraction method according to any one of claims 1 to 6, characterized in that: The encoder parses the input text to generate a high-dimensional semantic feature vector, including: Performing semantic segmentation on the input text to generate at least one text segment; Each of the text segments is encoded by the encoder to generate the high-dimensional semantic feature vector.
8. A device for extracting aspect-level sentiment triples, characterized in that: include: A high-dimensional semantic feature vector generation module is used to parse the input text through an encoder to generate a high-dimensional semantic feature vector; An initial word pair generation module, used for converting each of the high-dimensional semantic feature vectors into an input sequence of a preset neural network model, and combining each of the input sequences based on the preset neural network model to generate an initial word pair; The emotion triple extraction module is used to determine the target aspect-level emotion triple through a preset decoder and each of the initial word pairs.
9. A computer device, characterized in that: The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is used to execute the computer program and implement the aspect-level sentiment triple extraction method as described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, enables the processor to implement the aspect-level sentiment triple extraction method according to any one of claims 1 to 7.