Methods, apparatus, equipment and storage media for extracting aspect-of-emotion triads

By constructing a hypergraph relation matrix and a relation-aware prompting module, the problem of insufficient relationship modeling between aspect words and opinion words in existing methods is solved, the accuracy and efficiency of aspect sentiment triple extraction are improved, and the effect of fine-grained sentiment analysis is enhanced.

CN119886136BActive Publication Date: 2025-10-31SOUTH CHINA NORMAL UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411643298.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-18
Publication Date
2025-10-31
Estimated Expiration
2044-11-18

AI Technical Summary

Technical Problem

Existing aspect sentiment triplet extraction methods fail to effectively model the relationship between aspect words and opinion words during the encoding process, resulting in inaccurate extraction results and low efficiency.

Method used

By constructing a hypergraph relation matrix of the statement to be tested, and combining the sentence encoding representation, hypergraph information is extracted to capture the interaction information between aspect words and opinion words. The relation awareness prompt module provides relation information during the decoding process, thereby improving the accuracy and efficiency of decoding.

Benefits of technology

It improves the accuracy and efficiency of extracting aspect-based sentiment triads and enhances the accuracy of fine-grained sentiment analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119886136B_ABST
    Figure CN119886136B_ABST
Patent Text Reader

Abstract

This invention relates to the fields of natural language processing and sentiment analysis, and particularly to a method, apparatus, device, and storage medium for extracting aspect sentiment triples. By constructing a hypergraph relation matrix of the sentence to be tested, and combining the sentence encoding representation, hypergraph information is extracted to capture the interaction information between aspect words, opinion words, and other context words in the sentence to be tested, thus obtaining a sentence hypergraph information representation. Word pair relation classification and relation perception are performed on the sentence hypergraph information representation, and further, boundary-sensitive relation-aware cue representations are obtained for decoding, providing relation-aware cue information for the decoding process. This improves the accuracy and efficiency of aspect sentiment triple extraction, and enhances the accuracy of fine-grained sentiment analysis tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of natural language processing technology and sentiment analysis, and in particular to a method, apparatus, device, and storage medium for extracting sentiment triples. Background Technology

[0002] Aspect-level sentiment triple extraction (ASTE) aims to extract all sentiment triples in a sentence, which are aspect words, opinion words, and their corresponding sentiment polarities.

[0003] Recently, using generative models such as T5 to complete the ASTE task has become an emerging trend. This approach aims to better utilize the semantic information of labels and effectively address the problem of error propagation. Current generative model-based ASTE methods adopt an Encoder-Decoder structure and follow this paradigm: a template is predefined, then triples are converted into target sequences according to the fixed template, and finally, sentiment triples are obtained from the sequence generated by the model. GAS transforms the sentiment analysis task into a text generation problem and uses a prediction normalization strategy to correct incorrect predictions; MvP utilizes element-order cue learning to improve sentiment triple prediction by aggregating multi-view results; SLGM constructs bidirectional templates and introduces a label-oriented sequence labeling module to enhance the generative model; CONTRASTE utilizes aspect-based cueing and contrastive learning to improve the performance of generative models on the ASTE task.

[0004] However, none of these methods effectively model the relationship between aspect words and opinion words. Firstly, after encoding the input sentence to obtain contextual information during the encoding process, no further relational modeling of this contextual information is performed specifically for the ASTE task, making it difficult to establish subtle connections between aspect words and opinion words. Secondly, the use of simple structured templates to pair aspect words and opinion words during the decoding stage fails to provide sufficient effective relational information for the decoding process, resulting in inaccurate and inefficient extraction of aspect sentiment triples. Summary of the Invention

[0005] Based on this, the purpose of this invention is to provide a method, apparatus, device, and storage medium for extracting aspect sentiment triples. By constructing a hypergraph relation matrix of the sentence to be tested, and combining the sentence encoding representation, hypergraph information is extracted to capture the interaction information between aspect words, opinion words, and other context words in the sentence to be tested, thereby obtaining a sentence hypergraph information representation. Word pair relation classification and relation perception are performed on the sentence hypergraph information representation, and further, a boundary-sensitive relation perception cue representation is obtained for decoding, providing relation perception cue information for the decoding process. This improves the accuracy and efficiency of aspect sentiment triple extraction, and enhances the accuracy of fine-grained sentiment analysis tasks.

[0006] In a first aspect, embodiments of this application provide a method for extracting aspect-based emotion triples, comprising the following steps:

[0007] Obtain the sentence to be tested and the preset triple extraction model, wherein the sentence to be tested includes several words, and the triple extraction model includes a sentence encoding module, a hypergraph information extraction module, a relation-aware prompting module, and a triple extraction module;

[0008] The sentence to be tested is input into the sentence encoding module for encoding processing to obtain the sentence encoding representation of the sentence to be tested;

[0009] Construct the hypergraph relation matrix of the statement to be tested, wherein the hypergraph relation matrix includes relation vectors between several nodes and several hyperedges;

[0010] The sentence encoding representation and the hypergraph relation matrix are input into the hypergraph information extraction module to extract hypergraph information and obtain the sentence hypergraph information representation of the sentence to be tested.

[0011] The sentence hypergraph information representation is input into the relation-aware prompting module for word pair relation classification and relation perception to obtain the relation-aware prompting representation of the sentence to be tested.

[0012] The sentence encoding representation and relation-aware cue representation are input into the triple extraction module for triple extraction to obtain the aspect sentiment triple extraction result of the sentence to be tested.

[0013] Secondly, embodiments of this application provide an aspect-of-emotion triplet extraction device, comprising:

[0014] The data acquisition unit is used to acquire the sentence to be tested and the preset triple extraction model. The sentence to be tested includes several words, and the triple extraction model includes a sentence encoding module, a hypergraph information extraction module, a relation-aware prompting module, and a triple extraction module.

[0015] A sentence encoding unit is used to input the sentence to be tested into the sentence encoding module for encoding processing to obtain the sentence encoding representation of the sentence to be tested;

[0016] A matrix construction unit is used to construct the hypergraph relation matrix of the statement to be tested, wherein the hypergraph relation matrix includes relation vectors between several nodes and several hyperedges;

