Aspect-level sentiment quadruple extraction method and system
By employing a framework for collaborative optimization of large and small models, combined with error detection and correction mechanisms, the problem of insufficient prediction accuracy and generalization ability in scenarios with few or zero samples in existing technologies has been solved, thereby improving the accuracy and stability of sentiment quadruple prediction in emerging fields.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-31
- Publication Date
- 2026-04-07
AI Technical Summary
Existing aspect-level sentiment quadruple prediction methods suffer from insufficient prediction accuracy and generalization ability in scenarios with few or no samples. In particular, they struggle to correctly identify emerging aspect categories when facing emerging fields, and the accumulation of errors leads to distorted prediction results.
A framework for collaborative optimization of large and small models is adopted. Through error detection and correction mechanisms, the small model is used to identify errors in the prediction results of the large model and generate targeted error feedback information. Combined with few-shot learning, the large model is adaptively corrected.
It improves the accuracy and robustness of sentiment quadruple prediction in scenarios with few or no samples, and enhances the generalization ability of large models in unknown domains.
Smart Images

Figure CN120317256B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of natural language processing, and particularly relates to an aspect-level sentiment quadruple extraction method and system. BACKGROUND
[0002] The few-shot aspect sentiment quad prediction (FS-ASQP) or extraction technology aims to simultaneously identify and extract four core elements of aspect category (Aspect Category), aspect term (Aspect Term), opinion term (Opinion Term) and sentiment polarity (Sentiment Polarity) under the condition of limited data, so as to comprehensively analyze the specific sentiment tendency of users for different aspects. Compared with the traditional aspect sentiment quad prediction (ASQP) or extraction method which relies on large-scale labeled data and assumes that the aspect category is fixed, the FS-ASQP requires a large model to learn emerging aspects only through a small number of examples, so that it can adapt to a dynamic environment and improve the generalization ability in new or cross domains. For example, in the catering field, the FS-ASQP can not only identify common aspects such as "steak" and "cocktail", but also flexibly extend to emerging topics such as "WiFi connectivity" or "mobile payment experience", so as to more accurately capture the latest needs of users.
[0003] The ASQP task has important application value in the field of natural language processing. Existing researches mainly focus on optimizing the performance of generative models to improve the prediction accuracy and generalization ability. However, the current methods still have great limitations in the few-shot or zero-shot scenarios. One type of method, such as the GAS framework, can alleviate the problem of insufficient training data to a certain extent, but still needs to rely on limited domain data for fine-tuning, resulting in a large error in cross-domain generalization. In addition, this method does not consider the quality control of the generated results, and in actual application, it is easy to accumulate errors due to data noise, which reduces the reliability of the prediction. Another type of method, such as the BvSP (Broad-view Soft Prompting) framework, introduces soft prompting to enhance the adaptability of pre-trained language models in few-shot scenarios. This method uses multiple prompt templates to capture more extensive input features and reduce the bias caused by individual templates. However, since BvSP still relies on static template design, it is difficult to expand when dealing with new aspect categories or emerging domains, especially when new domain user evaluations appear, the system often cannot correctly identify emerging aspect categories. In addition, this method only focuses on optimizing the adaptability of few-shot, and the prediction results still have high uncertainty, which cannot effectively correct errors. SUMMARY
[0004] In view of this, the embodiments of the present application provide an aspect-level sentiment quadruple extraction method and system to eliminate or improve one or more defects in the prior art.
[0005] One aspect of the present application provides an aspect-level sentiment quadruple extraction method, which comprises the following steps:
[0006] Extracting the aspect and opinion pair of the text to be extracted based on a first reference example using a large model, and outputting at least one aspect and opinion pair prediction result from the large model, the first reference example including each aspect and opinion pair of each aspect category and the corresponding text, the aspect and opinion pair including aspect terms and corresponding opinion terms;
[0007] Inputting the text to be extracted and each aspect and opinion pair prediction result into a pre-trained small model to make the small model output each error category prediction result corresponding to each aspect and opinion pair prediction result based on the text to be extracted;
[0008] Generating corresponding error feedback information based on the error aspect and opinion pair prediction result;
[0009] The large model is used to correct the prediction results of each erroneous aspect and viewpoint based on the text to be extracted and various error feedback information. Based on the text to be extracted, the second reference example, and the corrected aspects and viewpoints, the model outputs the prediction results of each aspect category and sentiment polarity corresponding to the prediction results of each corrected aspect and viewpoint, so as to obtain each sentiment quadruple. The second reference example includes each sentiment quadruple of each aspect category and the corresponding text.
[0010] In some embodiments of the present invention, the step of inputting the text to be extracted and the prediction results of aspects and viewpoint pairs into a pre-trained small model, so that the small model outputs prediction results of various error categories corresponding to the prediction results of aspects and viewpoint pairs based on the text to be extracted, includes:
[0011] The text to be extracted and the prediction results of each aspect and viewpoint pair are input into a pre-trained small model, so that the small model marks the positions of the prediction results of each aspect term and each viewpoint term in the text to be extracted based on the prediction results of each aspect and viewpoint pair;
[0012] Extract the features of each word in the labeled text to be extracted, and obtain the global features based on the features of each word, as well as obtain the possible paired features based on the term prediction results of each aspect and the term prediction results of each viewpoint in the features of each word.
[0013] Each attention weight is calculated based on the correlation between the aspect term prediction results and the viewpoint term prediction results in each possible pairing feature to obtain each final pairing feature;
[0014] Based on each final paired feature and global feature, the output shows the prediction results for each error category corresponding to each aspect and viewpoint in the prediction results.
[0015] In some embodiments of the present invention, the error feedback information includes error analysis and target reference cases. The target reference case is the most similar reference case to the prediction result of the aspect and viewpoint pair with the same error category as the prediction result of the aspect and viewpoint pair, retrieved from the reference case set based on the final paired features and global features corresponding to the prediction result of the erroneous aspect and viewpoint pair. The reference case set includes multiple reference cases, and each reference case includes text and corresponding prediction results of each aspect and viewpoint pair with a corresponding error category label and each correct aspect and viewpoint pair.
[0016] In some embodiments of the present invention, the error analysis includes error cause analysis and a description of correction suggestions.
[0017] In some embodiments of the present invention, the small model is obtained through pre-training via the following steps:
[0018] The small model is pre-trained based on the reference case set until it converges to obtain the pre-trained small model.
[0019] In some embodiments of the present invention, the error categories include no error, null value error, and normal error.
[0020] In some embodiments of the present invention, the first reference example and the second reference example are obtained by employing a few-shot learning algorithm based on a preset dataset, the dataset including multiple texts and various sentiment quadruples of various aspects of each text.
[0021] In some embodiments of the present invention, the method further includes:
[0022] A large model is used to output the prediction results of each aspect category and sentiment polarity corresponding to the prediction results of each correct aspect and opinion based on the text to be extracted, the second reference example, and each correct aspect and opinion, so as to obtain each sentiment quadruple.
[0023] Another aspect of the present invention provides an aspect-level emotion quadruple extraction system, the system comprising: a computer device, the computer device including a processor and a memory, the memory storing computer instructions, the processor being configured to execute the computer instructions stored in the memory, and the system implementing the steps of the aforementioned method when the computer instructions are executed by the processor.
[0024] Another aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the aforementioned method.
[0025] Another aspect of the present invention provides a computer program product including computer instructions that, when executed by a processor, implement the steps of the aforementioned method.
[0026] This invention presents a method and system for extracting aspect-level sentiment quadruples, proposing a collaborative framework between a large model and a small model for few-shot sentiment quadruple prediction. This framework can improve the accuracy and generalization ability of sentiment analysis tasks. First, the large model extracts and outputs the prediction results of aspect and opinion pairs from the text. A pre-trained small model performs error detection on the prediction results of aspect and opinion pairs and generates targeted error feedback information based on the erroneous aspect and opinion pair predictions to enhance the large model's correction ability. Then, the large model adaptively corrects the erroneous aspect and opinion pair predictions and predicts aspect categories and sentiment polarities, reducing the impact of limitations in domain knowledge and data on the prediction results. This improves the performance and accuracy of sentiment quadruple prediction in few-shot or even zero-shot learning scenarios, effectively addressing the problems of large models lacking domain knowledge and data and the bias caused by directly predicting sentiment quadruples in few-shot and zero-shot scenarios.
[0027] Additional advantages, objects, and features of the invention will be set forth in part in the description which follows, and will also become apparent in part to those skilled in the art upon studying the description, or may be learned by practice of the invention. The objects and other advantages of the invention can be realized and obtained by means of the structures specifically pointed out in the description and drawings.
[0028] Those skilled in the art will understand that the objectives and advantages achievable with the present invention are not limited to those specifically described above, and that the above and other objectives achievable with the present invention will become clearer from the following detailed description. Attached Figure Description
[0029] The accompanying drawings, which are provided to further illustrate the invention and form part of this application, are not intended to limit the scope of the invention.
[0030] Fig. 1 This is a flowchart illustrating the aspect-level emotion quadruple extraction method in one embodiment of the present invention;
[0031] Fig. 2 This is a schematic diagram of the specific process and overall model framework of the aspect-level emotion quadruple extraction method in one embodiment of the present invention. Detailed Implementation
[0032] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the embodiments and accompanying drawings. Here, the illustrative embodiments and descriptions of this invention are used to explain the invention, but are not intended to limit the invention.
[0033] It should also be noted that, in order to avoid obscuring the invention with unnecessary details, only the structures and / or processing steps closely related to the solution according to the invention are shown in the accompanying drawings, while other details that are not closely related to the invention are omitted.
[0034] It should be emphasized that the term "including / comprises" as used herein refers to the presence of a feature, element, step, or component, but does not exclude the presence or addition of one or more other features, elements, steps, or components.
[0035] It should also be noted that, unless otherwise specified, the term "connection" in this article can refer not only to a direct connection, but also to an indirect connection involving an intermediary.
[0036] In the following description, embodiments of the invention will be illustrated with reference to the accompanying drawings. In the drawings, the same reference numerals represent the same or similar parts, or the same or similar steps.
[0037] To address the low prediction accuracy and generalization ability of existing aspect-level sentiment quadruples prediction tasks in few-shot scenarios, especially when facing emerging domains or large models without known categories, traditional methods that rely on generative approaches to directly predict complete sentiment quadruples often suffer from problems such as difficulty in correcting prediction errors and error accumulation leading to distorted prediction results. This invention proposes an aspect-level sentiment quadruples extraction method and system. By proposing a few-shot ASQP model framework that is co-optimized by large and small models and adding an error detection and correction mechanism, the dependence of large models on domain data and example samples can be reduced in a few-shot learning environment, thereby improving the accuracy, robustness, and stability of aspect-level sentiment quadruples prediction.
[0038] In the task of extracting aspect-level sentiment quadruples in a few samples, given a text T, the model needs to accurately predict all sentiment quadruples {(ao,c,p)} in the text, where a represents aspect terms, o represents opinion terms, c represents aspect categories, and p represents sentiment polarity, given only a small number of examples or labeled samples in the target domain. This invention addresses two core technical problems: first, how to effectively identify and classify errors in the prediction results; and second, how to adaptively correct erroneous predictions using existing information. To solve the first problem, this invention proposes a neural network-based error detection method. By comparing the differences between the aspect-opinion pairs predicted by the large model and their true labels, it automatically identifies the error categories in the large model's predictions and generates targeted error feedback information. To solve the second problem, this invention adds a targeted error feedback enhancement mechanism combined with few-sample learning, enabling the large model to adaptively adjust erroneous predictions based on targeted error feedback information, such as error analysis and referencing correction methods for similar errors. This improves the accuracy of aspect-level sentiment quadruples prediction and enhances the large model's generalization ability in unknown domains.
[0039] Fig. 1 and Fig. 2 These are, respectively, a flowchart illustrating the aspect-level sentiment quadruple extraction method in one embodiment of the present invention and a schematic diagram illustrating the specific process and its overall model framework. For example... Fig. 1 and Fig. 2 As shown, the method includes the following steps:
[0040] Step S110: The large model is used to extract aspect and opinion pairs of the text to be extracted based on the first reference example, and the large model outputs at least one aspect and opinion pair prediction result. The first reference example includes aspect and opinion pairs of each aspect category and the corresponding text. The aspect and opinion pair includes aspect terms and corresponding opinion terms.
[0041] Specifically, this step can use the GPT4.0 model to perform the aspect-opinion pair extraction task, or it can be implemented using other pre-trained large language models such as Claude. Specifically, a cue word is constructed and input into the large model to guide it in completing the task. This cue word includes a clear instruction that the task objective is to identify, predict, or extract all aspect-opinion pairs and similar descriptions from the given text to be extracted based on a first reference example, as well as specific content information about the first reference example and the text to be extracted, so that the large model directly outputs all aspect terms and their corresponding opinion terms appearing in the text to be extracted.
[0042] The first reference example is obtained using a few-shot learning algorithm based on a pre-defined dataset. This dataset includes multiple texts and sentiment quadruples representing various aspects of each text. Specifically, a K-shot learning approach can be used to select examples of aspect terms and opinion terms from the K sentiment quadruples representing each aspect of the aforementioned dataset, along with their corresponding texts, to form the first reference example. This first reference example guides the larger model, enabling it to predict aspect-opinion pairs in the text to be extracted by referring to existing examples. Furthermore, the first reference example retains only aspect terms and opinion terms, excluding aspect categories and sentiment polarities, allowing the larger model to focus on the core task of extracting aspect-opinion pairs, thereby improving the accuracy of its predictions. The first reference example may include text 1, text 2, text 3, etc., and their respective aspect and opinion pairs. For example, text 1 is "The service at this restaurant is average, but the food is very good." All aspect and opinion pairs in text 1 are <service, average> and <food, very good>. In <service, average>, the aspect term is "service" (the corresponding aspect category is "service"), and the opinion term is "average." In <food, very good>, the aspect term is "food" (the corresponding aspect category is "food"), and the opinion term is "very good."
[0043] In practical applications such as e-commerce review analysis, user feedback analysis, and social media sentiment monitoring, user sentiment analysis tasks often require directly acquiring text data from user comment sections, social media posts, and product review areas to extract user feedback information for sentiment analysis. The directly acquired text data is usually complex, containing a large amount of irrelevant information. Therefore, preprocessing such as data cleaning, irrelevant information removal, and standardization is necessary to obtain standardized text for extraction, which serves as input to the larger model. For example, the standardized text for extraction might be "Soft-boiled eggs are very delicious," where all aspect-opinion pairs are <soft-boiled eggs, delicious>, with "soft-boiled eggs" being an aspect term and "delicious" being an opinion term. Similarly, the standardized text for extraction might be "The service at this restaurant is very good, but the food is just average," where all aspect-opinion pairs are <service, very good> and <food, average>, with "service" and "food" being aspect terms and "very good" and "average" being opinion terms. The input format of the text for extraction is similar to the first reference example, allowing the larger model to output predictions for all aspect-opinion pairs in the extracted text, analogous to the first reference example. Of course, in some cases, the obtained text to be extracted is close to the standardized format described above. In such cases, there is no need to perform the above preprocessing operations on the text, and it can be directly used as input to the large model. Whether or not the obtained text to be extracted is preprocessed before inputting it into the large model does not affect the implementation and realization of the embodiments of the present invention.
[0044] However, in reality, due to the different ways of expressing user evaluation feedback on different platforms, even with reference to existing examples, directly relying on the prediction results of the large model output on the aspect and opinion pair may result in prediction bias. Therefore, this invention designs an error detection and correction mechanism to further detect and correct the erroneous prediction results of the large model in order to improve the accuracy of sentiment analysis.
[0045] Step S120: Input the text to be extracted and the prediction results of each aspect and opinion pair into the pre-trained small model, so that the small model outputs the prediction results of each error category corresponding to the prediction results of each aspect and opinion pair based on the text to be extracted.
[0046] Specifically, a pre-trained small model is used to detect errors in the aspect and opinion pairs predicted by the large model, and the error types are categorized. Error categories include three types: no error, null value error, and ordinary error. No error means that all aspect and opinion pairs extracted by the large model from the text are correctly predicted. For example, for the text "This restaurant has excellent service, but the food is average," the large model's predictions for all aspect and opinion pairs are <service, excellent> and <food, average>, which are all correct. A null value error means that the large model incorrectly predicts an aspect or opinion term from the text when that term does not actually appear in the text. For example, for the text "I couldn't resist eating cake," the large model incorrectly extracts <cake, couldn't resist> as the aspect and opinion pair prediction, while the correct prediction should be <cake, NULL>, where NULL represents an empty value indicating that an explicit opinion term does not exist in the text. A common error refers to a situation where the aspect and opinion pair predicted by the large model does exist in the text, but the model's output of the aspect and opinion pair prediction is structurally or compositionally incorrect; that is, the predicted aspect terms and / or opinion terms are wrong. For example, for the text "The yogurt tastes good," the large model incorrectly identifies <milk, sour> as the aspect and opinion pair prediction. However, since "yogurt" is a complete aspect term, "good" is the correct opinion term. Therefore, the correct aspect and opinion pair prediction should be <yogurt, good>.
[0047] In some embodiments, step S120, which involves inputting the text to be extracted and the prediction results of aspects and viewpoint pairs into a pre-trained small model, so that the small model outputs prediction results of various error categories corresponding to the prediction results of aspects and viewpoint pairs based on the text to be extracted, includes the following steps:
[0048] The text to be extracted and the prediction results of each aspect and viewpoint pair are input into a pre-trained small model, so that the small model marks the positions of the prediction results of each aspect term and each viewpoint term in the text to be extracted based on the prediction results of each aspect and viewpoint pair;
[0049] Extract the features of each word in the labeled text to be extracted, and obtain the global features based on the features of each word, as well as obtain the possible paired features based on the term prediction results of each aspect and the term prediction results of each viewpoint in the features of each word.
[0050] Each attention weight is calculated based on the correlation between the aspect term prediction results and the viewpoint term prediction results in each possible pairing feature to obtain each final pairing feature;
[0051] Based on each final paired feature and global feature, the output shows the prediction results for each error category corresponding to each aspect and viewpoint in the prediction results.
[0052] Specifically, a small model may include a location-aware input fusion module, a feature extraction module, an attention module, and a classification module. First, the location-aware input fusion module... "and" <o>< / o> Markers such as "+" are used to label the positions of the predicted terms for each aspect and each opinion in the text to be extracted, making it easier for the model to learn the positional features of these words. For example, for the text to be extracted, "The soft-boiled eggs at this restaurant are very delicious, but the service is so-so," the aspect term predictions are "eggs" and "service," and the opinion term predictions are "soft-boiled" and "so-so." Therefore, the labeled text to be extracted would be "The soft-boiled eggs at this restaurant are very delicious, but the service is so-so." <o>half-cooked< / o> eggs It was very delicious, but services <o>generally< / o> If aspect terms or opinion terms are missing in the text to be extracted, an empty tag is used for marking. For example, for the text "I couldn't help but eat cake", the aspect term prediction result is "cake", and the opinion term prediction result is an empty value. The marked text is "I couldn't help but eat cake". cake <o>< / o> ".
[0053] The feature extraction module uses the BERT model to extract features from the labeled text to obtain all word features h1, h2, ..., h1 in the text. n Then, average pooling is performed on all word features to obtain the global features f of the text to be extracted. cls Average pooling is used to calculate the possible paired features p for each aspect of the term prediction results and each viewpoint term prediction results in all word features, and the following formula is used to obtain each possible paired feature p. ij :
[0054]
[0055] in, and Let i and j represent the contextual feature representations of the aspect term prediction results and the opinion term prediction results, respectively. Let i and j represent the ordinal numbers of the aspect term prediction results and the opinion term prediction results, respectively. ∪ represents the concatenation operation, and Pool(·) represents the pooling operation. For example, for the text to be extracted, "The soft-boiled eggs at this restaurant are very delicious, but the service is so-so," the possible paired features include the following four possible pairs of features: "eggs" and "soft-boiled" (p...). 11 ), "egg" and "general" (p 12 ), "service" and "semi-cooked" (p 21 ) and “service” and “general” (p 22 ).
[0056] Since the small model does not know which features among the four possible pairing features are correctly matched aspect and viewpoint pair predictions, an attention mechanism is needed to determine the features of the correctly matched aspect and viewpoint pair predictions. This allows for error detection of the correctly matched aspect and viewpoint pair predictions and the output of the corresponding error category predictions. Therefore, the attention module first calculates the correlation s between the features of the aspect term predictions and viewpoint term predictions in each possible pairing feature according to the following formula. ij :
[0057]
[0058] Where W represents the trainable parameter matrix. The attention weights α for each possible pair are calculated using the following normalization formula. ij :
[0059]
[0060] If the attention weight is greater than a preset threshold, it means that the corresponding possible pair is the final correct match; otherwise, it is an incorrect match. For example, for the text to be extracted, "The soft-boiled eggs at this restaurant are very delicious, but the service is so-so," the match between "eggs" and "soft-boiled" (p...) is incorrect. 11 ) of α 11 Larger (greater than the threshold), while "egg" and "normal" (p 12 ) of α 12If the value is small (below the threshold), it indicates that "egg" and "soft-boiled" are correctly matched aspect-viewpoint pairs in the prediction results. Similarly, "service" and "average" are another correctly matched aspect-viewpoint pair in the prediction results. Furthermore, the final paired feature representation f for each correctly matched aspect-viewpoint pair is calculated using the following formula. pair :
[0061]
[0062] For the text to be extracted, "The soft-boiled eggs at this restaurant are delicious, but the service is so-so," the final paired feature representations of the two correctly matched aspects and opinions—"eggs" and "soft-boiled," and "service" and "so-so"—are obtained. Finally, the classification module combines these final paired feature representations with the following formula through linear transformation and a softmax layer. pair and global features f cls Predict the error category of each correctly matching aspect and viewpoint in the prediction result:
[0063] f final =f pair +f cls
[0064]
[0065] Among them, W C and b c These represent the weight parameters and bias parameters learned, respectively. This indicates the error category prediction result. For example, for the text to be extracted, "The soft-boiled eggs at this restaurant are very delicious, but the service is so-so", the error category prediction result for "eggs" and "soft-boiled" is a normal error category, while the error category prediction result for "service" and "so-so" is a correct category.
[0066] In other embodiments, the smaller model may also employ any other neural network model with the same functionality to identify and detect errors in the prediction results based on the aspects and perspectives output by the larger model.
[0067] Step S130: Generate corresponding error feedback information for the prediction results based on the erroneous aspects and viewpoints.
[0068] In some embodiments, the error feedback information includes error analysis and target reference cases. The target reference case is the most similar reference case to the prediction result of the aspect and opinion pair that is in the same error category as the prediction result of the aspect and opinion pair, retrieved from the reference case set based on the final paired features and global features corresponding to the prediction result of the erroneous aspect and opinion pair. The reference case set includes multiple reference cases, and each reference case includes text and corresponding prediction results of each aspect and opinion pair with corresponding error category labels and each correct aspect and opinion pair.
[0069] Specifically, to effectively correct potentially erroneous predictions from large models, targeted and detailed error feedback information is generated based on these erroneous predictions. This feedback information can be used to correct the erroneous predictions. The error feedback information may include error analysis and the most similar reference cases. On one hand, further, the error analysis may include an analysis of the cause of the error and a description of corrective suggestions, enabling the large model to correct the erroneous aspect / viewpoint prediction to the correct one based on the cause of the error and the corresponding corrective suggestions. On the other hand, error case retrieval enhancement technology can be used to retrieve the most similar reference cases to the erroneous aspect / viewpoint prediction from a set of reference cases covering various fields. This enhances the relevance of the error feedback, helps the large model learn typical cases of the same error type, thereby better understanding and correcting errors, and improving error correction capabilities and prediction quality during the correction process. The retrieval process can be implemented by calculating the similarity between features.
[0070] For example, reference cases may include the text “The yogurt tastes good”, aspect / opinion pairs with common error labels predicting the outcome <milk, sour> and correct aspect / opinion pairs <yogurt, good>, etc.
[0071] Step S140: Using a large model, the prediction results of each erroneous aspect and viewpoint are corrected based on the text to be extracted and each error feedback information. Based on the text to be extracted, the second reference example, and each corrected aspect and viewpoint prediction result, the prediction results of each aspect and viewpoint prediction result are output to obtain each sentiment quadruple. The second reference example includes each sentiment quadruple of each aspect category and the corresponding text.
[0072] Specifically, a large model, such as the GPT4.0 model, uses the targeted error feedback information to correct the prediction results of the pre-trained small model, identifying and labeling aspects and opinions as various error categories (including null errors and ordinary errors). For example, <food, taste> is corrected to <food, average> to more accurately reflect the user's true evaluation and improve the accuracy and reliability of the large model's final output aspects and opinions in the prediction results. Specifically, a task instruction is constructed that explicitly states the task objective is to correct the prediction results of various erroneous aspects and opinions extracted from the text based on the error feedback information. This instruction is accompanied by specific content information of the text to be extracted, prompts indicating the prediction results of each erroneous aspect and opinion, and corresponding error feedback information. These prompts are then input into the large model to guide it in performing the task of correcting the prediction results of each erroneous aspect and opinion in the extracted text.
[0073] Subsequently, based on the prediction results of each modified aspect and viewpoint pair, the large model further predicts the aspect category corresponding to each modified aspect term and the sentiment polarity corresponding to each modified viewpoint term. Sentiment polarity includes positive, neutral, and negative sentiment tendencies. For example, predicting that <food, general> belongs to the "Food" category and labeling its sentiment polarity as "Neutral" yields the final predicted sentiment quadruple {(food, general, food, neutral)}. Specifically, this is achieved by constructing task instructions that explicitly state the task objective is to predict the aspect category and sentiment polarity of the prediction results based on the second reference example, along with specific content information of the text to be extracted, the prediction results of each modified aspect and viewpoint pair, and the specific content information of the second reference example. These prompts are then input into the large model to guide it in performing the task of predicting aspect category and sentiment polarity.
[0074] Alternatively, a well-defined task instruction can be constructed, including clearly stating that the task objective is to correct the prediction results of each erroneous aspect and viewpoint pair and to predict the aspect category and sentiment polarity of each corrected aspect and viewpoint pair. This instruction should also include specific content information of the text to be extracted, the prediction results of each erroneous aspect and viewpoint pair, corresponding error feedback information, and specific content information of a second reference example. This instruction should be input into the large model to guide it in performing error correction and aspect category and sentiment polarity prediction tasks. Through this chain-like reasoning, the large model first corrects the erroneous aspect and viewpoint pair predictions based on targeted error feedback information, and then further predicts the corresponding aspect category and sentiment polarity based on the corrected prediction results. This allows the large model to better understand the context and generate accurate and complete sentiment quadruples.
[0075] The second reference example is obtained by employing a few-shot learning algorithm based on a pre-set dataset, which includes multiple texts and various sentiment quadruples for each aspect category involved in each text. Specifically, a K-shot learning method can be used to select K examples of sentiment quadruples for each aspect category from the aforementioned pre-set dataset and their respective texts to form the second reference example. The second reference example can include text 1, text 2, text 3, etc., and their respective sentiment quadruples. For example, text 1 is "The service at this restaurant is average, but the food is very good." All sentiment quadruples in text 1 are {(service, average, service, neutral), (food, very good, food, positive)}, where the aspect term in (service, average, service, neutral) is "service," the opinion term is "average," the aspect category is "service," and the sentiment polarity is "neutral"; and the aspect term in (food, very good, food, positive) is "food," the opinion term is "very good," the aspect category is "food," and the sentiment polarity is "positive."
[0076] In some embodiments, the method further includes the following steps:
[0077] A large model is used to output the prediction results of each aspect category and sentiment polarity corresponding to the prediction results of each correct aspect and opinion based on the text to be extracted, the second reference example, and each correct aspect and opinion, so as to obtain each sentiment quadruple.
[0078] After the pre-trained small model performs error detection on the aspect and opinion pairs initially output by the large model, if the aspect and opinion pairs are correct, no error correction is needed. The large model can directly predict the aspect category and sentiment polarity based on the correct aspect and opinion pairs.
[0079] In some embodiments, the small model is obtained through pre-training via the following steps:
[0080] The small model is pre-trained based on the reference case set until it converges to obtain the pre-trained small model.
[0081] In this embodiment, the training dataset used to train the small model is the same as the retrieval dataset or retrieval database used to retrieve target reference cases. This ensures that the small model has learned error types consistent with the error types of the aspects and viewpoints of the text to be extracted, thus improving classification accuracy. Furthermore, due to the consistent data distribution, the most similar error reference cases of the same error category retrieved are more valuable, helping the model learn the correct correction methods. In other embodiments, the training dataset can also be a more generalized dataset containing data from multiple domains, different from the retrieval database, which can improve the small model's adaptability to different domains. Additionally, the trained small model is obtained by minimizing the cross-entropy loss during training, as shown in the following formula:
[0082]
[0083] Where L represents the cross-entropy loss, y k This represents the error category label for the k-th aspect and viewpoint in relation to the prediction result. This represents the error category of the prediction result for the k-th aspect and viewpoint.
[0084] The aspect-level sentiment quadruple extraction method of this invention not only improves the prediction performance of sentiment quadruples in few-shot learning scenarios, but also demonstrates strong zero-shot learning capabilities.
[0085] Corresponding to the above method, the present invention also provides an aspect-level emotion quadruple extraction system, the system including a computer device, the computer device including a processor and a memory, the memory storing computer instructions, the processor being used to execute the computer instructions stored in the memory, and when the computer instructions are executed by the processor, the system implements the steps of the aforementioned method.
[0086] This invention also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the aforementioned method. The computer-readable storage medium may be a tangible storage medium, such as random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, register, floppy disk, hard disk, removable storage disk, CD-ROM, or any other form of storage medium known in the art.
[0087] This invention also provides a computer program product, including computer instructions that, when executed by a processor, implement the steps of the aforementioned method.
[0088] Those skilled in the art will understand that the exemplary components, systems, and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software, or a combination of both. Whether implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this invention. When implemented in hardware, it can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this invention are programs or code segments used to perform the desired tasks. The programs or code segments can be stored in a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried in a carrier wave.
[0089] It should be clarified that the present invention is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of the present invention.
[0090] In this invention, features described and / or illustrated for one embodiment may be used in the same or similar manner in one or more other embodiments, and / or combined with or in place of features of other embodiments.
[0091] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, various modifications and variations of the embodiments of the present invention are possible. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for extracting aspect-level sentiment quadruples, characterized in that, The method includes: A large model is used to extract aspect and opinion pairs from the text to be extracted based on a first reference example, and the large model outputs at least one aspect and opinion pair prediction result. The first reference example includes aspect and opinion pairs of each aspect category and the corresponding text. The aspect and opinion pair includes aspect terms and corresponding opinion terms. The text to be extracted and the prediction results of each aspect and opinion pair are input into a pre-trained small model, so that the small model outputs prediction results of each error category corresponding to the prediction results of each aspect and opinion pair based on the text to be extracted; Based on erroneous aspects and viewpoints, generate corresponding error feedback information for the prediction results; The large model is used to correct the prediction results of each erroneous aspect and viewpoint based on the text to be extracted and each error feedback information. Based on the text to be extracted, the second reference example and each corrected aspect and viewpoint prediction result, the model outputs the prediction results of each aspect category and sentiment polarity corresponding to the prediction results of each corrected aspect and viewpoint prediction result, so as to obtain each sentiment quadruple. The second reference example includes each sentiment quadruple of each aspect category and the text in which it is located. The process of inputting the text to be extracted and the prediction results of each aspect and opinion pair into a pre-trained small model, so that the small model outputs prediction results of each error category corresponding to the prediction results of each aspect and opinion pair based on the text to be extracted, includes: The text to be extracted and the prediction results of each aspect and viewpoint pair are input into a pre-trained small model, so that the small model marks the positions of the prediction results of each aspect term and each viewpoint term in the text to be extracted based on the prediction results of each aspect and viewpoint pair; Extract the features of each word in the labeled text to be extracted, and obtain the global features based on the features of each word, as well as obtain the possible paired features based on the term prediction results of each aspect and the term prediction results of each viewpoint in the features of each word. Each attention weight is calculated based on the correlation between the aspect term prediction results and the viewpoint term prediction results in each possible pairing feature to obtain each final pairing feature; Based on each final paired feature and global feature, the output shows the prediction results for each error category corresponding to each aspect and viewpoint in the prediction results.
2. The method according to claim 1, characterized in that, The error feedback information includes error analysis and target reference cases. The target reference case is the most similar reference case to the prediction result of the aspect and opinion pair with the same error category as the prediction result of the aspect and opinion pair, retrieved from the reference case set based on the final paired features and global features corresponding to the prediction result of the erroneous aspect and opinion pair. The reference case set includes multiple reference cases, and each reference case includes text and the corresponding prediction results of each aspect and opinion pair with the corresponding error category label and each correct aspect and opinion pair.
3. The method according to claim 2, characterized in that, The error analysis includes an analysis of the cause of the error and a description of suggested corrections.
4. The method according to claim 2, characterized in that, The small model is obtained through pre-training via the following steps: The small model is pre-trained based on the reference case set until it converges to obtain the pre-trained small model. The error categories include no error, null value error, and normal error.
5. The method according to claim 1, characterized in that, The first reference example and the second reference example are obtained by using a few-shot learning algorithm based on a preset dataset, which includes multiple texts and various sentiment quadruples for each aspect category involved in each text.
6. The method according to any one of claims 1 to 3 and 5, characterized in that, The method further includes: A large model is used to output the prediction results of each aspect category and sentiment polarity corresponding to the prediction results of each correct aspect and opinion based on the text to be extracted, the second reference example, and each correct aspect and opinion, so as to obtain each sentiment quadruple.
7. A system for extracting aspect-level emotion quadruples, comprising a processor, a memory, and computer instructions stored in the memory, characterized in that, The processor is configured to execute the computer instructions, and when the computer instructions are executed, the system implements the steps of the method as described in any one of claims 1 to 6.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the method as described in any one of claims 1 to 6.
9. A computer program product comprising computer instructions, characterized in that, When executed by a processor, the computer instructions implement the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Aspect emotion tetrad prediction method and system
CN116562305A
Comment text viewpoint prediction method, system and equipment and storage medium
CN117592514A