A method, device and computer equipment for extracting aspect-level sentiment triples

Through interval-level part-of-speech annotation and component syntax analysis, combined with graph neural network and dependent syntax relationship, the problem of inability to deeply explore semantic interaction information in the existing methods is solved, and more accurate aspect-level emotional triple extraction is achieved.

CN115270814BActive Publication Date: 2025-08-29SOUTH CHINA NORMAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210935734.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-04
Publication Date
2025-08-29
Estimated Expiration
2042-08-04

AI Technical Summary

Technical Problem

The existing aspect-level emotion triple extraction methods cannot effectively learn semantic connection information between words within aspects and opinions, and can only model shallow semantic interaction information, affecting the accuracy of emotional polarity judgment.

Method used

The interval-level part-of-speech annotation and component syntax analysis are used, combined with the graph neural network and dependent syntax relationship, and the dependent syntax relationship is learned through the attention mechanism, the semantic interaction information of terms and opinion terms is extracted, and the multi-layer perceptron is used to predict emotional polarity.

Benefits of technology

It improves the accuracy of aspect-level emotional triple extraction, can fully learn the semantic information of internal words and the interactive information between terms, and improves the correctness of emotional polarity judgment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115270814B_ABST
    Figure CN115270814B_ABST
Patent Text Reader

Abstract

The present invention relates to an aspect-level sentiment triple extraction method, device and computer equipment. The aspect-level sentiment triple extraction method described in the present invention includes the following steps: obtaining an input sentence, encoding it, obtaining a contextual representation of the words in the sentence, constructing interval-level part-of-speech tagging information and component syntactic information, so that the model can fully learn the semantic connection information of the words within the interval text and thus obtain the interval feature representation; through the graph neural network and dependency syntactic relationship, and fusing the interval feature representation, extracting the semantic interaction information between aspect terms and opinion terms, and obtaining the aspect-term feature representation; then completing the judgment of sentiment polarity, and completing the extraction of sentiment triples. The aspect-level sentiment triple extraction method, device and computer equipment described in the present invention have the advantages of being able to learn internal semantic information and interaction information between terms, thereby improving the accuracy of aspect-level sentiment triple extraction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of text sentiment analysis, and in particular to the field of an aspect-level sentiment triple extraction method. Background Art

[0002] Aspect-level sentiment analysis is increasingly being used in everyday life. For example, businesses analyze customer reviews of certain products or services and use this information to improve them, ultimately achieving higher returns and satisfaction. Consequently, aspect-level sentiment analysis has garnered widespread attention over the past decade. Within the foundational tasks of aspect-level sentiment analysis, a growing number of researchers are exploring new areas. Building upon the traditional tasks of aspect term extraction (ATE) and opinion term extraction (ATE), a number of combined tasks have emerged, such as aspect term and opinion term pair extraction (AOPE) and aspect sentiment triplet extraction (ASTE), among many other subtasks.

[0003] Most existing methods for extracting aspect-level sentiment triples use sequence labeling. However, this approach can only model word-level contextual information. Typically, aspect terms and opinion terms often contain multiple words, making it impossible for the model to learn the semantic connections between words within aspect and opinion terms. Furthermore, existing methods can only model shallow semantic interactions between aspect and opinion terms, failing to delve into deeper interactions. Sentiment polarity judgment relies heavily on the semantic interactions between aspect and opinion terms, significantly impacting its accuracy. Summary of the Invention

[0004] Based on this, the purpose of the present invention is to provide an aspect-level sentiment triple extraction method, apparatus and computer equipment, which have the advantage of being able to learn internal semantic information and interactive information between terms, thereby improving the accuracy of aspect-level sentiment triple extraction.

[0005] In order to achieve the above technical objectives, the present invention adopts the following technical solutions.

[0006] In a first aspect, the present invention provides an aspect-level sentiment triple extraction method, comprising: obtaining an input sentence, encoding the sentence, and obtaining context representations of words in the sentence;

[0007] Based on the context representation of the word, constructing a part-of-speech representation and a semantic composition representation at the interval level; based on the part-of-speech representation and the semantic composition representation, combining the context word representation to obtain an interval feature representation;

[0008] Inputting the interval feature representation into a multi-layer perceptron to extract aspect terms and opinion terms;

[0009] Inputting the context representation of the word and the preprocessed dependency matrix into an attention graph neural network to obtain a word-level dependency syntactic relationship representation; assigning a weight to each word-level dependency syntactic relationship through an attention mechanism to obtain an interval-level dependency syntactic relationship representation; concatenating the interval features of aspect terms, the interval-level dependency syntactic relationship representation corresponding to the aspect terms, the interval features of opinion terms, the interval-level dependency syntactic relationship representation corresponding to the opinion terms, and a trainable width embedding matrix to obtain an aspect-opinion representation;

