An implicit sentiment triple extraction method based on ring structure grid marking

By constructing and decoding an emotion triple dataset based on a ring-structured grid labeling method, and using ring grid labeling and a pre-trained language model, the problem of existing technologies being unable to extract implicit emotion triples is solved, achieving more efficient fine-grained emotion analysis.

CN116244436BActive Publication Date: 2025-11-07NANJING UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310177676.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-24
Publication Date
2025-11-07
Estimated Expiration
2043-02-24

AI Technical Summary

Technical Problem

Existing grid labeling methods cannot effectively extract implicit sentiment triples, and there are boundary judgment errors in the extraction of aspect items and evaluation items, making it impossible to learn implicit sentiment triple knowledge.

Method used

We employ a ring-structured grid labeling method. By constructing a manually labeled sentiment triple dataset, we use the ring grid labeling method, combined with a pre-trained language model and a word pair relation model with double affine transformation, to classify entities and grid labels. We then use a depth-first search algorithm or a breadth-first search algorithm to decode and extract sentiment triples.

Benefits of technology

It achieves effective extraction of implicit sentiment triples, improves the model's accuracy in extracting aspect items and evaluation items, incorporates more word pair knowledge between aspect items and opinion items, and enhances the model's training efficiency and effectiveness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116244436B_ABST
    Figure CN116244436B_ABST
Patent Text Reader

Abstract

The application provides an implicit sentiment triple extraction method based on a ring structure grid label, comprising the following steps: constructing an artificial labeled sentiment triple dataset, containing text to be extracted and sentiment triple information; dividing a training set, a verification set and a test set; using a ring-based grid label marking method, combining the sentiment triple information to mark the text with the grid label, obtaining entity labels and grid labels; training a ring structure grid marking model; verifying and evaluating the model, predicting the entity labels and the grid labels, and extracting the corresponding sentiment triples; repeating the above two steps until the model converges, retaining the optimal model in the verification set as the final model, using the final model to evaluate the F1 score on the test set; and using the final model to extract implicit sentiment triples from real text data on the network.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to a text marking emotion triplet extraction method, in particular to an implicit emotion triplet extraction method based on ring structure grid marking. BACKGROUND

[0002] With the continuous popularity of the Internet, people are used to publishing their own opinions and evaluations on the network. How to analyze useful information from a large number of comment texts is a problem that needs to be solved now. Nowadays, there are a large number of user evaluations with emotional color on service platforms such as catering and shopping. Through sentiment analysis of these comment texts, effective help can be brought to public opinion monitoring, user analysis and other applications.

[0003] The previous sentiment analysis aims to extract the main emotion existing in the chapter or short sentence, and is generally expressed as the three types of sentiment polarity of positive, negative and neutral. This analysis method ignores the different attitudes of users to different entities in the text, while the aspect sentiment triplet extraction aims to extract the sentiment triplet (aspect item, evaluation item, sentiment polarity) to obtain the evaluation item and sentiment polarity generated by the user to different aspect items, which is a fine-grained sentiment analysis. For example: the comment text "The delivery speed is very fast, and the appearance is also very good", the extracted sentiment triplet result is (delivery speed, fast, positive), (appearance, very good, positive).

[0004] The existing end-to-end emotion triplet extraction has the following three methods: the first type is the grid tagging method, which first constructs the relationship between the marked words, that is, the grid label, so that the model can fully learn the relationship between the word pairs, and then extracts the corresponding emotion triplet through the decoding algorithm. The second type is the machine reading comprehension method (Machine Reading Comprehension, MRC), which decomposes the emotion triplet extraction problem into aspect item extraction, evaluation item extraction, aspect item and evaluation item relationship detection, aspect item sentiment classification and other subtasks, and uses the MRC framework to complete the joint learning of multiple tasks. The third type is the generation model method, which converts the emotion triplet extraction into the paraphrase generation process by setting a fixed template, and generates them in the form of natural language after model learning.