[0017] The feature extraction unit is used to input the sentence encoding representation and the hypergraph relation matrix into the hypergraph information extraction module to extract hypergraph information and obtain the sentence hypergraph information representation of the sentence to be tested;

[0018] The relation-aware unit is used to input the sentence hypergraph information representation into the relation-aware prompting module to perform word pair relation classification and relation perception, and obtain the relation-aware prompting representation of the sentence to be tested;

[0019] The triplet extraction unit is used to input the sentence encoding representation and relation-aware prompt representation into the triplet extraction module for triplet extraction, so as to obtain the aspect sentiment triplet extraction result of the sentence to be tested.

[0020] Thirdly, embodiments of this application provide a computer device including a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the aspect sentiment triple extraction method as described in the first aspect.

[0021] Fourthly, embodiments of this application provide a storage medium storing a computer program that, when executed by a processor, implements the steps of the aspect sentiment triple extraction method as described in the first aspect.

[0022] This application provides a method, apparatus, device, and storage medium for extracting aspect sentiment triples. By constructing a hypergraph relation matrix of the sentence to be tested and combining the encoded sentence representation, hypergraph information is extracted to capture the interaction information between aspect words, opinion words, and other context words in the sentence to be tested, thereby obtaining a sentence hypergraph information representation. Word pair relation classification and relation perception are performed on the sentence hypergraph information representation, and further boundary-sensitive relation perception prompt representation is obtained for decoding, providing relation perception prompt information for the decoding process. This improves the accuracy and efficiency of aspect sentiment triple extraction and enhances the accuracy of fine-grained sentiment analysis tasks.

[0023] To better understand and implement this invention, the following detailed description is provided in conjunction with the accompanying drawings. Attached Figure Description

[0024] Figure 1 A flowchart illustrating an aspect sentiment triplet extraction method provided in one embodiment of this application;

[0025] Figure 2 A flowchart illustrating step S3 of the aspect sentiment triple extraction method provided in one embodiment of this application;

[0026] Figure 3 A flowchart illustrating step S4 of the aspect sentiment triple extraction method provided in one embodiment of this application;

[0027] Figure 4A flowchart illustrating step S41 of the aspect sentiment triple extraction method provided in one embodiment of this application;

[0028] Figure 5 A flowchart illustrating step S5 of the aspect sentiment triple extraction method provided in one embodiment of this application;

[0029] Figure 6 A flowchart illustrating step S6 of the aspect sentiment triple extraction method provided in one embodiment of this application;

[0030] Figure 7 A flowchart illustrating step S7 of the aspect emotion triple extraction method provided in another embodiment of this application;

[0031] Figure 8 A schematic diagram of the structure of an aspect emotion triplet extraction device provided in one embodiment of this application;

[0032] Figure 9 This is a schematic diagram of the structure of a computer device provided in one embodiment of this application. Detailed Implementation

[0033] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0034] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.

[0035] It should be understood that although the terms first, second, third, etc., may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."

[0036] Please see Figure 1 , Figure 1The flowchart illustrates an aspect sentiment triple extraction method according to an embodiment of this application, the method comprising the following steps:

[0037] S1: Obtain the statement to be tested and the preset triple extraction model.

[0038] The execution subject of the aspect sentiment triple extraction method is the extraction device of the aspect sentiment triple extraction method (hereinafter referred to as the extraction device). In an optional embodiment, the extraction device can be a computer device, a server, or a server cluster composed of multiple computer devices.

[0039] In this embodiment, the extraction device acquires the sentence to be tested and a preset triple extraction model, wherein the sentence to be tested includes several words, and the triple extraction model includes a sentence encoding module, a hypergraph information extraction module, a relation-aware prompting module, and a triple extraction module.

[0040] Specifically, the extraction device can obtain the test statement input by the user, or it can obtain the corresponding test statement from a preset database. The test statement includes several words, and the statement expression of the test statement is:

[0041] x = {w1, w2, ..., w i ,…,…,w n}

[0042] In the formula, x is the statement expression of the statement to be tested, i is the word position index, n is the number of words in the statement to be tested, and w i Let be the vector representation of the i-th word of the statement to be tested.

[0043] S2: Input the statement to be tested into the sentence encoding module for encoding processing to obtain the sentence encoding representation of the statement to be tested.

[0044] The sentence encoding module can use either the BERT (Bidirectional Encoder Representation from Transformers) word embedding model or the T5 (Text-to-Text Transfer Transformer) word embedding model to convert word vectors into corresponding word embedding vectors.

[0045] In this embodiment, the extraction device inputs the sentence to be tested into the sentence encoding module for encoding processing to obtain the sentence encoding representation of the sentence to be tested. Specifically, the extraction device inputs the sentence to be tested into the sentence encoding module, maps each word in the sentence to be tested into a low-dimensional vector space, and obtains the word embedding vectors of several words in the sentence to be tested by querying a pre-trained matrix. These word embedding vectors are used as state vectors. The state vectors of several words in the sentence to be tested are combined to construct the sentence encoding representation of the sentence to be tested.

[0046] S3: Construct the hypergraph relation matrix of the statement to be tested.

[0047] To fully model the relationship between aspect terms and opinion terms in the statement to be tested, in this embodiment, the extraction device constructs a hypergraph relation matrix of the statement to be tested for triple extraction, thereby improving the accuracy and efficiency of triple extraction. The hypergraph relation matrix includes relationship vectors between several nodes and several hyperedges.

[0048] Please see Figure 2 , Figure 2 The flowchart of S3 in the aspect sentiment triple extraction method provided in one embodiment of this application includes steps S31 to S33, as follows:

[0049] S31: Obtain the syntactic dependency graph and dependency label data of the statement to be tested, and determine the dependency edges connecting the corresponding words in the syntactic dependency graph based on the dependency labels between several words in the dependency label data.

[0050] In this embodiment, the extraction device obtains the syntactic dependency graph of the statement to be tested. Specifically, the extraction device uses the Stanford parser to analyze the statement to be tested and construct a comprehensive syntactic dependency graph to explore the subtle relationships between the components in the statement to be tested.