[0010] The aspect opinion-representation is input into a multi-layer perceptron to extract the sentiment polarity, and the extracted aspect terms and the opinion terms are combined to complete the extraction of the sentiment triples.

[0011] Furthermore, based on the context representation of the word, a method for constructing a part-of-speech representation and a semantic composition representation at the interval level includes:

[0012] Enumerate all possible spans based on the context of the word;

[0013] span a,b ={s a ,s a+1 ,…,s i ,…,s b}, where a represents the ath word, b represents the bth word, and b>=a;

[0014] Perform part-of-speech tagging on the contextual representation of the word and map the part-of-speech tagging interval into a part-of-speech embedding matrix The self-attention mechanism is used to assign a weight to each word, and the interval-level part-of-speech feature representation p is obtained by the following formula. a,b ;

[0015]

[0016] in is the scaling factor, σ is the activation function, W p1 、W p2 、W p3 are all learnable matrices.

[0017] Build a component syntax tree based on the context representation of the word, count the component paths of each word, and map it into a component path embedding matrix The self-attention mechanism is used to assign weights to the component path labels of each word, and the semantic composition representation at the word level is obtained by the following formula

[0018]

[0019] in is the scaling factor, σ is the activation function, W q1 、W q2 、W q3 are all learnable matrices.

[0020] The self-attention mechanism is used to assign weights to each word in the interval, and the interval-level semantic composition representation c is obtained by the following formula a,b ;

[0021]

[0022] in is the scaling factor, σ is the activation function, W c1 、W c2 、W c3 are all learnable matrices.

[0023] Furthermore, the method of obtaining interval feature representation based on the part-of-speech representation and the semantic composition representation in combination with the context word representation includes:

[0024] According to the part-of-speech representation p at the interval level a,b and the interval-level semantic structure representation c a,b , using a multi-layer perceptron as an aggregator, the interval-level part-of-speech-component syntactic representation k is obtained by the following formula a,b ;

[0025]

[0026] Where σ is the activation function, Represents the splicing operation, MLP s stands for Multilayer Perceptron;

[0027] Obtain interval feature representation s by concatenation a,b ;

[0028]

[0029] in is the ath and bth words in the context, f width(a, b) represents a trainable width embedding matrix. Further, the interval feature representation is input into a multi-layer perceptron to extract aspect terms and opinion terms; the method for extracting the aspect terms and opinion terms is:

[0030] P(m|s a,b )=σ(MLP m (s a,b ))

[0031] Where σ is the activation function, the category m∈{aspect term, opinion term, invalid}, MLP m Stands for Multi-Layer perceptron (MLP).

[0032] Furthermore, intervals with top 50% probability rankings are selected as candidate aspect terms and opinion terms.

[0033] Furthermore, the context representation of the word and the preprocessed dependency matrix are input into the attention graph neural network to obtain the word-level dependency syntactic relationship representation; this is accomplished by the following steps:

[0034] Map each dependency category into a corresponding category embedding matrix

[0035] Assign weights to connections between words through the attention mechanism

[0036]

[0037] in and The word x i and word x j The intermediate variables are calculated by the following formula:

[0038]

[0039] in, For word x i The word-level dependency syntactic representation of For word x j The word-level dependency syntactic representation, and according to the corresponding weight Obtain word-level dependency syntactic representation

[0040]

[0041] Among them, σ is the activation function, W (l) , b (l)is a learnable matrix;

[0042] Furthermore, a weight is assigned to each of the word-level dependency syntactic relations through an attention mechanism to obtain an interval-level dependency syntactic relation representation; this is achieved by the following steps:

[0043] Get the text interval and select the dependency syntactic relationship interval based on the text interval

[0044] The interval-level dependency syntactic relation representation d is obtained by the following formula a,b ;

[0045]

[0046] in is the scaling factor, σ is the activation function, W d1 、W d2 、W d3 are all learnable matrices.

[0047] In a second aspect, an embodiment of the present application provides an aspect-level sentiment triple extraction device, comprising:

[0048] A sample acquisition module acquires an input sentence, encodes it, and obtains contextual representations of words in the sentence;

[0049] An interval feature representation extraction module is used to construct an interval-level part-of-speech representation and a semantic composition representation based on the context representation of the word; and to obtain an interval feature representation by fusing the context word representation with the part-of-speech representation and the semantic composition representation;

[0050] an aspect term and opinion term extraction module, configured to input the interval feature representation into a multi-layer perceptron to extract aspect terms and opinion terms;