[0005] The existing grid labeling work mainly experiments on display sentiment triple data, and ignores the research on implicit sentiment triple extraction. The implicit sentiment triple, namely the aspect item or the target item, may be implicitly expressed and cannot be directly extracted in the text. For example, the review text "Apple is definitely better than banana", the display sentiment triple (Apple, delicious, positive) can be extracted, but the implicit sentiment triple (banana, None, negative) is ignored.

[0006] The decoding process of the existing grid labeling method depends on decoding the aspect item and the evaluation item first, and then further judging whether the triple information can be extracted according to the word pair relationship of the aspect item and the evaluation item. This leads to the fact that the existing grid labeling work cannot learn implicit sentiment triple knowledge and cannot extract implicit sentiment triple, so that the analysis ability of the model is limited. In addition, these methods only rely on the relationship between the words of the aspect item (evaluation item) in the extraction process of the aspect item (evaluation item), and ignore the information existing in the corresponding evaluation item (aspect item), so that the boundary judgment of the model in extracting the aspect item (evaluation item) may be wrong. SUMMARY

[0007] The technical problem to be solved by the present application is to provide an implicit sentiment triple extraction method based on ring structure grid labeling to solve the problems of the prior art.

[0008] In order to solve the above technical problems, the present application discloses an implicit sentiment triple extraction method based on ring structure grid labeling, comprising the following steps:

[0009] Step 1, constructing an artificial labeled sentiment triple data set, the data set containing text to be extracted and sentiment triple information; dividing the data set into: training set, validation set and test set;

[0010] The triple includes: aspect item Aspect, evaluation item Opinion and sentiment polarity Sentiment, which are represented as follows:

[0011] (Aspect, Opinion, Sentiment)

[0012] Among them, the aspect item Aspect and the evaluation item Opinion are a phrase or implicit expression None extracted from the text, and Sentiment is the sentiment polarity.

[0013] Step 2, using a ring-based grid label labeling method, combining sentiment triple information to label the text in the data set in step 1 with grid labels to obtain entity labels and grid labels; the specific method includes:

[0014] Step 2-1, one-dimensional entity label construction, specifically includes:

[0015] The aspect and evaluation terms are used as the basis for constructing one-dimensional entity labels. When extracting all words in the text, if the current word belongs to a certain aspect, the label of the current word is 1; if the current word belongs to an evaluation term, the label is 2; otherwise, the label is 0. The set of one-dimensional entity labels is {0,1,2}.

[0016] Step 2-2, 2D grid label construction, specifically includes:

[0017] Each word in the text is considered a node, forming a two-dimensional grid. In this grid, R... i,j To represent the directed edge relationship between the i-th word and the j-th word, the directed edge is established between the sequential index lists consisting of aspect terms and evaluation terms, as follows:

[0018] When an aspect term of length n precedes an evaluation term of length m, where Aspect = {A1, A2, ..., A...} n}, A n Let Opinion be the nth word in Aspect, where Opinion = {O1, O2, ..., O...}. m}, O m For the m-th word in the Opinion, construct a sequential index list {A1, A2, ..., A...} n O1, O2, ..., O m}; From left to right, A1 and A2, A2 and A3, ..., A n Establish directed edges with O1, O1 and O2, ..., i.e., entity association directed edges; construct grid labels based on the above entity association directed edges. The entity association directed edge labels are divided into four categories: {AA, AO, OO, OA}, where AA represents a word in an aspect item pointing to a word in another aspect item, AO represents a word in an aspect item pointing to a word in an evaluation item, and OA labels are similarly constructed.

[0019] Create a directed edge between the last word and the first word in the sequential index list, which is called the sentiment association directed edge. Construct grid labels based on the above sentiment association directed edge. The sentiment association directed edge labels are divided into three categories: {Pos, Neg, Neu}, which represent the sentiment polarity implied by the triple. Neg is negative, Neu is neutral, and Pos is positive. If there is only one unique item in the sequential index list, only the sentiment polarity directed edge is created.