[0051] The extraction device obtains dependency label data and, based on the dependency labels between several words in the dependency label data, determines the dependency edges connecting the corresponding several words in the syntactic dependency graph. Specifically, the syntactic dependency graph includes several nodes, and the dependency labels are used to indicate the dependency relationships between words in the test statement. The extraction device, based on the nodes corresponding to several words in the syntactic dependency graph and the dependency label data of the test statement, determines the dependency edges connecting the corresponding several words in the syntactic dependency graph when word w... i With the word w j There is a dependency relationship, indicating that the word w i With the word w j Dependency edges connecting words are used to determine the dependency edges connecting corresponding words in the syntactic dependency graph.

[0052] S32: Perform grammatical induction on the statement to be tested to obtain the grammatical structure graph of the statement to be tested and several grammatical edges in the grammatical structure graph; take the words that are connected to the dependency edges and grammatical edges as nodes of the relation hypergraph, and take the dependency edges and grammatical edges as hyperedges of the relation hypergraph to construct the relation hypergraph of the statement to be tested; transform the relation hypergraph to obtain the hypergraph relation matrix.

[0053] In this embodiment, the extraction device performs grammatical induction processing on the statement to be tested to obtain a grammatical structure graph of the statement to be tested and several grammatical edges in the grammatical structure graph. Specifically, the extraction device uses the slot constraint method proposed by Dunn to learn structural patterns and performs grammatical induction processing on the statement to be tested to extract the grammatical structure of the statement to be tested, thereby obtaining a grammatical structure graph of the statement to be tested and several grammatical edges in the grammatical structure graph.

[0054] Each structure is considered a hyperedge, and the words contained within the structure are considered member nodes of that hyperedge. Each hyperedge can connect multiple nodes according to a certain relationship. The extraction device uses words connected to the dependency edges and syntactic edges as nodes of the relation hypergraph, and the dependency edges and syntactic edges as hyperedges of the relation hypergraph, to construct the relation hypergraph of the statement to be tested. The relation hypergraph is then transformed to obtain the hypergraph relation matrix, wherein the hypergraph relation matrix includes relation vectors between several nodes and several hyperedges, and the relation vectors are:

[0055]

[0056] In the formula, Z ij Let v be the relationship vector between the i-th node and the j-th hyperedge. i For the i-th node, e j Let j be the j-th superedge.

[0057] S4: Input the sentence encoding representation and the hypergraph relation matrix into the hypergraph information extraction module to extract hypergraph information and obtain the sentence hypergraph information representation of the sentence to be tested.

[0058] In order to further model the contextual information of the statement under test, in this embodiment, the extraction device inputs the sentence encoding representation and the hypergraph relation matrix into the hypergraph information extraction module to extract hypergraph information and obtain the sentence hypergraph information representation of the statement under test.

[0059] Please see Figure 3 , Figure 3The flowchart of S4 in the aspect sentiment triple extraction method provided in one embodiment of this application includes steps S41 to S42, as follows:

[0060] S41: Input the sentence encoding representation and the hypergraph relation matrix into the hypergraph attention network to extract attention hypergraph information and obtain node attention information representation.

[0061] In this embodiment, the extraction device inputs the sentence encoding representation and the hypergraph relation matrix into the hypergraph attention network to extract attention hypergraph information, thereby capturing high-order interaction information between aspect words, opinion words, and other context words in the sentence to be tested, and obtaining node attention information representation.

[0062] The hypergraph attention network comprises several graph attention layers; please refer to [link / reference]. Figure 4 , Figure 4 The flowchart of S41 in the aspect sentiment triple extraction method provided in one embodiment of this application includes steps S411 to S412, as follows:

[0063] S411: The sentence encoding representation is used as the node input representation and node output representation of the first graph attention layer of the hypergraph attention network. Based on the hypergraph relation matrix, the node output representation and the preset first attention score calculation algorithm, the first attention score data is obtained.

[0064] In this embodiment, the extraction device uses the sentence encoding representation as the node input representation and node output representation of the first graph attention layer of the hypergraph attention network. Based on the hypergraph relationship matrix, the node output representation, and a preset first attention score calculation algorithm, it obtains first attention score data. The first attention score data includes the attention scores between several nodes connected to several hyperedges. The first attention score calculation algorithm is as follows:

[0065]

[0066] In the formula, α jk The attention score between the k-th node connected to the j-th hyperedge and the j-th hyperedge. Let MLP(·) be the output vector of the k-th node in the node output representation of the (l-1)-th graph attention layer, and let e be the multilayer perceptron function. j Let v be the j-th superedge. p For the p-th node that is connected to the j-th superedge, The output vector of the p-th node in the node output representation of the (l-1)-th graph attention layer is the node input representation of the (l-1)-th graph attention layer of the hypergraph attention network.

[0067] Specifically, the extraction device determines several nodes and several nodes in a set of connected hyperedges based on the hypergraph relationship matrix. Based on the node input representation of the current graph attention layer of the hypergraph attention network, which is the node output representation of the previous graph attention layer of the hypergraph attention network, the device calculates the attention score between the node and the hyperedge to obtain the first attention score data.

[0068] S412: Based on the hypergraph relation matrix, the first attention score data, the node input representation, and the preset hyperedge attention aggregation algorithm, obtain the hyperedge attention aggregation representation of several hyperedges.

[0069] In this embodiment, the extraction device, based on the hypergraph relationship matrix, the first attention score data, the node input representation, and a preset hyperedge attention aggregation algorithm, generates a hyperedge representation by aggregating node information, thereby obtaining a hyperedge attention aggregation representation of several hyperedges. The hyperedge attention aggregation algorithm is as follows:

[0070]

[0071] In the formula, Let v be the hyperedge attention aggregation representation of the j-th hyperedge in the l-th graph attention layer, where σ(·) is the activation function and v k For the k-th node that is connected to the j-th superedge, W n This is the first weight parameter.

[0072] S413: Obtain the second attention score data based on the hypergraph relation matrix, node output representation, hyperedge attention aggregation representation of several hyperedges, and a preset second attention score calculation algorithm.

[0073] In this embodiment, the extraction device obtains second attention score data based on the hypergraph relationship matrix, node output representation, hyperedge attention aggregation representation of several hyperedges, and a preset second attention score calculation algorithm. The second attention score data includes the attention scores between several hyperedges in a set of hyperedges connected to several nodes. The second attention score calculation algorithm is as follows:

[0074]