[0051] An aspect-opinion representation extraction module is configured to input the context representation of the word and the preprocessed dependency matrix into an attention graph neural network to obtain a word-level dependency syntactic relationship representation; assign a weight to each word-level dependency syntactic relationship through an attention mechanism to obtain an interval-level dependency syntactic relationship representation; and concatenate the interval features of aspect terms, the interval-level dependency syntactic relationship representation corresponding to the aspect terms, the interval features of opinion terms, the interval-level dependency syntactic relationship representation corresponding to the opinion terms, and a trainable width embedding matrix to obtain the aspect-opinion representation;

[0052] The sentiment triplet extraction module is used to input the aspect-opinion representation into a multi-layer perceptron, extract sentiment polarity, and combine the extracted aspect terms with the opinion terms to complete the extraction of the sentiment triplet.

[0053] In a third aspect, an embodiment of the present application provides a computer device, including:

[0054] at least one memory and at least one processor;

[0055] The memory is used to store one or more programs;

[0056] When the one or more programs are executed by the at least one processor, the at least one processor implements the steps of any one of the aspect-level sentiment triple extraction methods described in the first aspect.

[0057] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and is characterized in that when the computer program is executed by a processor, it implements the steps of any one of the aspect-level sentiment triple extraction methods described in the first aspect.

[0058] The present invention describes an aspect-level sentiment triple extraction method that leverages interval-level part-of-speech tagging and component syntactic information to enable the model to fully learn the semantic connections between words within interval text. This method then uses graph neural networks and dependency syntactic relationships, integrating interval representations, to extract rich semantic interaction information between terms. Furthermore, based on aspect-opinion feature representations, the corresponding sentiment polarity is extracted to complete the extraction of sentiment triples. This method has the advantage of learning the semantic information of internal words and the interaction information between terms, thereby improving the accuracy of aspect-level sentiment triple extraction.

[0059] For better understanding and implementation, the present invention is described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] Figure 1 This is a flowchart of a method for extracting aspect-level sentiment triples according to an embodiment of the present application;

[0061] Figure 2 A structural diagram of a component syntax tree of an example sentence in an embodiment of the present application;

[0062] Figure 3 A dependency structure diagram of an example sentence in an embodiment of the present application;

[0063] Figure 4 1 is a schematic structural diagram of an aspect-level sentiment triple extraction device provided in an exemplary embodiment;

[0064] Figure 5 A structural block diagram of a computer device provided in an exemplary embodiment. DETAILED DESCRIPTION

[0065] In order to make the objectives, technical solutions and advantages of the present application clearer, the embodiments of the present application will be described in further detail below with reference to the accompanying drawings.

[0066] It should be clear that the embodiments described are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments of the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the embodiments of the present application.

[0067] The terms used in the embodiments of the present application are for the purpose of describing specific embodiments only and are not intended to limit the embodiments of the present application. The singular forms "a," "the," and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0068] When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims. In the description of the present application, it should be understood that the terms "first", "second", "third", etc. are only used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence, nor can they be understood as indicating or implying relative importance. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to the specific circumstances.

[0069] In addition, in this application, unless otherwise specified, "plurality" refers to two or more. "And / or" describes the relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can mean: A exists alone, A and B exist simultaneously, or B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.

[0070] In view of the technical problems in the background technology, the embodiment of the present application provides a method for generating a display style of application notification information, and its specific application scenario is as follows: Figure 2 As shown, Figure 2 A smart terminal device with an application installed on it receives notifications from the application server corresponding to the application via a wireless network.

[0071] Among them, the terminal device can be a portable electronic device, such as a mobile phone, a foldable mobile phone, a tablet computer, a wearable device with wireless communication function (such as a smart watch), etc. Portable electronic devices include but are not limited to being equipped with or other operating systems. The above-mentioned portable electronic device can also be other portable electronic devices, such as a laptop computer with a touch-sensitive surface (such as a touch panel). It should also be understood that in some other embodiments of the present application, the above-mentioned electronic device may not be a portable electronic device, but a desktop computer with a touch-sensitive surface (such as a touch panel).

[0072] The wireless network may be a local area network, a wide area network transferred through a relay device, or both a local area network and a wide area network. When the communication network is a local area network, illustratively, the communication network may be a short-range communication network such as a WiFi hotspot network, a WiFi P2P network, a Bluetooth network, a ZigBee network, or a near field communication (NFC) network. When the communication network is a wide area network, illustratively, the communication network may be a third-generation wireless telephone technology (3G) network, a fourth-generation mobile communication technology (4G) network, a fifth-generation mobile communication technology (5G) network, a future-evolved public land mobile network (PLMN), or the Internet.