[0020] When the aspect term is located after the evaluation term Opinion, or when there is an implicit expression in the triple, the triple can also be represented as a unique directed cycle.

[0021] The label of the undirected edge in the grid label is None;

[0022] The set of grid labels is {A-A, A-O, O-O, O-A, Pos, Neg, Neu, None}.

[0023] Step 3, combine the entity labels obtained in the training set with the grid label to train the ring structure grid marking model, specifically including:

[0024] Step 3-1, pre-process the text in the input emotional triple data set to obtain a pre-processed text S with a length of l, denoted as:

[0025] S={W1,W2,...,W l}

[0026] Wherein, W l represents the lth word in the text;

[0027] Step 3-2, input the pre-processed text S into the pre-trained language model to extract semantic representation H={h1,h2,...,h l}, wherein h l represents the semantic representation of the lth word;

[0028] The pre-trained language model is Bert.

[0029] Step 3-3, the semantic representation H obtained is classified according to the method of constructing one-dimensional entity labels in step 2-1, and the cross-entropy loss L1 is calculated;

[0030] Step 3-4, input the obtained semantic representation H into the word pair relation model composed of double affine transformation, the specific method is as follows:

[0031] R i,j =MLP1(h i ) T ·W·MLP2(h j )

[0032] Wherein, R i,j represents the word pair representation of the ith word pointing to the jth word, MLP1 and MLP2 are multilayer perceptron, W is a three-dimensional learning parameter, h i represents the semantic representation of the ith word, and h j represents the semantic representation of the jth word;

[0033] Step 3-5, the obtained word pair representation R i,j is classified according to the method of constructing two-dimensional grid labels in step 2-2, and the cross-entropy loss L2 is calculated;

[0034] Step 3-6, calculate the loss and Loss = L1 + L2 according to the results of step 3-3 and step 3-5, calculate the gradient, and update the model parameters by back propagation.

[0035] Step 4, verify and evaluate the ring structure grid labeling model, input the data in the validation set into the ring structure grid labeling model, predict the entity label and grid label, and extract the corresponding sentiment triplets;

[0036] The verification and evaluation model is to extract the corresponding sentiment triplets according to the obtained label prediction results, and calculate the F1 score of the extracted triplet results and the real triplets as the evaluation index, and the prediction is considered correct when each item in the triplet is accurately matched.

[0037] The extraction of the corresponding sentiment triplets according to the obtained label prediction results is a ring-based grid label decoding method, which specifically includes:

[0038] Step 4-1, if there is R i,i The prediction result belongs to {A-A, A-O, O-O, O-A}, indicating that there is a directed edge from the i-th word to the j-th word, and a directed edge set E is obtained; there is R j,i The prediction result belongs to {Pos, Neg, Neu}, indicating that there is a sentiment triplet starting from the i-th word and ending at the j-th word, and a depth-first algorithm or a breadth-first algorithm is used to search for all paths from the i-th word to the j-th word in the graph G composed of the directed edge set E, and each searched path is combined with its corresponding sentiment polarity information to form a ring for the next step of verification; there is R i,i The prediction result belongs to {Pos, Neg, Neu}, indicating that it is an implicit sentiment triplet containing only one word, and the predicted entity label result is judged to be an aspect item or an evaluation item or an illegal item;

[0039] Step 4-2, ring verification: verify all the searched rings to determine whether the ring is a legal sentiment triplet, filter, and finally return all the legal sentiment triplets.

[0040] The determination of whether the ring is a legal sentiment triplet is to determine whether the ring is a sentiment triplet according to the number of aspect items and the number of evaluation items in the ring.

[0041] Step 5, repeat steps 3 and 4 until the model converges, use the validation set to verify the model, keep the optimal model in the validation set as the final model, and use the final model to evaluate the F1 score on the test set;