[0075] In the formula, β ijLet ε be the attention score between the j-th hyperedges in the set of hyperedges that connect the i-th node and the i-th node. i Let e ​​be the set of superedges connected to the i-th node. p Let j be the j-th superedge in the set of superedges that are connected to the p-th node. Let j be the hyperedge attention aggregation representation of the j-th hyperedge in the l-th graph attention layer. The output vector of the p-th node in the node output representation of the (l-1)-th graph attention layer is the node input representation of the (l-1)-th graph attention layer of the hypergraph attention network.

[0076] Specifically, the extraction device determines several nodes connected to several hyperedges based on the hypergraph relationship matrix. Then, based on the node input representation of the current graph attention layer of the hypergraph attention network (which is also the node output representation of the previous graph attention layer), it calculates the attention score β between the nodes and the hyperedges. ij .

[0077] S414: Based on the hypergraph relation matrix, the second attention score data, the node input representation, and the preset node attention aggregation algorithm, obtain the node attention aggregation representation, which serves as the node output representation of the first graph attention layer of the hypergraph attention network and the node input representation of the next graph attention layer. Repeat the calculation to obtain the node output representation of the last graph attention layer of the hypergraph attention network, which serves as the node attention information representation.

[0078] In this embodiment, the extraction device, based on the hypergraph relationship matrix, the second attention score data, the node input representation, and a preset node attention aggregation algorithm, aggregates information back to the nodes in the hyperedge by aggregating the hyperedge, thereby obtaining the node attention aggregation representation. The node attention aggregation algorithm is as follows:

[0079]

[0080] In the formula, Let e ​​be the output vector of the i-th node in the node output representation of the l-th graph attention layer. j Let β be the j-th superedge in the set of superedges that are connected to the i-th node. ij W represents the attention score between the j-th hyperedges in the set of hyperedges that connect the i-th node and the i-th node. e This is the second weighting parameter.

[0081] The extraction device uses the aggregated node attention representation as the node output representation of the first graph attention layer and the node input representation of the next graph attention layer of the hypergraph attention network, and repeats the calculation to obtain the node output representation of the last graph attention layer of the hypergraph attention network, which is used as the node attention information representation.

[0082] S42: Input the node attention information representation into the feedforward neural network for information fitting to obtain the node information fitting representation. Use the information fitting vectors of several nodes in the information-fitted node information representation as the information vectors of the corresponding words in the sentence to be tested to obtain the sentence hypergraph information representation.

[0083] In this embodiment, the extraction device inputs the node attention information representation into the feedforward neural network. After passing through several fully connected layers and residual connected layers connected in sequence in the feedforward neural network, information fitting is performed to obtain the node information fitting representation. The information fitting vectors of several nodes in the information fitting node information representation are used as the information vectors of the corresponding words in the sentence to be tested to obtain the sentence hypergraph information representation.

[0084] S5: Input the sentence hypergraph information representation into the relation-aware prompting module to perform word pair relation classification and relation perception, and obtain the relation-aware prompting representation of the sentence to be tested.

[0085] To further obtain a boundary-sensitive relation representation, in this embodiment, the extraction device inputs the sentence hypergraph information representation into the relation-aware prompting module for word pair relation classification and relation perception, thereby obtaining the relation-aware prompting representation of the sentence to be tested.

[0086] The relationship-aware prompting module includes a first multilayer perceptron network and a second multilayer perceptron network; please refer to [link / reference]. Figure 5 , Figure 5 The flowchart of S5 in the aspect sentiment triple extraction method provided in one embodiment of this application includes steps S51 to S52, as follows:

[0087] S51: Using a dual affine attention method, word pair relation representations are obtained based on the sentence hypergraph information representation and a preset relation probability distribution calculation algorithm.

[0088] The word pair relation representation includes relation probability distribution prediction data for several word pairs. This relation probability distribution prediction data includes several types of relation probability distribution predictions, where type C ∈ {N, BA, IA, BO, IO, A, O, POS, NEU, NEG}. In {BA, IA, BO, IO}, B and I represent the beginning and interior of a term, respectively. The sub-labels -A and -O aim to determine whether a term is an aspect term or an opinion term. Additionally, {A, O} are used to indicate whether two different words belong to the same aspect term or opinion term. {POS, NEU, NEG} not only detects word pair matching but also determines the sentiment polarity of the aspect-opinion pair: POS represents positive, NEU represents neutral, and NEG represents negative. This relation labeling scheme has been proven to be boundary-sensitive, helping the model to further learn boundary-sensitive word pair relations.

[0089] In this embodiment, the extraction device employs a dual affine attention method to obtain word pair relation representations based on the sentence hypergraph information representation and a preset relation probability distribution calculation algorithm. The relation probability distribution calculation algorithm is as follows:

[0090] R = Biaffine (MLP) a (H F MLP o (H F ))

[0091] In the formula, R represents the word pair relation, Biaffine(·) is the biaffine attention function, and MLP is used. a (·) represents the processing function of the first multilayer perceptron network, MLP. o (·) represents the processing function of the second multilayer perceptron network, H F This is the hypergraph information representation of the sentence.

[0092] S52: Perform max pooling on the word pair relation representation to obtain the max pooled word pair relation representation. Based on the sentence hypergraph information representation and the max pooled word pair relation representation, use a gating mechanism to perform information fusion to obtain a relation-aware prompt representation.

[0093] In this embodiment, the extraction device performs max pooling on the word pair relation representation, aggregating relation information from the related relation representations for each word to obtain the max-pooled word pair relation representation. Based on the sentence hypergraph information representation and the max-pooled word pair relation representation, a gating mechanism is used for information fusion to obtain a relation-aware prompt representation.

[0094] S6: Input the sentence encoding representation and relation-aware prompt representation into the triple extraction module to extract triples and obtain the aspect sentiment triple extraction result of the sentence to be tested.

[0095] In this embodiment, the extraction device inputs the sentence encoding representation and the relation-aware prompt representation into the triple extraction module to extract triples and obtain the aspect sentiment triple extraction result of the sentence to be tested.