[0073] The application scenario of the embodiment of the present application is as follows: the parsing of the input text is completed in the server to extract the aspect-level sentiment triples of the input text. The specific implementation process is as follows.

[0074] The embodiment of the present application provides a method and model for extracting aspect-level sentiment triples based on text intervals and rich semantic knowledge. Figure 1-3 As shown, the method specifically includes the following steps:

[0075] Step S10: Get the input sentence, encode it, and obtain the context representation of the words in the sentence; use the BERT (Bidirectional Encoder Representations from Transformers) pre-trained language representation model to encode the input sentence and construct the word context representation. For example, given the input sentence S, the original text embedding matrix can be obtained. Then get the output through the BERT model as word context representation.

[0076] Step S20: constructing interval-level part-of-speech representation and semantic composition representation based on the context representation of the word; and obtaining interval feature representation based on the part-of-speech representation and semantic composition representation in combination with the context word representation.

[0077] Part-of-speech representation refers to the part of speech of a word. For example, in the sentence "The food is tasty," "The" is a determiner, "food" is a noun, "is" is a linking verb, and "tasty" is an adjective. Interval-level part-of-speech representation, on the other hand, represents the part of speech of an interval as a whole. Because an interval is of variable length and contains varying numbers of words, it is possible for an interval to contain words of multiple parts of speech. However, these parts of speech may be of varying importance, some important and some less so. For example, articles and determiners are not important, while nouns and adjectives are more decisive in determining whether an interval is an aspect term, an opinion term, or neither. By assigning weights to each part of speech, a part-of-speech representation of the entire interval is obtained.

[0078] Use the component syntax tree to get the semantic composition representation, which refers to how a sentence is constructed. Figure 2 Taking the sentence "The food is tasty and portion size are appropriate" as an example, this sentence can be divided into Clause 1 ("The food is tasty"), consisting of the conjunction "and," and Clause 2 ("portion size are appropriate"), along with punctuation. Clause 1 can be further split into the noun phrase (NP) "The food" and the verb phrase (VP) "is tasty." The noun phrase can be further split into the determiner "The" and the noun "food." Hierarchical labeling is used to obtain the component path of each word. An attention mechanism is then used to assign weights to each label, resulting in a word-level semantic composition representation. Based on this word-level semantic composition representation, a self-attention mechanism is then used to assign weights to each word within an interval, resulting in an interval-level semantic composition representation. This interval-level semantic composition representation incorporates contextual words and contains rich semantic information.

[0079] At this time, a multi-layer perceptron is used as an aggregator to concatenate the interval-level part-of-speech representation and the component-syntactic representation to obtain the interval-level part-of-speech-component-syntactic representation k a,b .

[0080]

[0081] Where σ is the activation function, Represents the splicing operation, MLP s stands for Multilayer Perceptron.

[0082] A multilayer perceptron (MLP) is an artificial neural network model with an input layer, at least one hidden layer, and an output layer, all of which are fully connected. MLP processing can address the problem of conflicts between part-of-speech representations and component syntactic representations, which can impair model performance.

[0083] Finally, the interval feature representation s containing rich semantic connections is obtained by splicing a,b .

[0084]

[0085] in is the ath and bth words in the context, where f width (a,b) represent the distance embedding matrix that can be trained.

[0086] Interval feature representation: contains the overall part of speech and semantic composition information of the interval.

[0087] Step S30: Input the interval feature representation into a multi-layer perceptron to extract aspect terms and opinion terms.

[0088] By combining the interval representation feature s with the following formula a,b To calculate the probability that an interval is predicted to be an aspect term or an opinion term.

[0089] P(m|s a,b )=σ(MLP m (s a,b ))

[0090] Φ 方面术语 (s a,b )=P(m=aspect term|s a,b )

[0091] Φ 意见术语 (s a,b )=P(m=opinion term|s a,b )

[0092] Where σ is the activation function and Φ represents the probability.

[0093] Step S40: Input the context representation of the word and the preprocessed dependency matrix into the attention graph neural network to obtain the word-level dependency syntactic relationship representation; assign weights to each word-level dependency syntactic relationship through the attention mechanism to obtain the interval-level dependency syntactic relationship representation, and concatenate the interval features of aspect terms, the interval-level dependency syntactic relationship representation corresponding to the aspect terms, the interval features of opinion terms, the interval-level dependency syntactic relationship representation corresponding to the opinion terms, and a trainable width embedding matrix to obtain the aspect-opinion representation.