[0042] Step 6, using the final model, implicit sentiment triplets extraction on real text data on the network.

[0043] Advantages:

[0044] Technical level: 1) Compared with the traditional grid labeling method, the present application provides a new grid label labeling method and decoding method, which enables the model to learn implicit sentiment knowledge and predict implicit sentiment triplets. 2) The present application uses a ring structure extraction method to extract aspect items and opinion items uniformly. More word pair knowledge between aspect items and opinion items is integrated into the extraction process. 3) The present application focuses on the label labeling and label decoding part of the grid labeling, which can be migrated to other grid labeling methods to bring more improvement effect. 4) The model parameters used in the present application are small, the training efficiency is high, and the effect is better.

[0045] Application level: 1) The present application can enable the grid labeling model to learn more implicit sentiment knowledge in the text, thereby mining more information from massive comment texts 2) The present application is not limited by language and can be applied to fine-grained sentiment analysis tasks in different languages. BRIEF DESCRIPTION OF DRAWINGS

[0046] The above and / or other aspects of the present application will become apparent from the following detailed description of the application taken in conjunction with the accompanying drawings.

[0047] Figure 1 The flowchart of the present application is shown.

[0048] Figure 2 The grid label labeling example diagram is shown.

[0049] Figure 3 The grid labeling model training flowchart based on the ring structure is shown. DETAILED DESCRIPTION

[0050] The present application provides a grid labeling method based on a ring structure. The overall flow is shown in Figure 1

[0051] Step 101, constructing an artificial labeled sentiment triplet dataset, the dataset containing texts to be commented and displaying implicit sentiment triplets, when constructing the dataset, the dataset is divided into a training set, a validation set and a test set;

[0052] Step 102, using a ring-based grid label labeling method to label the sentiment triplet data, obtaining entity labels and grid labels for training. The specific example is shown in Figure 2

[0053] ​​Step 201, one-dimensional entity label construction. Aspect terms and opinion terms are regarded as required entities. For each word in the extracted text, if the current word belongs to an aspect term, the label of the current word is 1, if the current word belongs to an opinion term, the label of the current word is 2, otherwise the label of the current word is 0; the one-dimensional entity label set is {0, 1, 2}.

[0054] Step 202, two-dimensional grid label construction. Each word is regarded as a node, and the grid is divided into R i,j represents the directed edge relationship between the i-th word and the j-th word. For each triple (Aspect, Opinion, Sentiment), wherein Aspect and Opinion are a phrase in the text or None (for implicit expression), and Sentiment is one of the sentiment polarities. Let the aspect term Aspect = {A1, A2,..., An} be composed of n words, Anbe the n-th word in Aspect, the opinion term Opinion = {O1, O2,..., Om} be composed of m words, Ombe the m-th word in Opinion. We establish the following directed edges between the order index list composed of aspect terms and opinion terms: when Aspect is located before Opinion, we can construct the order index list {A1, A2,..., An, O1, O2,..., Om}. From left to right, we establish entity association directed edges between A1and A2, A2and A3,..., Anand O1, O1and O2,.... This kind of directed edge label is divided into four categories: {A-A, A-O, O-O, O-A}. A-A represents a word in an aspect term pointing to a word in an aspect term, A-O represents a word in an aspect term pointing to a word in an opinion term, O-A represents a word in an opinion term pointing to a word in an aspect term, and O-O represents a word in an opinion term pointing to a word in an opinion term. When Aspect is located after Opinion, we establish entity association directed edges for the order index list {O1, O2,..., Om, A1, A2,..., An} in turn, when Aspect is None, we establish entity association directed edges for the order index list {O1, O2,..., Om} in turn, and when Opinion is None, we establish entity association directed edges for the order index list {A1, A2,..., An} in turn. n n m m n m n m n m n ​​​​​​​​​​}Sequentially establish entity association directed edges. The last word in the sequential index list and the first word are established as sentiment association directed edges, and the label of such directed edges is divided into three categories: {Pos, Neg, Neu}, representing the sentiment polarity contained in the triple. Neg is negative, Neu is neutral, and Pos is positive (if there is only one item in the sequential index list, only sentiment association directed edges need to be established). The label of the grid is None for the directed edge, and the grid label set is {A-A, A-O, O-O, O-A, Pos, Neg, Neu, None}.