[0096] By constructing a hypergraph relation matrix of the sentence to be tested and combining the sentence encoding representation to extract hypergraph information, the interaction information between aspect words, opinion words and other context words in the sentence to be tested is captured, and the sentence hypergraph information representation is obtained. Word pair relation classification and relation perception are performed on the sentence hypergraph information representation, and boundary-sensitive relation perception cue representation is further obtained for decoding, providing relation perception cue information for the decoding process. This improves the accuracy and efficiency of aspect sentiment triple extraction and improves the accuracy of fine-grained sentiment analysis tasks.

[0097] Please see Figure 6 , Figure 6 The flowchart of S6 in the aspect sentiment triple extraction method provided in one embodiment of this application includes steps S61 to S62, as follows:

[0098] S61: Input the sentence encoding representation and relation-aware prompt representation into the decoder, obtain the sentence decoding template representation according to the preset first sentence decoding algorithm, and then use the sentence decoding template representation.

[0099] To further utilize relational information during the decoding stage and facilitate more accurate aspect sentiment triplet extraction results from the model, in this embodiment, the extraction device inputs the sentence encoding representation and relation-aware cue representation into the decoder. Based on a preset first sentence decoding algorithm, a sentence decoding template representation is obtained. This template representation consists of several triples arranged in a fixed type order. The first sentence decoding algorithm is as follows:

[0100] H d =Decoder(H e ,P)

[0101] In the formula, H d The sentence is represented by a decoding template, and Decoder(·) is the decoding function. H e Let P be the sentence encoding representation, and let P be the relation-aware cue representation.

[0102] S62: Based on the sentence decoding template representation, and based on the position index of several triples in the sentence decoding template representation, determine the type and sentiment polarity of several triples in the sentence decoding template representation, and obtain the aspect sentiment triple extraction result of the sentence to be tested.

[0103] In this embodiment, the extraction device determines the type and sentiment polarity of several triples in the sentence decoding template representation based on the position index of several triples in the sentence decoding template representation, and obtains the aspect sentiment triple extraction result of the sentence to be tested.

[0104] In an optional embodiment, step S7 is further included: training the triple extraction model. (See [link to previous document]). Figure 7 , Figure 7 A flowchart illustrating step S7 of the aspect sentiment triple extraction method provided in another embodiment of this application includes steps S71 to S75, as follows:

[0105] S71: Obtain several sample sentences and their tag template representations.

[0106] In this embodiment, the extraction device obtains several sample sentences and a tag template representation of the sample sentences. The tag template representation is composed of tag data of several triples in the sample sentences arranged in a fixed type order. The tag data of the triples includes word probability distribution tag data of word pairs and sentiment probability distribution tag data of word pairs.

[0107] S72: Input several sample sentences into the triple extraction model to be trained to obtain the sentence encoding representation and word pair relation representation of several sample sentences.

[0108] In this embodiment, the extraction device inputs several sample sentences into the triple extraction model to be trained to obtain sentence encoding representations and word pair relation representations of several sample sentences. The word pair relation representation includes relation probability distribution prediction data corresponding to several words, and the relation probability distribution prediction data includes relation probability distribution prediction vectors of several types.

[0109] S73: Obtain relation probability distribution label data of several word pairs in several sample sentences, and obtain the first cross-entropy loss value based on the relation probability distribution prediction data, relation probability distribution label data and preset first cross-entropy loss function of several word pairs in several sample sentences.

[0110] In this embodiment, the extraction device obtains relation probability distribution label data for several word pairs in several sample sentences. Based on the relation probability distribution prediction data, relation probability distribution label data, and a preset first cross-entropy loss function, a first cross-entropy loss value is obtained. The relation probability distribution label data includes relation probability distribution label vectors of several types, and the first cross-entropy loss function is:

[0111]

[0112] In the formula, Here, y represents the first cross-entropy loss value, n is the number of words in the sample sentence, and y represents the first cross-entropy loss value. ij Let be the label vector representing the probability distribution of the word pair formed by the i-th word and the j-th word in the sample sentence. Let c be the number of types and r be the number of types. i,j|c Let c be the probability distribution prediction vector of the relationship between the i-th word and the j-th word pair.

[0113] S74: The sentence encoding representations of several sample sentences are used as the input representations of the decoder in the triple extraction model to be trained, and the label template representations of several sample sentences are used as the initial output representations of the decoder. The decoder is iterated several times according to the preset second sentence decoding algorithm to obtain the sentence decoding representations of several sample sentences at several time points.

[0114] In this embodiment, the extraction device uses the sentence encoding representations of several sample sentences as the input representations of the decoder in the triplet extraction model to be trained, and the label template representations of several sample sentences as the initial output representations of the decoder. It then performs several iterations of decoding according to a preset second sentence decoding algorithm to obtain the sentence decoding representations of the sample sentences at several time points. The second sentence decoding algorithm is as follows:

[0115]

[0116] In the formula, Let H′ be the sentence decoding representation of the sample sentence at time t. e The sentence encoding representation for the sample sentences. This is the decoded representation of the sample sentence at time t-1.

[0117] S75: Perform conditional probability transformation on the sentence decoding representations of several sample sentences at several time points to obtain conditional probability representations of several sample sentences at several time points. Based on the conditional probability representations of several sample sentences at several time points and the preset second cross-entropy loss function, obtain the second cross-entropy loss value. Based on the first cross-entropy loss value and the second cross-entropy loss value, train the triple extraction model to be trained.

[0118] In this embodiment, the extraction device performs conditional probability transformation on the sentence decoding representations of several sample sentences at several time points to obtain conditional probability representations of several sample sentences at several time points. Based on the conditional probability representations of several sample sentences at several time points and a preset second cross-entropy loss function, a second cross-entropy loss value is obtained, wherein the second cross-entropy loss function is:

[0119]

[0120] In the formula, The second cross-entropy loss value is given, and T is the total duration. Let be the conditional probability representation of the sample sentence at time t.

[0121] The extraction device accumulates the first cross-entropy loss value and the second cross-entropy loss value to obtain a total loss value, and trains the triple extraction model to be trained based on the total loss value.

[0122] Please refer to Figure 8 , Figure 8 This is a schematic diagram of an aspect sentiment triplet extraction device provided in one embodiment of this application. The device can be implemented entirely or partially through software, hardware, or a combination of both. The device 8 includes:

[0123] The data acquisition unit 81 is used to acquire the sentence to be tested and a preset triple extraction model. The sentence to be tested includes several words, and the triple extraction model includes a sentence encoding module, a hypergraph information extraction module, a relation-aware prompting module, and a triple extraction module.

[0124] The sentence encoding unit 82 is used to input the sentence to be tested into the sentence encoding module for encoding processing to obtain the sentence encoding representation of the sentence to be tested;

[0125] The matrix construction unit 83 is used to construct the hypergraph relation matrix of the statement to be tested, wherein the hypergraph relation matrix includes the relationship vectors between several nodes and several hyperedges;

[0126] The feature extraction unit 84 is used to input the sentence encoding representation and the hypergraph relation matrix into the hypergraph information extraction module to extract hypergraph information and obtain the sentence hypergraph information representation of the sentence to be tested;

[0127] The relation-aware unit 85 is used to input the sentence hypergraph information representation into the relation-aware prompting module to perform word pair relation classification and relation perception, and obtain the relation-aware prompting representation of the sentence to be tested;

[0128] The triplet extraction unit 86 is used to input the sentence encoding representation and the relation-aware prompt representation into the triplet extraction module for triplet extraction, so as to obtain the aspect sentiment triplet extraction result of the sentence to be tested.

[0129] In this embodiment, the extraction device obtains the sentence to be tested and a preset triple extraction model through a data acquisition unit. The sentence to be tested includes several words, and the triple extraction model includes a sentence encoding module, a hypergraph information extraction module, a relation-aware prompting module, and a triple extraction module. The sentence to be tested is input into the sentence encoding module for encoding processing through the sentence encoding unit to obtain the sentence encoding representation of the sentence to be tested. A matrix construction unit constructs a hypergraph relation matrix of the sentence to be tested, wherein the hypergraph relation matrix includes the relational directions between several nodes and several hyperedges. The process involves several steps: First, the sentence encoding representation and hypergraph relation matrix are input into the hypergraph information extraction module via a feature extraction unit to extract hypergraph information and obtain the sentence hypergraph information representation of the test sentence. Second, the sentence hypergraph information representation is input into the relation perception prompt module via a relation perception unit to perform word pair relation classification and relation perception, obtaining the relation perception prompt representation of the test sentence. Third, the sentence encoding representation and relation perception prompt representation are input into the triplet extraction module via a triplet extraction unit to extract triplets, obtaining the aspect sentiment triplet extraction result of the test sentence.

[0130] The data acquisition unit acquires the sentence to be tested and a preset triple extraction model. The sentence to be tested includes several words, and the triple extraction model includes a sentence encoding module, a feature extraction module, an entity detection module, and a sentiment analysis module. The sentence encoding unit inputs the sentence to be tested into the sentence encoding module for encoding processing to obtain the sentence encoding representation of the sentence to be tested. The feature extraction unit constructs a part-of-speech adjacency matrix and a syntactic adjacency matrix for the sentence to be tested, and inputs the sentence encoding representation, part-of-speech adjacency matrix, and syntactic adjacency matrix into the feature extraction module for feature extraction to obtain the contextual feature representation of the sentence to be tested. The entity detection unit constructs several word groups of the sentence to be tested, and based on the contextual feature representation, constructs a first segment feature representation of several word groups. The first segment feature representation of several word groups is then constructed. The first fragment feature representation of the word group is input into the entity detection module to obtain entity detection results for several word groups, wherein the entity detection results include aspect words and opinion words; through the term extraction unit, several terms of the sentence to be tested are constructed based on the entity detection results of several word groups, wherein the term includes the word group corresponding to the aspect words and the word group corresponding to the opinion words; through the aspect sentiment triple construction unit, the second fragment feature representation of several term is constructed based on the first fragment feature representation of several word groups, and the second fragment feature representation of several term is input into the sentiment analysis module to obtain the sentiment analysis results of several term, thereby constructing several aspect sentiment triples of the sentence to be tested, wherein the aspect sentiment triple includes term and the sentiment analysis result of term. By constructing a hypergraph relation matrix of the sentence to be tested and combining the sentence encoding representation to extract hypergraph information, the interaction information between aspect words, opinion words and other context words in the sentence to be tested is captured, and the sentence hypergraph information representation is obtained. Word pair relation classification and relation perception are performed on the sentence hypergraph information representation, and boundary-sensitive relation perception cue representation is further obtained for decoding, providing relation perception cue information for the decoding process. This improves the accuracy and efficiency of aspect sentiment triple extraction and improves the accuracy of fine-grained sentiment analysis tasks.

[0131] Please refer to Figure 9 , Figure 9 This is a schematic diagram of the structure of a computer device provided in one embodiment of this application. The computer device 10 includes: a processor 91, a memory 92, and a computer program 93 stored in the memory 92 and executable on the processor 91; the computer device can store multiple instructions, which are adapted to be loaded and executed by the processor 91. Figures 1 to 7 The method steps of the illustrated embodiment can be found in the following documentation for detailed execution. Figures 1 to 7The specific details of the illustrated embodiments will not be elaborated here.

[0132] The processor 91 may include one or more processing cores. The processor 91 connects to various parts of the server using various interfaces and lines, and executes various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 92, and by calling data stored in the memory 92. Optionally, the processor 91 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 91 may integrate one or a combination of several of the following: a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), and a modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required to be displayed on the touch screen; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 91 and may be implemented as a separate chip.

[0133] The memory 92 may include random access memory (RAM) or read-only memory. Optionally, the memory 92 may include a non-transitory computer-readable storage medium. The memory 92 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 92 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch instructions), instructions for implementing the various method embodiments described above, etc.; the data storage area may store data involved in the various method embodiments described above, etc. Optionally, the memory 92 may also be at least one storage device located remotely from the aforementioned processor 91.

[0134] This application also provides a storage medium that can store multiple instructions. These instructions are applicable to being loaded and executed by a processor using the method steps described in Embodiments 1 to 4 above. For details of the execution process, please refer to the specific descriptions of Embodiments 1 to 4, which will not be repeated here.

[0135] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0136] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0137] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the algorithm. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0138] In the embodiments provided by this invention, it should be understood that the disclosed apparatus / terminal devices and methods can be implemented in other ways. For example, the apparatus / terminal device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0139] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0140] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0141] If the integrated module / unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms.