[0094] Dependency sentence trees can be used to describe the dependency relationships between words. For example, in the sentence "The conference announced the first list of senior academicians," the word "announced" dominates "conference," "listed," and "listed"; "listed" dominates "academician"; and "academician" dominates "first batch" and "senior." To integrate the dependencies between words, a self-attention mechanism is used to assign weights to each word's dependency category, obtaining word-level dependency syntactic relationships. Combined with the segmented text intervals, the self-attention mechanism is then used to obtain an interval-level dependency syntactic relationship representation. This is then concatenated to obtain the aspect-opinion representation.

[0095] Step S50: Input the aspect-opinion representation into a multi-layer perceptron, extract the sentiment polarity, and combine the extracted aspect terms with the opinion terms to complete the extraction of sentiment triples.

[0096] Sentiment polarity indicates the polarity of a word. For example, in the sentence "peaches are delicious," "peaches" has a neutral polarity, while "delicious" has a positive polarity. The connection between aspect terms and opinion terms directly influences the corresponding sentiment polarity. Based on this, an MLP is used to process the context-rich aspect-opinion representation to predict sentiment polarity and extract triples. In this example, sentiment polarity is categorized into four types: positive, neutral, negative, and indifferent.

[0097] Calculate according to the following formula:

[0098]

[0099] Where σ is the activation function, the category r∈{positive, neutral, negative, invalid}, MLP r stands for Multi-Layer perceptron (MLP), Represents aspect term interval and opinion term interval; aspect-opinion is represented as

[0100] In a preferred embodiment, step S20: constructing a part-of-speech representation and a semantic composition representation at the interval level based on the context representation of the word. Specifically, the following steps are included:

[0101] Enumerate all possible intervals based on the context of the word; Each Corresponding to a word, then set the maximum length of the interval, enumerate all possible intervals. For example, I lovedog and cat, each word will correspond to a Right now We can use a hyperparameter to set the maximum width of the interval to divide the interval. Suppose we set the maximum width to 3, and then enumerate all possible intervals. Width 1: I, love, dog, and, cat; Width 2: I love, love dog, dog and, and cat; Width 3: I love dog, love dog and, dog and cat. In this way, we can obtain all possible intervals.

[0102] Perform part-of-speech tagging on the contextual representation of the word, map the part-of-speech tagging interval into a part-of-speech embedding matrix, and assign weights to each word through the self-attention mechanism to obtain the part-of-speech representation at the interval level; the part-of-speech embedding matrix Where a and b represent the ath word and the bth word. The interval-level part-of-speech representation is calculated using the following formula:

[0103]

[0104] in is the scaling factor, σ is the activation function, W p1 、W p2 、W p3 are all learnable matrices.

[0105] The component syntactic tree is constructed for the transformed sentence information, the component path of each word is counted, and the weight is assigned to the component path label of the word through the self-attention mechanism to obtain the semantic composition representation at the word level; the component path matrix

[0106] The semantic composition representation at the word level is calculated using the following formula;

[0107]

[0108] Where σ is the activation function, m is the component path length of the i-th word, and W q1 、W q2 、Wq3 are all learnable matrices.

[0109] Again, a self-attention mechanism is used to assign weights to each word in the interval to obtain the semantic composition representation at the interval level; the semantic composition representation at the interval level c a,b It is calculated by the following formula;

[0110]

[0111] in is the scaling factor, σ is the activation function, W c1 、W c2 、W c3 are all learnable matrices.

[0112] The interval-level part-of-speech representation and the interval-level semantic composition representation are concatenated, and a multi-layer perceptron is used as an aggregator to obtain the interval-level part-of-speech-component syntactic representation. Since there may be some conflicts between the part-of-speech representation and the component syntactic representation, which will damage the performance of the model, the interval-level part-of-speech representation and the interval-level component syntactic representation are concatenated, and then a multi-layer perceptron is used as an aggregator to obtain the interval-level part-of-speech-component syntactic representation k a,b .

[0113] Obtain interval feature representation s by concatenation a,b .

[0114]

[0115] in is the ath and bth words in the context, where f width (a,b) represent the width embedding matrix that can be trained.

[0116] In a preferred embodiment, intervals with a probability ranking in the top 50% are selected as candidate aspect terms and opinion terms. During the extraction of aspect terms and opinion terms, the probability of an interval being an aspect term or opinion term is calculated. By selecting only intervals with a probability ranking in the top 50% as candidate aspect terms and opinion terms, the amount of data computation can be reduced, improving computational efficiency.

[0117] In a preferred embodiment, the word-level dependency syntactic relationship representation is obtained as follows:

[0118] Each dependency category t i,j Mapped into its corresponding category embedding matrix Dependency categories are obtained based on dependency sentence trees, which can represent phrases or the relationship between phrases, and map each dependency relationship into a matrix It contains text information with dependency relationships, but there is no distinction between the importance of text dependency categories. Figure 3 As shown in the example sentence: The two words "food" are connected by a line, and the word above is "det" (determiner), which means that "The" is the determiner of "food".

[0119] Assign weights to connections between words through the attention mechanism

[0120]

[0121] where a i,j is the coefficient, and The word x i and word x j The intermediate variables are calculated by the following formula:

[0122]

[0123] in Represents a matrix concatenation operation.

[0124] in, For word x i The word-level dependency syntactic representation of For word x j The word-level dependency syntactic representation, and according to the corresponding weight Obtain word-level dependency syntactic representation Get the output representation according to the corresponding weight

[0125]

[0126] Among them, σ is the activation function, W (l) 、 b (l) is a learnable matrix.

[0127] In another preferred embodiment, a weight is assigned to each of the word-level dependency syntactic relations through an attention mechanism to obtain an interval-level dependency syntactic relation representation; this is achieved by the following steps:

[0128] A text interval is obtained, and a dependency syntactic relationship interval is selected according to the text interval; a dependency relationship interval is calculated according to the text interval, and the dependency relationship intervals are enumerated to obtain all dependency relationship intervals.

[0129] The interval-level dependency syntactic relation representation d is obtained by the following formula a,b :

[0130]

[0131] Where σ is the activation function, is the scaling factor, W d1 、W d2 、W d3 are all learnable matrices.

[0132] The word-level dependency syntactic relationship includes the different importance levels between words in a dependency relationship, while the interval-level dependency relationship includes the different importance levels between dependency relationships within an interval, such as Figure 3 As shown in the sentence "The food is tasty and portion size are appropriate", take the interval {portion size are appropriate} as an example. There are three dependency relations [compund, nsubj, cop] in this interval. The dependency syntactic relation representation at the interval level is the result of weighting these three relations according to their importance.

[0133] The embodiment of the present application discloses a method for extracting aspect-level sentiment triples, which obtains text information, encodes the text information, sets the maximum length of the interval, and then enumerates all possible intervals to obtain all text intervals. The input sentence is tagged with parts of speech to obtain the word part-of-speech information of the sentence, and the part-of-speech tagging interval corresponding to the text interval is selected to obtain the text interval containing the part-of-speech tag; a weight is assigned to each interval through a self-attention mechanism to obtain an interval-level part-of-speech representation, that is, an interval containing the importance information of the part of speech of each word in the interval. The component syntax tree is then constructed to obtain the component path of the text information in the sentence, and a weight is assigned to each label in each word component path through a self-attention mechanism to obtain the overall path information of the word; and then a weight is assigned to each word through a self-attention mechanism to obtain the overall path information of the interval. The part-of-speech representation and path information of the interval are integrated through an aggregator to obtain an interval-level part-of-speech-component syntax representation. The interval feature representation containing rich semantic connections between words is obtained through splicing. Based on the interval feature representation, the probability of a text interval being an aspect term or opinion term is calculated and ranked. The top 50% of probabilities are selected as candidate aspect terms and opinion terms, and the remaining ones are discarded to conserve computing resources. The dependencies between words in the interval are determined, as well as the dependencies between each word within the interval and the importance of these dependencies. The dependency syntactic representation of each interval is combined with the interval feature representation to obtain an aspect opinion representation. Finally, the sentiment polarity of the interval is predicted to obtain a sentiment triplet representing the text content.

[0134] This example constructs an interval-level part-of-speech analyzer and a component-syntactic analyzer to generate interval-level part-of-speech representations and semantic composition representations. Combined with word context, this approach enables learning semantic connections between words within an interval. A graph convolutional neural network and an interval-level dependency syntactic analyzer are used to construct interval-level dependency syntactic relationship information. Combined with the interval representation, this provides sufficient semantic interaction information between aspect and opinion terms, thereby improving the accuracy of extracting aspect-level sentiment triples.

[0135] Combine Figure 4 , Figure 4 An apparatus 100 for extracting aspect-level sentiment triples provided in an embodiment of the present application includes:

[0136] The sample acquisition module 101 acquires an input sentence, encodes it, and obtains context representations of words in the sentence.

[0137] The interval feature representation extraction module 102 is used to construct interval-level part-of-speech representation and semantic composition representation based on the context representation of the word; based on the part-of-speech representation and semantic composition representation, the context word representation is integrated to obtain the interval feature representation.

[0138] The aspect term and opinion term extraction module 103 is used to input the interval feature representation into the multi-layer perceptron to extract aspect terms and opinion terms.