[0055] Step 103, combine entity labels and grid labels in the grid label model training based on ring structure, the specific process is as shown in Figure 3

[0056] Step 301, pre-process the input text to obtain a text S = {W1, W2,..., W l} of length l.

[0057] Step 302, input the pre-processed text S into the pre-trained language model such as Bert to obtain high-dimensional semantic representation H = {h1, h2,..., h l} with context information. (Reference: Devlin J, Chang M W, Lee K, et al. Bert: Pre-training of deep bidirectional transformers for language understanding [J]. arXiv preprint arXiv: 1810.04805, 2018.)

[0058] Step 303, classify the obtained semantic representation H with entity labels, and calculate the cross-entropy loss, denoted as L1, the specific calculation formula is as follows:

[0059]

[0060]

[0061] Where MLP is a multi-layer perceptron, h i is the semantic representation of the i-th word, and σ is the softmax function, which is specifically: for an R-dimensional real vector z, represents the probability distribution of the entity label of the i-th word, represents the probability that the i-th word belongs to the k-th entity label, and y i represents the entity label of the i-th word. C e ={0, 1, 2} is the entity label set, as described in step 201.​

[0062] Step 304, input the obtained semantic representation H into the word pair relationship model composed of biaffine transformation (reference: Dozat T, Manning CD. Deep biaffine attention for neural dependency parsing[J]. arXiv preprint arXiv: 1611.01734, 2016.) to obtain the word pair representation R, and the specific calculation method is as follows.

[0063] R i,j =MLP1(h i ) T ·W·MLP2(h j )

[0064] Where MLP is a multilayer perceptron, W is a three-dimensional learnable parameter, and R i,j is the word pair relationship representation of the i-th word to the j-th word.

[0065] Step 305, grid label classification is performed on the obtained word pair representation R, and the cross-entropy loss is calculated, denoted as L2.

[0066]

[0067]

[0068] Where MLP is a multilayer perceptron, and σ is a softmax function, and its specific form is: for an R-dimensional real number vector z, represents the label probability distribution of the grid (i, j) position, represents the probability that the label of the grid (i, j) position belongs to the kth grid label, and y i,j represents the grid label of the grid (i, j) position. C r ={A-A, A-O, O-O, O-A, Pos, Neg, Neu, None} is the set of grid labels, as described in step 202.

[0069] Step 306, calculate the loss and Loss = L1 + L2 according to the results of step 303 and step 305, calculate the gradient, and update the model parameters by backpropagation (reference: Rumelhart DE, Hinton GE, Williams RJ. Learning representations by back-propagating errors[J]. Nature, 1986, 323(6088): 533-536.).

[0070] Step 104, verify the evaluation model on the validation set. Decode the extracted sentiment triple according to the label predicted by the model, and calculate the F1-score as the evaluation index by comparing the extracted triple result with the true triple (generally considered that each item in the triple is accurately matched as correct prediction). The following is the ring-based grid label decoding algorithm:

[0071] Step 401, if there is R in the upper right triangle of the grid (not including the diagonal line) i,j If the prediction result belongs to {A-A, A-O, O-O, O-A}, it indicates that there is an entity association directed edge from the ith word to the jth word, and the entity association directed edge set E can be obtained. There is R in the lower left triangle of the grid (not including the diagonal line) j,i If the prediction result belongs to {Pos, Neg, Neu}, it indicates that there is a sentiment triple starting from the ith word and ending at the jth word. In the graph G composed of the set E, use the depth-first search algorithm (Depth-First Search) or breadth-first search algorithm (Breadth-First Search) to find all paths starting from i and ending at j (reference: Tarjan R. Depth-first search and linear graph algorithms [J]. SIAM journal on computing, 1972, 1(2): 146-160.), and form a ring by combining each searched path with its corresponding sentiment polarity information, which is used for the next step of verification. Grid diagonal line R i,i If the prediction result belongs to {Pos, Neg, Neu}, it indicates that it is an implicit sentiment triple with only one word. According to the predicted entity label result, it is judged to be an aspect item or an evaluation item or an illegal item.