[0142] This invention is not limited to the above-described embodiments. If any modifications or variations to this invention do not depart from the spirit and scope of this invention, and if such modifications and variations fall within the scope of the claims and equivalent technologies of this invention, then this invention also intends to include such modifications and variations.

Claims

1. A method for extracting aspect-based emotion triples, characterized in that, Includes the following steps: The test sentence and a preset triplet extraction model are obtained. The test sentence includes several words, and the triplet extraction model includes a sentence encoding module, a hypergraph information extraction module, a relation-aware prompting module, and a triplet extraction module. The hypergraph information extraction module includes a hypergraph attention network and a feedforward neural network. The sentence to be tested is input into the sentence encoding module for encoding processing to obtain the sentence encoding representation of the sentence to be tested; Obtain the syntactic dependency graph and dependency label data of the statement to be tested, and determine the dependency edges connecting the corresponding words in the syntactic dependency graph based on the dependency labels between several words in the dependency label data. The test statement is subjected to grammatical induction to obtain a grammatical structure graph of the test statement and several grammatical edges in the grammatical structure graph; words connected to the dependency edges and grammatical edges are respectively used as nodes of the relation hypergraph, and the dependency edges and grammatical edges are used as hyperedges of the relation hypergraph to construct the relation hypergraph of the test statement; the relation hypergraph is transformed to construct the hypergraph relation matrix of the test statement, wherein the hypergraph relation matrix includes relation vectors between several nodes and several hyperedges; The sentence encoding representation and the hypergraph relation matrix are input into the hypergraph attention network to extract attention hypergraph information and obtain node attention information representation; The node attention information representation is input into the feedforward neural network for information fitting to obtain the node information fitting representation. The information fitting vectors of several nodes in the information-fitted node information representation are used as the information vectors of the corresponding words in the sentence to be tested to obtain the sentence hypergraph information representation of the sentence to be tested. The sentence hypergraph information representation is input into the relation-aware prompting module for word pair relation classification and relation perception to obtain the relation-aware prompting representation of the sentence to be tested. The sentence encoding representation and relation-aware cue representation are input into the triple extraction module for triple extraction to obtain the aspect sentiment triple extraction result of the sentence to be tested.

2. The aspect-of-emotion triplet extraction method according to claim 1, characterized in that: The hypergraph attention network includes several graph attention layers; The step of inputting the sentence encoding representation and the hypergraph relation matrix into the hypergraph attention network for attention hypergraph information extraction to obtain node attention information representation includes the following steps: The sentence encoding is used as the node input and output representations of the first graph attention layer of the hypergraph attention network. Based on the hypergraph relation matrix, the node output representations, and a preset first attention score calculation algorithm, first attention score data is obtained. The first attention score data includes the attention scores between several nodes connected to several hyperedges and these hyperedges. The first attention score calculation algorithm is as follows: In the formula, α jk The attention score between the k-th node connected to the j-th hyperedge and the j-th hyperedge. Let MLP(·) be the output vector of the k-th node in the output representation of the (l-1)-th graph attention layer, and let e be the multilayer perceptron function. j Let v be the j-th superedge. p For the p-th node that is connected to the j-th superedge, Let p be the output vector of the p-th node in the node output representation of the (l-1)-th graph attention layer; the node input representation of the l-th graph attention layer of the hypergraph attention network is the node output representation of the (l-1)-th graph attention layer of the hypergraph attention network. Based on the first attention score data, the node input representation, and the preset hyperedge attention aggregation algorithm, a hyperedge attention aggregation representation of several hyperedges is obtained, wherein the hyperedge attention aggregation algorithm is: In the formula, Let v be the hyperedge attention aggregation representation of the j-th hyperedge in the l-th graph attention layer, where σ(·) is the activation function and v k For the k-th node that is connected to the j-th superedge, W n This is the first weight parameter; Based on the hypergraph relationship matrix, node output representation, hyperedge attention aggregation representation of several hyperedges, and a preset second attention score calculation algorithm, second attention score data is obtained. The second attention score data includes the attention scores between several hyperedges in a set of hyperedges connected to several nodes. The second attention score calculation algorithm is as follows: In the formula, β ij Let ε be the attention score between the j-th hyperedges in the set of hyperedges that connect the i-th node and the i-th node. i Let e ​​be the set of superedges connected to the i-th node. p Let j be the j-th superedge in the set of superedges that are connected to the p-th node. Let j be the hyperedge attention aggregation representation of the j-th hyperedge in the l-th graph attention layer. Let p be the output vector of the p-th node in the node output representation of the (l-1)-th graph attention layer; the node input representation of the l-th graph attention layer of the hypergraph attention network is the node output representation of the (l-1)-th graph attention layer of the hypergraph attention network. Based on the second attention score data, node input representation, and a preset node attention aggregation algorithm, a node attention aggregation representation is obtained, which serves as the node output representation of the first graph attention layer and the node input representation of the next graph attention layer in the hypergraph attention network. This calculation is repeated to obtain the node output representation of the last graph attention layer in the hypergraph attention network, which serves as the node attention information representation. The node attention aggregation algorithm is as follows: In the formula, Let e ​​be the output vector of the i-th node in the node output representation of the l-th graph attention layer. j Let β be the j-th superedge in the set of superedges that are connected to the i-th node. ij W represents the attention score between the j-th hyperedges in the set of hyperedges that connect the i-th node and the i-th node. e This is the second weighting parameter.

3. The aspect-of-emotion triplet extraction method according to claim 2, characterized in that: The relationship-aware prompting module includes a first multilayer perceptron network and a second multilayer perceptron network. The step of inputting the sentence hypergraph information representation into the relation-aware prompting module for word pair relation classification and relation perception to obtain the relation-aware prompting representation of the sentence to be tested includes the following steps: A dual affine attention method is employed to obtain word pair relation representations based on the sentence hypergraph information representation and a preset relation probability distribution calculation algorithm. The word pair relation representations include relation probability distribution prediction data for several word pairs. The relation probability distribution calculation algorithm is as follows: R=Biaffine(MLP a (H F ),MLP o (H F )) In the formula, R is the word pair relation representation, Biaffine(·) is the biaffine attention function, and MLP a (·) represents the processing function of the first multilayer perceptron network, MLP. o (·) represents the processing function of the second multilayer perceptron network, H F The sentence is represented by hypergraph information; The word pair relation representation is subjected to max pooling to obtain a max pooled word pair relation representation. Based on the sentence hypergraph information representation and the max pooled word pair relation representation, a gating mechanism is used to perform information fusion to obtain a relation-aware cue representation.