[0139] The aspect-opinion representation extraction module 104 is used to input the context representation of the word and the preset dependency matrix into the attention graph neural network to obtain the word-level dependency syntactic relationship representation; assign weights to each word-level dependency syntactic relationship through the attention mechanism to obtain the interval-level dependency syntactic relationship representation, and concatenate the interval features of the aspect terms, the interval-level dependency syntactic relationship representation corresponding to the aspect terms, the interval features of the opinion terms, the interval-level dependency syntactic relationship representation corresponding to the opinion terms, and a trainable width embedding matrix to obtain the aspect-opinion representation.

[0140] The sentiment triplet extraction module 105 is used to input the aspect-opinion representation into the multi-layer perceptron, extract the sentiment polarity, and combine the extracted aspect terms with the opinion terms to complete the extraction of sentiment triples.

[0141] like Figure 5 As shown, Figure 5 It is a structural block diagram of a computer device according to an exemplary embodiment of the present application.

[0142] The computer device includes a processor 910 and a memory 920. The number of processors 910 in the main control chip can be one or more. Figure 5In the example, a processor 910 is used. The number of memories 920 in the main control chip can be one or more. Figure 5 A memory 920 is taken as an example.

[0143] Memory 920, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as the program for the aspect-level sentiment triple extraction method described in any embodiment of the present application, and the program instructions / modules corresponding to the application aspect-level sentiment triple extraction method described in any embodiment of the present application. Memory 920 may primarily include a program storage area and a data storage area. The program storage area may store an operating system and at least one application required for a function; the data storage area may store data generated based on device usage, etc. Furthermore, memory 920 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state memory device. In some instances, memory 920 may further include memory remotely located relative to processor 910, and such remote memory may be connected to the device via a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0144] The processor 910 executes various functional applications and data processing of the device by running the software programs, instructions and modules stored in the memory 920, that is, implements an aspect-level emotion triple extraction method recorded in any of the above embodiments.

[0145] An embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for extracting aspect-level sentiment triples described in any one of the above embodiments is implemented.

[0146] The present invention may take the form of a computer program product implemented on one or more storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing program code. Computer-readable storage media include permanent and non-permanent, removable and non-removable media, and may be implemented by any method or technology for information storage. The information may be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include but are not limited to: phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device.

[0147] It should be understood that the embodiments of the present application are not limited to the precise structures described above and shown in the drawings, and various modifications and changes can be made without departing from the scope thereof. The scope of the embodiments of the present application is limited only by the appended claims.

[0148] The above-described embodiments merely represent several implementation methods of the embodiments of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention. It should be noted that a person skilled in the art may make various modifications and improvements without departing from the concept of the embodiments of the present application, and these modifications and improvements fall within the scope of protection of the embodiments of the present application.

Claims

1. A method for extracting aspect-level sentiment triples, characterized in that: The following steps are involved: Obtain an input sentence, encode it, and obtain contextual representations of words in the sentence; Based on the context representation of the word, constructing a part-of-speech representation and a semantic composition representation at the interval level; based on the part-of-speech representation and the semantic composition representation, combining the context word representation to obtain an interval feature representation; Inputting the interval feature representation into a multi-layer perceptron to extract aspect terms and opinion terms; Inputting the context representation of the word and the preprocessed dependency matrix into the attention graph neural network to obtain the word-level dependency syntactic relationship representation; Assigning a weight to each of the word-level dependency syntactic relations through an attention mechanism to obtain an interval-level dependency syntactic relation representation; concatenating the interval features of aspect terms, the interval-level dependency syntactic relation representation corresponding to the aspect terms, the interval features of opinion terms, the interval-level dependency syntactic relation representation corresponding to the opinion terms, and a trainable width embedding matrix to obtain an aspect-opinion representation; The aspect opinion representation is input into a multi-layer perceptron to extract the sentiment polarity, and the extracted aspect terms and opinion terms are combined to complete the extraction of the sentiment triples.

2. The method for extracting aspect-level sentiment triples according to claim 1, wherein: The method of constructing the interval-level part-of-speech representation and semantic composition representation based on the context representation of the word includes: Enumerate all possible spans based on the context of the word; span a,b ={s a ,s a+1 ,…,s i ,…,s b }, where a represents the ath word, b represents the bth word, and b>=a; perform part-of-speech tagging on the contextual representation of the word, and map the part-of-speech tagging interval into a part-of-speech embedding matrix The self-attention mechanism is used to assign weights to the component path labels of each word, and the interval-level part-of-speech feature representation p is obtained by the following formula a,b ; in is the scaling factor, σ is the activation function, W p1 、W p2 、W p3 Both are learnable matrices; Build a component syntax tree based on the context representation of the word, count the component paths of each word, and map it into a component path embedding matrix The self-attention mechanism is used to assign weights to the component path labels of each word, and the semantic composition representation at the word level is obtained by the following formula in is the scaling factor, σ is the activation function, W q1 、W q2 、W q3 Both are learnable matrices; The self-attention mechanism is used to assign weights to each word in the interval, and the interval-level semantic composition representation c is obtained by the following formula a,b ; in is the scaling factor, σ is the activation function, W c1 、W c2 、W c3 are all learnable matrices.