[0072] Step 402, ring verification step, for all the rings searched, verify whether they are sentiment triples according to the number of aspect items and evaluation items in the ring, filter, and finally return the obtained sentiment triples.

[0073] Step 105, repeat steps 103 and 104 multiple times until the model converges, and keep the optimal model in the validation set as the final model, and perform the final evaluation on the test set.

[0074] The evaluation index uses the F1-score method, and the specific calculation result is as follows:

[0075]

[0076]

[0077] Where TP represents the number of correctly predicted triples, FP represents the number of incorrectly predicted triples, and FN represents the number of unpredicted triples among the labeled triples in the dataset.

[0078] If the labeled triples are {A, B} and the predicted triples are {A, C}, then A is a correct prediction, B is an incorrect prediction, and C is an unpredicted triple. Thus, TP is 1, FP is 1, FN is 1, Precision is 0.5, Recall is 0.5, and F1-score is 0.5.

[0079] Example:

[0080] The following is combined Figure 2 Specific embodiments of 3 are described below. For the input text "Shipping speed is fast, but it's not easy to use after arrival.", the triplet is (shipping speed, fast, positive), (None, not easy to use, negative). First, a grid labeling algorithm is used to obtain the corresponding entity labels and grid labels. In the entity labels, "shipping speed" is an aspect item, marked as 1; "fast" and "not easy to use" are evaluation items, marked as 2; and the rest are marked as 0. In the grid labels, {shipping, goods, speed, degree, fast} and {not easy, good, use} are structured as follows: Figure 2 The directed loop shown is then represented in a two-dimensional mesh as follows: Figure 2 The grid labels shown are for the 2D grid (note: labels omitted in blank areas are "None" labels). Figure 2 Tags obtained from the middle are used for Figure 3 Training is conducted within this framework. It is assumed that the model's predicted labels are consistent with... Figure 2 Consistent. The decoding process is as follows: Extract all existing edge sets {shipping->goods, goods->speed, speed->degree, degree->fast, not->good, good->useful} from the upper right triangle of the grid (excluding diagonals). Then, extract all triplet sentiment information from the lower left triangle (excluding diagonals): {fast->shipping: Pos, use->not: Neg}. Search all paths of (shipping, fast), (not, use) and combine them with sentiment information to form cycles: (shipping, goods, speed, degree, fast, Pos), (not, good, use, Neg). Diagonals do not contain implicit sentiment triples. Verify all cycles to determine if they are sentiment triples, and finally obtain the sentiment triples (shipping speed, fast, Pos), (None, not good, Neg).

[0081] In a specific implementation, the present application provides a computer storage medium and a corresponding data processing unit, wherein the computer storage medium can store a computer program, and the computer program can run the invention content of the ring structure grid label based implicit sentiment triple extraction method and part or all steps in each embodiment when executed by the data processing unit. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), or the like.

[0082] Those skilled in the art can clearly understand that the technical solutions in the embodiments of the present application can be realized by means of a computer program and its corresponding general hardware platform. Based on such understanding, the technical solutions in the embodiments of the present application can be embodied in the form of a computer program, i.e., a software product, which can be stored in a storage medium and includes a plurality of instructions for causing a device (which can be a personal computer, a server, a single-chip microcomputer, a MUU, or a network device, etc.) containing a data processing unit to execute the method described in each embodiment or some parts of the embodiments of the present application.