4. The aspect-of-emotion triplet extraction method according to claim 3, characterized in that, The step of inputting the sentence encoding representation and relation-aware cue representation into the triple extraction module for triple extraction to obtain the aspect sentiment triple extraction result of the sentence to be tested includes the following steps: The sentence encoding representation and relation-aware prompt representation are input into the decoder. According to a preset first sentence decoding algorithm, a sentence decoding template representation is obtained. This sentence decoding template representation consists of several triples arranged in a fixed type order. The first sentence decoding algorithm is as follows: H d =Decoder(H e ,P) In the formula, H d The sentence is represented by a decoding template, and Decoder(·) is the decoding function. H e P represents the sentence encoding representation, and P represents the relation-aware cue representation. Based on the sentence decoding template representation, and based on the position index of several triples in the sentence decoding template representation, the type and sentiment polarity of several triples in the sentence decoding template representation are determined, and the aspect sentiment triple extraction result of the sentence to be tested is obtained.

5. The aspect-of-emotion triplet extraction method according to claim 4, characterized in that, It also includes the step of training the triple extraction model; The training of the triplet extraction model includes the following steps: Obtain several sample sentences and their tag template representations. The tag template representation consists of tag data of several triples in the sample sentences arranged in a fixed type order. The tag data of the triples includes word probability distribution tag data of word pairs and sentiment probability distribution tag data of word pairs. Several sample sentences are input into a triplet extraction model to be trained to obtain sentence encoding representations and word pair relation representations of several sample sentences. The word pair relation representation includes relation probability distribution prediction data corresponding to several words, and the relation probability distribution prediction data includes relation probability distribution prediction vectors of several types. Obtain relation probability distribution label data for several word pairs in several sample sentences. Based on the relation probability distribution prediction data, relation probability distribution label data, and a preset first cross-entropy loss function, obtain a first cross-entropy loss value. The relation probability distribution label data includes relation probability distribution label vectors of several types. The first cross-entropy loss function is: In the formula, Here, y represents the first cross-entropy loss value, n is the number of words in the sample sentence, and y represents the first cross-entropy loss value. ij Let be the label vector representing the probability distribution of the word pair formed by the i-th word and the j-th word in the sample sentence. Let c be the number of types, and r be the type. i,j|c Let c be the probability distribution prediction vector of the relationship between the i-th word and the j-th word pair. The sentence encoding representations of several sample sentences are used as the input representations of the decoder in the triplet extraction model to be trained, and the label template representations of several sample sentences are used as the initial output representations of the decoder. The decoder is iterated several times according to a preset second sentence decoding algorithm to obtain the sentence decoding representations of the sample sentences at several time points. The second sentence decoding algorithm is as follows: In the formula, Let H′ be the sentence decoding representation of the sample sentence at time t. e The sentence encoding representation for the sample sentences. The sentence decoding representation at time t-1 of the sample sentence; Conditional probability transformation is performed on the sentence decoding representations of several sample sentences at several time points to obtain conditional probability representations of the several sample sentences at several time points. Based on these conditional probability representations and a preset second cross-entropy loss function, a second cross-entropy loss value is obtained. The triplet extraction model to be trained is then trained based on the first and second cross-entropy loss values, wherein the second cross-entropy loss function is: In the formula, The second cross-entropy loss value is given, and T is the total duration. Let be the conditional probability representation of the sample sentence at time t.

6. A device for extracting aspect-of-emotion triads, characterized in that, include: The data acquisition unit is used to acquire the sentence to be tested and a preset triple extraction model. The sentence to be tested includes several words, and the triple extraction model includes a sentence encoding module, a hypergraph information extraction module, a relation-aware prompting module, and a triple extraction module. The hypergraph information extraction module includes a hypergraph attention network and a feedforward neural network. A sentence encoding unit is used to input the sentence to be tested into the sentence encoding module for encoding processing to obtain the sentence encoding representation of the sentence to be tested; A matrix construction unit is used to obtain the syntactic dependency graph and dependency label data of the statement to be tested, and to determine the dependency edges connecting the corresponding words in the syntactic dependency graph based on the dependency labels between several words in the dependency label data. The test statement is subjected to grammatical induction to obtain a grammatical structure graph of the test statement and several grammatical edges in the grammatical structure graph; words connected to the dependency edges and grammatical edges are respectively used as nodes of the relation hypergraph, and the dependency edges and grammatical edges are used as hyperedges of the relation hypergraph to construct the relation hypergraph of the test statement; the relation hypergraph is transformed to construct the hypergraph relation matrix of the test statement, wherein the hypergraph relation matrix includes relation vectors between several nodes and several hyperedges; The feature extraction unit is used to input the sentence encoding representation and the hypergraph relation matrix into the hypergraph attention network to extract attention hypergraph information and obtain node attention information representation; The node attention information representation is input into the feedforward neural network for information fitting to obtain the node information fitting representation. The information fitting vectors of several nodes in the information-fitted node information representation are used as the information vectors of the corresponding words in the sentence to be tested to obtain the sentence hypergraph information representation of the sentence to be tested. The relation-aware unit is used to input the sentence hypergraph information representation into the relation-aware prompting module to perform word pair relation classification and relation perception, and obtain the relation-aware prompting representation of the sentence to be tested; The triplet extraction unit is used to input the sentence encoding representation and relation-aware prompt representation into the triplet extraction module for triplet extraction, so as to obtain the aspect sentiment triplet extraction result of the sentence to be tested.

7. A computer device, characterized in that, It includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the aspect sentiment triple extraction method as described in any one of claims 1 to 5.

8. A storage medium, characterized in that: The storage medium stores a computer program that, when executed by a processor, implements the steps of the aspect sentiment triple extraction method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Knowledge enhancement-based aspect emotion triple extraction method and system

    CN117171610A

  • Multi-view knowledge graph inference method and system based on hypergraph convolution and graph convolution, and storage medium

    CN118396093A