3. The method for extracting aspect-level sentiment triples according to claim 2, wherein: The method of obtaining interval feature representation based on the part-of-speech representation and the semantic composition representation in combination with context word representation includes: According to the interval-level part-of-speech representation p a,b and the interval-level semantic structure representation c a,b , using a multi-layer perceptron as an aggregator, the interval-level part-of-speech-component syntactic representation k is obtained by the following formula a,b ; Where σ is the activation function, Represents the splicing operation, MLP s Stands for Multi-Layer perceptron (MLP); Obtain interval feature representation s by concatenation a,b ; in is the ath and bth words in the context, f width (a,b) represent the width embedding matrix that can be trained.

4. The method for extracting aspect-level sentiment triples according to claim 3, wherein: The interval feature representation is input into a multi-layer perceptron to extract aspect terms and opinion terms. The method for extracting the aspect terms and opinion terms is as follows: P(m|s a,b )=σ(MLP m (s a,b )) Where σ is the activation function, the category m∈{aspect term, opinion term, invalid}, MLP m stands for Multilayer Perceptron.

5. The method for extracting aspect-level sentiment triples according to claim 4, characterized in that: The intervals with the top 50% probability are selected as candidate aspect terms and opinion terms.

6. The method for extracting aspect-level sentiment triples according to claims 1-5, characterized in that: The context representation of the word and the preprocessed dependency matrix are input into the attention graph neural network to obtain the word-level dependency syntactic relationship representation; this is accomplished by the following steps: Map each dependency category into a corresponding category embedding matrix Assign weights to the connections between words through the attention mechanism in and The word x i and word x j The intermediate variables are calculated by the following formula: in, For word x i The word-level dependency syntactic representation of For word x j The word-level dependency syntactic representation, and according to the corresponding weight Obtain word-level dependency syntactic representation Among them, σ is the activation function, W (l) , b (l) is a learnable matrix.

7. The method for extracting aspect-level sentiment triples according to claim 6, characterized in that: The attention mechanism is used to assign a weight to each word-level dependency syntactic relationship to obtain an interval-level dependency syntactic relationship representation. This is achieved through the following steps: Get the text interval and select the dependency syntactic relationship interval based on the text interval The interval-level dependency syntactic relation representation d is obtained by the following formula a,b ; in is the scaling factor, σ is the activation function, W d1 、W d2 、W d3 are all learnable matrices.

8. A device for extracting aspect-level sentiment triples, characterized in that: include: A sample acquisition module acquires an input sentence, encodes it, and obtains contextual representations of words in the sentence; An interval feature representation extraction module is used to construct an interval-level part-of-speech representation and a semantic composition representation based on the context representation of the word; and to obtain an interval feature representation by fusing the context word representation with the part-of-speech representation and the semantic composition representation; an aspect term and opinion term extraction module, configured to input the interval feature representation into a multi-layer perceptron to extract aspect terms and opinion terms; An aspect-opinion representation extraction module is used to input the context representation of the word and the preprocessed dependency matrix into the attention graph neural network to obtain a word-level dependency syntactic relationship representation; Assigning a weight to each of the word-level dependency syntactic relations through an attention mechanism to obtain an interval-level dependency syntactic relation representation; concatenating the interval features of aspect terms, the interval-level dependency syntactic relation representation corresponding to the aspect terms, the interval features of opinion terms, the interval-level dependency syntactic relation representation corresponding to the opinion terms, and a trainable width embedding matrix to obtain an aspect-opinion representation; The sentiment triplet extraction module is used to input the aspect-opinion representation into a multi-layer perceptron, extract sentiment polarity, and combine the extracted aspect terms with the opinion terms to complete the extraction of the sentiment triplet.

9. A computer device, characterized in that: include: at least one memory and at least one processor; The memory is used to store one or more programs; When the one or more programs are executed by the at least one processor, the at least one processor implements the steps of the application aspect-level emotion triple extraction method as described in any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the aspect-level sentiment triple extraction method according to any one of claims 1 to 7 are implemented.