[0083] The present application provides a ring structure grid label based implicit sentiment triple extraction method, and there are many methods and ways to realize the technical solutions. The above description is only the preferred embodiment of the present application, and it should be pointed out that for ordinary skilled in the art, without departing from the principles of the present application, some improvements and refinements can be made, and these improvements and refinements should be regarded as the protection scope of the present application. The components not explicitly described in the embodiments can be realized by using existing technology.

Claims

1. An implicit sentiment triple extraction method based on ring structure grid marking, characterized in that, The method comprises the following steps: Step 1, constructing an artificial annotated sentiment triple dataset, which contains text to be extracted and sentiment triple information; The dataset is divided into: training set, validation set and test set; Step 2, using a ring-based grid label annotation method, combining sentiment triple information to annotate the text in the dataset in step 1 with grid labels, obtaining entity labels and grid labels; Step 3, training the ring structure grid marking model combined with the entity labels and grid labels obtained in the training set; Step 4, verify and evaluate the ring structure grid marking model, input the data in the validation set into the ring structure grid marking model, predict the entity labels and grid labels, and extract the corresponding sentiment triples; Step 5, repeat steps 3 and 4 until the model converges, use the validation set to verify the model, keep the optimal model in the validation set as the final model, and use the final model to evaluate the F1 score on the test set; Step 6, using the final model, extracting implicit sentiment triples from real text data on the network; The grid label annotation in step 2 specifically includes: Step 2-1, one-dimensional entity label construction; Step 2-2, two-dimensional grid label construction; The one-dimensional entity label construction in step 2-1 specifically includes: The aspect item and the evaluation item are used as the basis for one-dimensional entity label construction. When extracting all the words in the text, if the current word belongs to a certain aspect item, the label of the current word is 1; if the current word belongs to the evaluation item, the label is 2; otherwise, the label is 0. The one-dimensional entity label set is {0, 1, 2}; The two-dimensional grid label construction in step 2-2 specifically includes: Each word in the text is considered as a node to form a two-dimensional grid, where R i,j represents the directed edge relationship between the ith word and the jth word. The directed edges are established between the sequential index lists composed of aspect terms and evaluation terms as follows: When the aspect term Aspect of length n is located in front of the opinion term Opinion of length m, where Aspect = {A1, A2, …, A n}, A n is the n th word in Aspect, Opinion = {O1, O2, …, O m}, O m is the m th word in Opinion, a sequential index list {A1, A2, …, A n , O1, O2, …, O m} is constructed; directed edges are sequentially established from left to right between A1 and A2, A2 and A3, …, A n and O1, O1 and O2, …, that is, entity association directed edges; a grid label is constructed according to the above entity association directed edges, and the entity association directed edge label is divided into four categories: {A-A, A-O, O-O, O-A}, wherein A-A indicates that a word in an aspect term points to a word in an aspect term, A-O indicates that a word in an aspect term points to a word in an opinion term, and O-A labels and O-A labels are the same. A directed edge is established between the last word and the first word in the order index list, that is, a sentiment-related directed edge. The grid label is constructed according to the above sentiment-related directed edge. The sentiment-related directed edge label is divided into three categories: {Pos, Neg, Neu}, representing the sentiment polarity implied by the triple. Neg is negative, Neu is neutral, and Pos is positive. If there is only one item in the order index list, only the sentiment polarity directed edge is established; When the aspect item Aspect is located after the evaluation item Opinion, or there is implicit expression in the triple, the triple can also be represented as a unique directed ring; The label without a directed edge in the grid label is None; The grid label set obtained is {A-A, A-O, O-O, O-A, Pos, Neg, Neu, None}; The method for predicting the corresponding sentiment triple according to the obtained label in step 4 is a ring-based grid label decoding method, which specifically includes: Step 4-1, if there is R in the right upper triangle of the two-dimensional grid without diagonal line i,j If the prediction result belongs to {A-A, A-O, O-O, O-A}, it indicates that there is a directed edge from the ith word to the jth word, and a directed edge set E is obtained; if there is R in the left lower triangle of the two-dimensional grid without diagonal line j,i If the prediction result belongs to {Pos, Neg, Neu}, it indicates that there is a sentiment triple starting from the ith word and ending at the jth word, and a graph G composed of the directed edge set E is used to search for all paths from the ith word to the jth word by using a depth-first algorithm or a breadth-first algorithm. Each searched path is combined with its corresponding sentiment polarity information to form a loop for the next step of verification; if there is R in the diagonal line of the two-dimensional grid i,i If the prediction result belongs to {Pos, Neg, Neu}, it indicates that it is an implicit sentiment triple containing only one word, and it is judged to be an aspect item or an evaluation item or an illegal item according to the predicted entity label result; Step 4-2, ring verification: verify all the rings searched to determine whether the ring is a legal sentiment triple, filter, and finally return all legal sentiment triples.

2. The implicit sentiment triple extraction method based on ring structure grid marking according to claim 1, wherein, The triple in step 1 includes: aspect item Aspect, evaluation item Opinion and sentiment polarity Sentiment, which is represented as follows: (Aspect, Opinion, Sentiment) Wherein, the aspect item Aspect and the evaluation item Opinion are a phrase or implicit expression None extracted in the text, and the sentiment polarity is Sentiment.

3. The implicit sentiment triple extraction method based on ring structure grid labeling according to claim 2, characterized in that, The entity label and the grid label pair ring structure grid labeling model in step 3 are trained, and the specific steps include: Step 3-1, preprocessing the text in the input sentiment triple data set to obtain a preprocessed text S with a length of l, denoted as: S = {W1, W2,..., W l} wherein W l represents the lth word in the text; Step 3-2, input the preprocessed text S into a pre-trained language model to extract semantic representations H = {h1, h2, …, hT} with context information, where h l represents the semantic representation of the lth word. l ​ Step 3-3, the semantic representation H obtained is classified according to the method of constructing one-dimensional entity labels in step 2-1, and the cross-entropy loss L1 is calculated; Step 3-4, the semantic representation H obtained is input into the word pair relationship model composed of double affine transformation, and the specific method is as follows: R i,j = MLP1(h i ) T · W · MLP2(h j ) wherein R i,j represents the word pair representation that the ith word points to the jth word, MLP1 and MLP2 are multi-layer perceptrons, W is a three-dimensional learning parameter, h i represents the semantic representation of the ith word, h j represents the semantic representation of the jth word; Step 3-5, representing R by the obtained word pair i,j According to the method of constructing a two-dimensional grid label described in step 2-2, the grid label classification is performed, and the cross-entropy loss L2 is calculated; Step 3-6, according to the results of step 3-3 and step 3-5, the loss and Loss = L1+L2 are calculated, the gradient is calculated, and the model parameters are updated by back propagation.

4. The implicit sentiment triple extraction method based on ring structure grid labeling according to claim 3, wherein, The ring structure grid labeling model is verified and evaluated in step 4, that is, the corresponding sentiment triple is extracted according to the obtained label prediction result, the extracted triple result is compared with the real triple, and the F1 score is calculated as an evaluation index. When each item in the triple is accurately matched, it is considered that the prediction is correct.

5. The implicit sentiment triple extraction method based on ring structure grid labeling according to claim 4, wherein, The pre-training language model in step 3-2 is Bert.

6. The implicit sentiment triple extraction method based on ring structure grid labeling according to claim 5, wherein, In step 4-2, it is judged whether the ring is a legal sentiment triple, that is, whether the ring is a sentiment triple according to the number of aspect items and the number of evaluation items.

Citation Information

Patent Citations

  • Text implicit sentiment analysis method combined with external knowledge

    CN113435211A

  • Personalized implicit sentiment analysis method and system based on user knowledge

    CN114281999A