Classification method and device, storage medium and electronic device
Through data enhancement and span-level multi-word expression modeling, the problems of insufficient and unevenly distributed labeled data in attribute-level sentiment classification are solved, and the accuracy of sentiment classification and the performance of the model are improved.
Patent Information
- Application Number
- CN202411365394.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2044-09-27
AI Technical Summary
Existing attribute-level sentiment classification methods lack high-quality annotated data, have uneven data distribution, and fail to effectively utilize span-level multi-word expressions in sentences, resulting in insufficient ability to capture sentiment expressions and high classification error rate.
Through data enhancement and splicing attribute words, the start context representation and end context representation of the splicing sequence are obtained, a fusion sentiment table is constructed, and the sentiment prediction classification model is used to determine the sentiment polarity of the attribute words. Combined with the large model, text generation, verification and correction are performed to enhance the quality of labeled data and the uniformity of sentiment polarity distribution.
The model's sentiment understanding ability has been improved, and it can more accurately identify the sentiment polarity of attribute words in sentences, achieving efficient and accurate sentiment polarity classification.
Smart Images

Figure CN119226517B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to a classification method and device, a storage medium, and an electronic device. Background Art
[0002] Attribute-level sentiment analysis is a fine-grained sentiment analysis method that aims to identify the sentiment polarity of attribute words that appear explicitly in a sentence. The sentiment polarity of attribute words is generally categorized as positive, negative, or neutral. Compared to coarse-grained sentiment analysis, fine-grained attribute-level sentiment analysis can provide product or service providers with a more comprehensive understanding of the sentiment polarity of a specific attribute, thereby helping to improve the quality of their products or services. Coarse-grained sentiment analysis cannot provide the sentiment polarity of a specific attribute word. It generally assumes that the entire sentence or document has a single sentiment polarity and cannot handle the complexities of varying sentiment polarities across different attribute words.
[0003] Attribute-level sentiment classification methods usually require a large amount of high-quality annotated data. However, in some practical application scenarios, there is often a lack of high-quality annotated data and the data distribution is uneven, which makes it impossible for the model to perform well in identifying the sentiment polarity of attribute words.
[0004] In addition, in existing attribute-level sentiment classification, most of them use words in sentences to model the sentiment polarity of attribute words, ignoring the role of span-level multi-word expressions in sentences in attribute word sentiment modeling, resulting in insufficient ability to capture attribute-level sentiment expressions and a high classification error rate.
[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute prior art known to ordinary technicians in the field. Summary of the Invention
[0006] The present disclosure provides a classification method and device, a storage medium, and an electronic device, which at least to a certain extent overcome the problem of poor classification effect in attribute-level sentiment classification.
[0007] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by practice of the present disclosure.
[0008] According to one aspect of the present disclosure, a classification method is provided, comprising:
[0009] Perform data augmentation on the input text and concatenate attribute words to determine the concatenation sequence;
[0010] Obtaining a start context representation and an end context representation of a word in the concatenated sequence;
[0011] Determining a fused sentiment table according to the start context representation and the end context representation of the words in the concatenated sequence;
[0012] The fused sentiment table is input into a sentiment prediction classification model to determine the sentiment polarity classification of the attribute words in the input text.
[0013] In some embodiments, data enhancement is performed on the text, attribute words are concatenated, and a concatenated sequence is determined, including:
[0014] Performing data enhancement on the input text to determine enhanced text; wherein the enhanced text includes a plurality of sentences;
[0015] Attribute words of the enhanced text are extracted, multiple sentences in the enhanced text are spliced with the attribute words, and a splicing sequence including sentence contexts and attribute words is determined.
[0016] In some embodiments, performing data enhancement on text and determining enhanced text includes:
[0017] Input the input text into the large model for data enhancement and determine the first text;
[0018] Using the large model, verify the similarity between the attribute words and sentiment polarity of the first text and the attribute words and sentiment polarity of the input text;
[0019] If the similarity between the attribute words and sentiment polarity of the first text verified by the large model and the attribute words and sentiment polarity of the input text does not meet the similarity threshold, the first text is corrected using the large model until the similarity between the attribute words and sentiment polarity of the first text and the attribute words and sentiment polarity of the input text meets the similarity threshold, and the first text is determined to be an enhanced text.
[0020] In some embodiments, obtaining a start context representation and an end context representation of a word in the concatenated sequence includes:
[0021] Build a multi-word representation model using bidirectional encoder representation and feedforward neural network;
[0022] The multi-word representation modeling model is used to obtain the start context representation and the end context representation of the words in the spliced sequence.
[0023] In some embodiments, the start context representation and the end context representation of the word in the concatenated sequence are obtained as follows:
[0024]
[0025] Where BERT(·) is the operation represented by the bidirectional encoder; W start 、Wend 、b start and b end Parameters of the model for modeling multi-word representations; The context representation of the i-th word in the concatenated sequence output by the bidirectional encoder representation; The starting context representation of the i-th word in the concatenated sequence output by the multi-word representation modeling model; The ending context representation of the i-th word in the concatenated sequence output by the multi-word representation modeling model.
[0026] In some embodiments, determining a fused sentiment table based on the start context representation and the end context representation of the words in the concatenated sequence includes:
[0027] Construct a multi-word-aware sentiment table generation model;
[0028] Inputting the start context representation and the end context representation of the words in the concatenated sequence into a multi-word perceived sentiment table generation model to generate a multi-word perceived sentiment table with different sentiment polarities and different sentiment intensities;
[0029] The sentiment tables of multiple words with different sentiment polarities and containing different sentiment intensities are fused to determine a fused sentiment table.
[0030] In some embodiments, a sentiment table of multiple words with different sentiment polarities and different sentiment intensities is generated as follows:
[0031]
[0032] table pos (i,j)=W pos sd(i,j)+b pos
[0033] table neg (i,j)=W neg sd(i,j)+b neg
[0034] table neu (i,j)=W neu sd(i,j)+b neu
[0035] Where σ(·) is the sigmoid function; is the outer product operation; sd(i,j) is the table feature of the span between word i and word j; The starting context representation of the i-th word in the concatenated sequence output by the multi-word representation modeling model; W is the ending context representation of the i-th word in the concatenated sequence output by the multi-word representation modeling model; pos 、W neg 、W neu 、b pos 、b neg and b neu Parameters for generating a model for multi-word-aware sentiment tables; table pos (i, j) is the emotional intensity of the positive emotion span between word i and word j in the multi-word perceived emotion table of positive emotion; neg (i, j) is the emotional intensity of the negative emotion between word i and word j in the multi-word perception emotional table of negative emotion; neu (i, j) is the emotional intensity of the neutral emotion between word i and word j in the multi-word perception emotional table of neutral emotion; pos (i,j),table neg (i,j) and table neu (i, j) constitutes a sentiment table of multiple words with different sentiment polarities and different sentiment intensities.
[0036] In some embodiments, fusing the multi-word perception emotion tables with different emotion polarities and different emotion intensities to determine the fused emotion table includes:
[0037] Performing a maximum pooling operation on the multi-word perception sentiment table with different sentiment polarities and different sentiment intensities to determine a maximum pooled sentiment table;
[0038] The emotion tables after the maximum pooling are spliced and fused to determine a fused emotion table.
[0039] In some embodiments, the fusion emotion table is determined as follows:
[0040]
[0041] Among them, max_pooling(·) is the maximum pooling operation; table pos A sentiment table for multi-word perception of positive sentiment; table neg A sentiment table for multi-word perception of negative sentiment; table neu Sentiment table for multi-word perception of neutral sentiment; The sentiment table value of the multi-word perception of the overall positive sentiment after maximum pooling; The sentiment table value of the multi-word perception of the overall negative sentiment after maximum pooling; is the sentiment table value of the multi-word perception of the overall neutral sentiment after the maximum pooling; formula [table pos ;table neg ;table neu ] in the symbol; for splicing and fusion operations; table fusion A fused emotion table that integrates multiple emotion intensities with different emotion polarities.
[0042] In some embodiments, the sentiment prediction classification model includes: a linear layer and a function processing layer;
[0043] Inputting the fused sentiment table into a sentiment prediction classification model to determine the sentiment polarity classification of the attribute words in the input text includes:
[0044] Inputting the fused emotion table into the linear layer of the emotion prediction classification model to determine the emotion table features that fuse multiple emotion intensities of different emotion polarities;
[0045] A function processing layer is used to perform sentiment polarity distribution analysis on the sentiment table feature integrating multiple sentiment intensities of different sentiment polarities, and to determine the sentiment polarity classification of the attribute words in the input text.
[0046] In some embodiments, the sentiment polarity classification of the attribute words in the input text is determined as follows:
[0047] h s =W s table fusion +b s
[0048]
[0049] Among them, W s and b s Parameters of the sentiment prediction classification model; table fusion It is a fusion emotion table that integrates multiple emotion intensities with different emotion polarities; h s The emotional table feature of multiple emotional intensities with different emotional polarities is obtained after linear layer processing; Classify the sentiment polarity of attribute words in the input text.
[0050] In some embodiments, the training process of the emotion prediction classification model includes:
[0051] Determine the sentiment consistency check loss based on a sentiment table of multiple words with different sentiment polarities and different sentiment intensities;
[0052] Determine the sentiment polarity cross entropy loss based on the sentiment polarity classification of the enhanced text and attribute words;
[0053] Determining a loss function according to the sentiment consistency check loss and the sentiment polarity cross entropy loss;
[0054] The emotion prediction classification model is trained according to the loss function.
[0055] In some embodiments, the sentiment consistency check loss is determined as follows:
[0056]
[0057] Among them, l sr is the sentiment consistency check loss; K is the number of sentiment tables with different sentiment polarities; ||·|| is the sum of the squares of the absolute values of each element in the calculation matrix; table c and table c′ Sentiment table for any two multi-word perceptions with different sentiment polarities.
[0058] In some embodiments, the loss function is determined as follows:
[0059]
[0060] Among them, l is the loss function; D is the enhanced text; l sr is the sentiment consistency verification loss; is the sentiment polarity classification of attribute words; λ is the hyperparameter of the model; l f is the sentiment polarity cross entropy loss.
[0061] According to another aspect of the present disclosure, there is also provided a classification device, comprising:
[0062] The emotional text enhancement module is used to perform data enhancement on the input text, splice attribute words, and determine the splicing sequence;
[0063] A multi-word representation modeling module, configured to obtain a start context representation and an end context representation of the words in the concatenated sequence;
[0064] A fusion sentiment table determination module is used to determine a fusion sentiment table based on the start context representation and the end context representation of the words in the spliced sequence;
[0065] The sentiment prediction module is used to input the fused sentiment table into the sentiment prediction classification model to determine the sentiment polarity classification of the attribute words in the input text.
[0066] According to another aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any one of the above-mentioned classification methods by executing the executable instructions.
[0067] According to another aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, any one of the above-mentioned classification methods is implemented.
[0068] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the computer program implements any one of the above classification methods.
[0069] The classification method and device, storage medium, and electronic device provided in the embodiments of the present disclosure include: performing data enhancement on the input text and splicing attribute words to determine the splicing sequence; obtaining the start context representation and end context representation of the words in the splicing sequence; determining a fused sentiment table based on the start context representation and end context representation of the words in the splicing sequence; inputting the fused sentiment table into the sentiment prediction classification model to determine the sentiment polarity classification of the attribute words in the input text. The embodiments of the present disclosure explicitly consider obtaining more high-quality labeled data in the field and making the distribution of different sentiment polarities more uniform through data enhancement, and can effectively integrate data enhancement methods for obtaining more high-quality labeled data in the field and making the distribution of different sentiment polarities more uniform into attribute sentiment polarity prediction, overcoming the problem that existing attribute-level sentiment classification methods have not yet effectively integrated data enhancement methods into attribute sentiment classification. Through data enhancement, the amount of high-quality labeled data in the field can be increased and the distribution of data of different sentiment polarities can be more balanced, enabling the model to learn more comprehensive sentiment knowledge and improve the model's sentiment understanding ability. By obtaining the start context representation and end context representation of the words in the spliced sequence to determine the fused sentiment table, the span-level multi-word expression information in the sentence is explicitly considered and modeled, which can effectively integrate the span-level multi-word expression information in the sentence into the sentiment table feature construction, aggregation and sentiment polarity prediction, overcoming the problem that the existing attribute-level sentiment classification method has not effectively modeled and aggregated span-level multi-word expression information, enabling the model to learn more accurate and more informative sentiment representations, improving the model's attribute-level sentiment expression capture ability and model performance, and being able to more accurately identify the sentiment polarity of specific attribute words in the sentence, thereby achieving efficient and accurate sentiment polarity classification.
[0070] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] The accompanying drawings are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification, are used to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and those skilled in the art can derive other drawings based on these drawings without inventive effort.
[0072] Figure 1 A schematic diagram showing the system structure of a classification method in an embodiment of the present disclosure.
[0073] Figure 2 A schematic diagram of a classification method in an embodiment of the present disclosure is shown.
[0074] Figure 3 A schematic diagram of the process of determining a splicing sequence in a classification method according to an embodiment of the present disclosure is shown.
[0075] Figure 4 A schematic diagram of the process of determining enhanced text in a classification method in an embodiment of the present disclosure is shown.
[0076] Figure 5 A schematic diagram illustrating a process of obtaining a start context representation and an end context representation of a word in a spliced sequence in a classification method according to an embodiment of the present disclosure is shown.
[0077] Figure 6 A schematic diagram of the process of determining a fusion emotion table in a classification method according to an embodiment of the present disclosure is shown.
[0078] Figure 7 A schematic diagram showing a specific process of determining a fusion emotion table in a classification method according to an embodiment of the present disclosure is shown.
[0079] Figure 8 A schematic diagram of a classification process for determining the sentiment polarity of attribute words in an input text in a classification method according to an embodiment of the present disclosure is shown.
[0080] Figure 9 A schematic diagram illustrating the training process of a sentiment prediction classification model of a classification method in an embodiment of the present disclosure is shown.
[0081] Figure 10 A model framework diagram of a classification method in an embodiment of the present disclosure is shown.
[0082] Figure 11 A schematic diagram of a classification device in an embodiment of the present disclosure is shown.
[0083] Figure 12 A structural block diagram of a computer device showing a classification method in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0084] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0085] In addition, the accompanying drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. Identical reference numerals in the figures denote identical or similar parts, and thus repetitive descriptions thereof will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities that do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0086] The specific implementation of the embodiment of the present disclosure is described in detail below with reference to the accompanying drawings.
[0087] Figure 1 FIG. 1 shows an exemplary application system architecture diagram to which the classification method in the embodiment of the present disclosure can be applied. Figure 1 As shown, the system architecture may include a terminal device 101 , a network 102 and a server 103 .
[0088] The network 102 is a medium for providing a communication link between the terminal device 101 and the server 103 , and can be a wired network or a wireless network.
[0089] Optionally, the above-mentioned wireless network or wired network uses standard communication technologies and / or protocols. The network is typically the Internet, but can also be any network, including but not limited to a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a private network or any combination of a virtual private network). In some embodiments, technologies and / or formats including Hyper Text Mark-up Language (HTML), Extensible Markup Language (XML), etc. are used to represent data exchanged over the network. In addition, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet Protocol Security (IPsec), etc. can be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technologies can also be used to replace or supplement the above-mentioned data communication technologies.
[0090] The terminal device 101 can be various electronic devices, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, wearable devices, augmented reality devices, virtual reality devices, etc.
[0091] Optionally, the client of the application installed in different terminal devices 101 is the same, or the client of the same type of application based on different operating systems. Based on the different terminal platforms, the specific form of the client of the application can also be different, for example, the application client can be a mobile phone client, a PC client, etc.
[0092] The server 103 may be a server that provides various services, such as a background management server that provides support for the devices operated by the user using the terminal device 101. The background management server may analyze and process the received request and other data, and feed back the processing results to the terminal device.
[0093] Optionally, the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The terminal can be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, etc., but is not limited to these. The terminal and the server can be directly or indirectly connected via wired or wireless communication, which is not limited in this application.
[0094] Those skilled in the art will know that Figure 1 The number of terminal devices, networks, and servers in the embodiment is merely illustrative, and any number of terminal devices, networks, and servers may be provided based on actual needs. This embodiment of the present disclosure does not limit this.
[0095] Under the above system architecture, an embodiment of the present disclosure provides a classification method, which can be executed by any electronic device with computing and processing capabilities.
[0096] In some embodiments, the classification method provided in the embodiments of the present disclosure can be executed by the terminal device of the above-mentioned system architecture; in other embodiments, the classification method provided in the embodiments of the present disclosure can be executed by the server in the above-mentioned system architecture; in other embodiments, the classification method provided in the embodiments of the present disclosure can be implemented by the terminal device and the server in the above-mentioned system architecture through interaction.
[0097] Existing attribute-level sentiment classification methods can generally be divided into rule-based methods, traditional machine learning-based methods, and deep learning-based methods. Rule-based methods generally use predefined rules and sentiment dictionaries to identify the sentiment polarity of attribute words. However, such methods are difficult to apply in scenarios where sentiment resources are limited. Traditional machine learning-based methods use machine learning models, such as support vector machines and Bayesian classification, to mine the sentiment polarity of attribute words in sentences. However, such methods heavily rely on the quality of manually designed features, and manually designing features is also a very time-consuming and labor-intensive task. In deep learning-based methods, the model can automatically learn features suitable for specific tasks to identify the sentiment polarity of attribute words.
[0098] The above solutions still have certain shortcomings. For example, the above methods require a large amount of high-quality annotated data. In some practical scenarios, high-quality annotated data is often lacking and the data distribution is uneven, which makes the model unable to perform well in identifying the sentiment polarity of attribute words. Secondly, these methods mostly use words in sentences to model the sentiment polarity of attribute words, ignoring the role of span-level multi-word expressions in sentence-level sentiment modeling.
[0099] Figure 2 A schematic diagram of a classification method in an embodiment of the present disclosure is shown. Figure 2 As shown, the classification method provided in the embodiment of the present disclosure includes the following steps:
[0100] Step S202: performing data enhancement on the input text and splicing attribute words to determine the splicing sequence;
[0101] Step S204: obtaining the start context representation and the end context representation of the words in the concatenated sequence;
[0102] Step S206: determining a fusion sentiment table based on the start context representation and the end context representation of the words in the concatenated sequence;
[0103] Step S208: Input the fused sentiment table into the sentiment prediction classification model to determine the sentiment polarity classification of the attribute words in the input text.
[0104] The disclosed embodiments explicitly consider obtaining more high-quality labeled data within a domain and making the distribution of different sentiment polarities more uniform through data augmentation. This effectively integrates the data augmentation methods for obtaining more high-quality labeled data within a domain and making the distribution of different sentiment polarities more uniform into the prediction of attribute sentiment polarity, overcoming the problem that existing attribute-level sentiment classification methods have not yet effectively integrated data augmentation methods into attribute sentiment classification. Through data augmentation, the amount of high-quality labeled data within a domain can be increased and the distribution of data of different sentiment polarities can be made more balanced, enabling the model to learn more comprehensive sentiment knowledge and improving the model's sentiment understanding ability. By obtaining the start context representation and end context representation of the words in the spliced sequence to determine the fused sentiment table, the span-level multi-word expression information in the sentence is explicitly considered and modeled, which can effectively integrate the span-level multi-word expression information in the sentence into the sentiment table feature construction, aggregation and sentiment polarity prediction, overcoming the problem that the existing attribute-level sentiment classification method has not effectively modeled and aggregated span-level multi-word expression information, enabling the model to learn more accurate and more informative sentiment representations, improving the model's attribute-level sentiment expression capture ability and model performance, and being able to more accurately identify the sentiment polarity of specific attribute words in the sentence, thereby achieving efficient and accurate sentiment polarity classification.
[0105] Figure 3 A schematic diagram of the process of determining the splicing sequence according to a classification method in an embodiment of the present disclosure is shown. Figure 3 As shown, in the embodiment, data enhancement is performed on the text and attribute words are spliced to determine the splicing sequence, including:
[0106] Step S302: performing data enhancement on the input text to determine enhanced text; wherein the enhanced text includes multiple sentences;
[0107] Step S304: extracting attribute words of the enhanced text, concatenating multiple sentences in the enhanced text with the attribute words, and determining a concatenated sequence including sentence contexts and attribute words.
[0108] Existing technologies have neglected the use of large-scale model data augmentation to obtain more high-quality annotated data within a domain and to achieve a more even distribution of different sentiment polarities. Large-scale model-based data augmentation methods have not yet been effectively integrated into the modeling of attribute-level sentiment classification models. Large-scale model-based data augmentation can increase the amount of high-quality annotated data within a domain and achieve a more even distribution of data with different sentiment polarities, enabling the model to learn more comprehensive sentiment knowledge. Input text is fed into the large-scale model for data augmentation to generate more high-quality annotated data. An augmented text is determined, including multiple sentences. The number of sentences in the augmented text is set before data augmentation is performed using the large-scale model. For example, if the input text includes 10 sentences and the augmentation factor is set to 10, the augmented text output by the large-scale model will include 10×10=100 sentences. Attribute words are extracted from the augmented text, and multiple sentences in the augmented text are concatenated with the attribute words to determine a concatenated sequence containing sentence context and attribute words. The concatenation format is "[CLS] + sentence + [SEP] + attribute word + [SEP]", where [CLS] is a classification marker and [SEP] is a separation marker. Generally, [CLS] is set at the beginning of a sentence and [SEP] is set at the end of a sentence. After adding attribute words, [SEP] is set again to form a complete concatenation unit. The resulting concatenation sequence containing sentence context and attribute words is represented as I sa ={w cls ,w1,...,w n ,w sep ,a1,...,a m ,w sep}; where n represents the length of the sentence and m represents the length of the attribute word.
[0109] The large model involved in the embodiment refers to a machine learning model with a large number of parameters, a complex structure, and usually trained on a large-scale data set. These models are designed to learn complex patterns in the data and perform well in a variety of tasks. Such models have received widespread attention and application in many fields due to their powerful representational capabilities and wide application potential. A large language model (LLM) is a type of large model. The basis for sentiment polarity classification based on the present disclosure is text formed by natural language. The use of a large language model can process natural language tasks and achieve text enhancement.
[0110] Figure 4 A schematic diagram of a process for determining enhanced text according to a classification method in an embodiment of the present disclosure is shown. Figure 4 As shown, in the embodiment, data enhancement is performed on the text to determine the enhanced text, including:
[0111] Step S402: Input the input text into the large model for data enhancement to determine the first text;
[0112] Step S404: using the large model to verify the similarity between the attribute words and sentiment polarity of the first text and the attribute words and sentiment polarity of the input text;
[0113] Step S406: If the similarity between the attribute words and sentiment polarity of the first text verified by the large model and the attribute words and sentiment polarity of the input text does not meet the similarity threshold, the large model is used to correct the first text until the similarity between the attribute words and sentiment polarity of the first text and the attribute words and sentiment polarity of the input text meets the similarity threshold, and the first text is determined to be an enhanced text.
[0114] The input text is fed into the large model for data augmentation, generating a first text with the same attribute words and sentiment polarity as the input text. Based on the existing text data, more high-quality annotated data can be generated, and the data distribution between different sentiment polarities in the original text data can be more balanced.
[0115] In the embodiment, the large model has three stages: text generation, text verification, and text correction, each of which plays a different role. Among them, in the text generation stage, it is used to generate a text with the same attribute words and emotional polarity as the sentences contained in the input text. Before generation, the number of each emotional polarity in the existing text data is counted, and the number of texts of each emotional polarity to be generated is obtained according to the set target text number of each emotional polarity. During the generation process, the original input text is spliced into prompt words, such as "You are a text generation expert. Please analyze the attribute words and emotional polarity according to the provided text, generate a reformulated text with the same attribute words and emotional polarity, and ensure emotional consistency with the provided text. The provided text is: <text>. Output the reformulated text:", where <text> is a sentence in the original input text, and the first text is output.
[0116] During the text verification phase, the large model is used to check whether the sentences in the generated first text are consistent with the sentences in the original input text in terms of attribute words and emotional expressions, and corresponding explanations are given. The input text and the first text are spliced together to form prompt words and input into the large model to determine the similarity. For example, "You are a text verification expert. Please score the provided original input text and the generated text for comparison. The evaluation is based on whether the attribute words and the corresponding emotional polarity of the attribute words are consistent. The score range is 0-5 points, where 0 points means that the attribute words and the corresponding emotional polarity are completely inconsistent, and 5 points means that the attribute words and the corresponding emotional polarity are completely consistent. Original text: <original text>. Comparison generated text: <comparison generated text>. Please output the scoring results in json format and give corresponding explanations." Among them, <original text> is the original input text to the attribute emotion text generation module, and <comparison generated text> is the first generated text to be compared. The spliced prompt words are input into the big model, and the big model outputs the scoring results (0-5 points) and corresponding explanations. The generated text with a score between 4-5 points is high-quality annotation data. The similarity between the attribute words and sentiment polarity of the first text and the attribute words and sentiment polarity of the input text meets the similarity threshold and is put into the enhanced text data. The generated text with a score between 0-3 points is low-quality text data. The similarity between the attribute words and sentiment polarity of the first text and the attribute words and sentiment polarity of the input text does not meet the similarity threshold and the text needs to be regenerated.
[0117] During the text correction phase, low-quality text data is corrected. The low-quality text data, corresponding explanations, and original text are concatenated to form prompts. For example, "You are a text correction expert. Please regenerate high-quality text data based on the low-quality text, corresponding explanations, and original text, so that the attribute words and corresponding sentiment polarity in the generated sentence are the same as those in the original text. Low-quality text: <low-quality text data>. Corresponding explanation: <corresponding explanation>. Original text: <original text>. Output: ", where <low-quality text data> is the low-quality text data to be corrected, i.e., the first text that does not meet the similarity threshold; <corresponding explanation> is the corresponding explanation of the low-quality text output during the text verification phase; and <original text> is the original input text. The sentence output during the text correction phase is re-input into the text verification phase until the similarity between the attribute words and sentiment polarity of the first text and those of the input text meets the similarity threshold. The generated text passes verification, and the first text that passes verification is determined as the enhanced text.
[0118] The above three stages of text generation, text verification and text correction can respectively form independent modular processing units, including: attribute emotion text generation module, attribute emotion verification module, and attribute emotion correction module.
[0119] This embodiment effectively integrates the large-model data enhancement method for obtaining more high-quality annotated data in the field and making the distribution of different sentiment polarities more uniform into the attribute sentiment polarity prediction, can effectively integrate the span-level multi-word expression information in the sentence into the sentiment table feature construction, aggregation and sentiment polarity prediction, can effectively calibrate the sentiment table and use the sentiment table to model sentiment knowledge. The text generation stage can effectively use the original text to increase the amount of annotated data in the field and make the data distribution of different sentiment polarities more balanced. The text verification stage can effectively analyze whether the generated attribute sentiment text data is high-quality annotated data and provide relevant explanations. The text correction stage can effectively modify low-quality attribute sentiment text data into high-quality attribute sentiment text data, and improve the generation capacity of high-quality annotated data in the field.
[0120] This example innovatively considers using large-model data augmentation to obtain more high-quality labeled data within the domain and to make the distribution of different sentiment polarities more even. The three stages of text generation, text verification, and text correction proposed can effectively integrate large-model data augmentation methods for obtaining more high-quality labeled data within the domain and making the distribution of different sentiment polarities more even into attribute sentiment polarity prediction, overcoming the problem that existing attribute-level sentiment classification methods have not yet effectively integrated large-model data augmentation methods into attribute sentiment classification. Through large-model-based data generation, verification, and correction, the amount of high-quality labeled data within the domain can be increased and the distribution of data of different sentiment polarities can be more evenly distributed, enabling the model to learn more comprehensive sentiment knowledge and improving the model's sentiment understanding ability.
[0121] Figure 5 A schematic diagram of the process of obtaining the start context representation and the end context representation of words in a spliced sequence is shown in a classification method according to an embodiment of the present disclosure. Figure 5 As shown, in the embodiment, obtaining the start context representation and the end context representation of the word in the spliced sequence includes:
[0122] Step S502: constructing a multi-word representation model using a bidirectional encoder representation and a feedforward neural network;
[0123] Step S504: using a multi-word representation modeling model to obtain the start context representation and the end context representation of the words in the concatenated sequence.
[0124] In an embodiment, a multi-word representation modeling model is constructed using a bidirectional encoder representation BERT and a feedforward neural network; wherein, BERT (Bidirectional Encoder Representation from Transformers) is a pre-trained language model. BERT aims to pre-train deep bidirectional representations by jointly adjusting the left and right contexts in all layers. Using the constructed multi-word representation modeling model, the start context representation and end context representation of the words in the spliced sequence are obtained. The above-mentioned "word" refers to a single word in a sentence, and a word consists of one or more characters.
[0125] In the embodiment, the start context representation and the end context representation of the word in the spliced sequence are obtained as follows:
[0126]
[0127] Where BERT(·) is the operation represented by the bidirectional encoder; W start 、W end 、b start and bend Parameters of the model for modeling multi-word representations; The context representation of the i-th word in the concatenated sequence output by the bidirectional encoder representation; The starting context representation of the i-th word in the concatenated sequence output by the multi-word representation modeling model; The ending context representation of the i-th word in the concatenated sequence output by the multi-word representation modeling model.
[0128] Figure 6 A schematic diagram of the process of determining the fusion emotion table according to a classification method in an embodiment of the present disclosure is shown. Figure 6 As shown, in the embodiment, determining the fusion sentiment table based on the start context representation and the end context representation of the words in the spliced sequence includes:
[0129] Step S602: constructing a multi-word perception sentiment table generation model;
[0130] Step S604: inputting the start context representation and the end context representation of the words in the concatenated sequence into a multi-word perception sentiment table generation model to generate a multi-word perception sentiment table with different sentiment polarities and different sentiment intensities;
[0131] Step S606: Fusing the sentiment tables of multiple words with different sentiment polarities and different sentiment intensities to determine a fused sentiment table.
[0132] Determining the fusion emotion table is divided into two steps. The first step is to generate the emotion table, which specifically includes: building a multi-word-aware emotion table generation model, obtaining the start context representation of the start position word and the end context representation of the end position word in the start context representation and the end context representation of the word in the spliced sequence, inputting them into the multi-word-aware emotion table generation model, and generating a multi-word-aware emotion table in which each word contains different emotion intensities with respect to different emotion polarities.
[0133] The multi-word-aware sentiment table generation model can effectively utilize span-level multi-word information to generate multi-word-aware sentiment tables with different sentiment polarities and different sentiment intensities.
[0134] In the embodiment, a sentiment table of multiple words with different sentiment polarities and different sentiment intensities is generated as follows:
[0135]
[0136] Where σ(·) is the sigmoid function; is the outer product operation; sd(i,j) is the table feature of the span between word i and word j; The starting context representation of the i-th word in the concatenated sequence output by the multi-word representation modeling model; W is the ending context representation of the i-th word in the concatenated sequence output by the multi-word representation modeling model; pos 、W neg 、W neu 、b pos 、b neg and b neu Parameters for generating a model for multi-word-aware sentiment tables; table pos (i, j) is the emotional intensity of the positive emotion span between word i and word j in the multi-word perceived emotion table of positive emotion; neg (i, j) is the emotional intensity of the negative emotion between word i and word j in the multi-word perception emotional table of negative emotion; neu (i, j) is the emotional intensity of the neutral emotion between word i and word j in the multi-word perception emotional table of neutral emotion; pos (i,j),table neg (i,j) and table neu (i, j) constitutes a sentiment table of multiple words with different sentiment polarities and different sentiment intensities.
[0137] Through the above calculation table pos (i,j),table neg (i,j) and table neu (i, j), get the overall positive sentiment multi-word perception sentiment table pos , Multi-word perception of overall negative sentiment table neg , the overall neutral sentiment multi-word perception sentiment table neu .
[0138] Figure 7 A schematic diagram of a specific process of determining a fusion emotion table according to a classification method in an embodiment of the present disclosure is shown. Figure 7 As shown, in the embodiment, the sentiment tables of multiple words with different sentiment polarities and different sentiment intensities are fused to determine the fused sentiment table, including:
[0139] Step S702: performing a maximum pooling operation on the sentiment table of multiple words with different sentiment polarities and different sentiment intensities to determine the maximum pooled sentiment table;
[0140] Step S704: performing concatenation and fusion on the emotion tables after maximum pooling to determine a fused emotion table.
[0141] The above-generated multi-word perception emotion tables with different emotion polarities and different emotion intensities are subjected to maximum operations respectively to obtain multiple emotion tables after maximum pooling; the multiple emotion tables after maximum pooling are spliced and fused to obtain a fused emotion table.
[0142] By modeling span-level multi-word expressions in sentences, the model can learn more accurate and informative sentiment representations, enabling the model to capture more comprehensive attribute sentiment expressions.
[0143] In the embodiment, the fusion emotion table is determined as follows:
[0144]
[0145] Among them, max_pooling(·) is the maximum pooling operation; table pos A sentiment table for multi-word perception of positive sentiment; table neg A sentiment table for multi-word perception of negative sentiment; table neu Sentiment table for multi-word perception of neutral sentiment; The sentiment table value of the multi-word perception of the overall positive sentiment after maximum pooling; The sentiment table value of the multi-word perception of the overall negative sentiment after maximum pooling; is the sentiment table value of the multi-word perception of the overall neutral sentiment after the maximum pooling; formula [table pos ;table neg ;table neu The symbol ";" in ] is the splicing and fusion operation; table fusion A fused emotion table that integrates multiple emotion intensities with different emotion polarities.
[0146] This embodiment innovatively considers and models the span multi-word expression information in the sentence, proposes a multi-word-aware sentiment table generation model, and fuses the multi-word-aware sentiment tables containing different sentiment intensities with respect to different sentiment polarities to determine the fused sentiment table. It can effectively integrate the span-level multi-word expression information in the sentence into the sentiment table feature construction, aggregation and sentiment polarity prediction, overcoming the problem that the existing attribute-level sentiment classification method has not yet effectively modeled and aggregated the span-level multi-word expression information, enabling the model to learn more accurate and more informative sentiment representations, thereby improving the model's ability to capture attribute-level sentiment expressions and the model's performance.
[0147] The emotional tables are fused to determine whether the fused emotional table can effectively aggregate the emotional table features of multiple words with different emotional polarities, generate an emotional table that integrates multiple emotional intensities with different emotional polarities, and further improve the model's ability to model emotional semantics.
[0148] Figure 8 A schematic diagram of a classification process for determining the sentiment polarity of attribute words in an input text is shown in a classification method according to an embodiment of the present disclosure. Figure 8 As shown, in the embodiment, the sentiment prediction classification model includes: a linear layer and a function processing layer;
[0149] Input the fused sentiment table into the sentiment prediction classification model to determine the sentiment polarity classification of the attribute words in the input text, including:
[0150] Step S802: Input the fused emotion table into the linear layer of the emotion prediction classification model to determine the emotion table features that fuse multiple emotion intensities of different emotion polarities;
[0151] Step S804: using the function processing layer to perform sentiment polarity distribution analysis on the sentiment table features that integrate multiple sentiment intensities of different sentiment polarities, and determine the sentiment polarity classification of the attribute words in the input text.
[0152] The function processing layer of the sentiment prediction classification model adopts the softmax function, that is, the sentiment prediction classification model consists of a linear layer and a softmax function. The fused sentiment table that integrates multiple sentiment intensities with different sentiment polarities is input into the linear layer of the sentiment prediction classification model, and the sentiment table features that integrate multiple sentiment intensities with different sentiment polarities are output; the sentiment table features that integrate multiple sentiment intensities with different sentiment polarities are input into the softmax function for sentiment polarity distribution analysis to determine the sentiment polarity classification of the attribute words in the input text.
[0153] The attribute-level sentiment classification scheme with data enhancement and span-level multi-word perception provided in this embodiment overcomes the problem that existing methods ignore the use of large-model data enhancement to obtain more high-quality labeled data in the field and to make the distribution of different sentiment polarities more even. It also makes up for the problem that the span-level multi-word expression in the sentence and the sentiment constraints between different sentiment polarities have not been effectively integrated into the model, improves the performance of the attribute-level sentiment classification model, and can more accurately identify the sentiment polarity of specific attribute words in the sentence.
[0154] In the embodiment, the sentiment polarity classification of the attribute words in the input text is determined as follows:
[0155]
[0156] Among them, W s and b s Parameters of the sentiment prediction classification model; table fusion It is a fusion emotion table that integrates multiple emotion intensities with different emotion polarities; h sThe emotional table feature of multiple emotional intensities with different emotional polarities is obtained after linear layer processing; Classify the sentiment polarity of attribute words in the input text.
[0157] Figure 9 A schematic diagram of the training process of the emotion prediction classification model shown in a classification method in an embodiment of the present disclosure is shown in FIG. Figure 9 As shown, in the embodiment, the training process of the emotion prediction classification model includes:
[0158] Step S902: determining the sentiment consistency check loss based on the sentiment table of multiple words with different sentiment polarities and different sentiment intensities;
[0159] Step S904: Determine the sentiment polarity cross entropy loss based on the sentiment polarity classification of the enhanced text and the attribute words;
[0160] Step S906: determining a loss function according to the sentiment consistency check loss and the sentiment polarity cross entropy loss;
[0161] Step S908: training the sentiment prediction classification model according to the loss function.
[0162] In an embodiment, during the training process of the sentiment prediction classification model, it is necessary to improve the performance of the multi-word perceived sentiment table with different sentiment polarities and different sentiment intensities, so the span-level multi-word sentiment consistency calibration stage is added to further improve the performance of the model as a whole. For a given attribute word in a sentence, the sentiment intensity exhibited by a span composed of multiple words at different sentiment polarities should be different. The multi-word perceived sentiment table with different sentiment polarities and different sentiment intensities is received as input, and the difference between any two multi-word perceived sentiment tables with different sentiment polarities is maximized, thereby ensuring that each span composed of multiple words cannot simultaneously obtain a high sentiment intensity on the multi-word perceived sentiment tables with different sentiment polarities, and the sentiment consistency verification loss l is calculated. sr For the enhanced text obtained through data augmentation, the sentiment polarity classification of the attribute words is combined to calculate the sentiment polarity cross entropy loss. The loss function is determined based on the sentiment consistency check loss and the sentiment polarity cross entropy loss. The sentiment prediction classification model is trained based on the loss function. When the loss function reaches the target value, the training of the sentiment prediction classification model is completed.
[0163] In the embodiment, the sentiment consistency check loss is determined as follows:
[0164]
[0165] Among them, l sris the sentiment consistency check loss; K is the number of sentiment tables with different sentiment polarities; ||·|| is the sum of the squares of the absolute values of each element in the calculation matrix; table c and table c′ Sentiment table for any two multi-word perceptions with different sentiment polarities.
[0166] In the embodiment, the loss function is determined as follows:
[0167]
[0168] Among them, l is the loss function; D is the enhanced text; l sr is the sentiment consistency verification loss; is the sentiment polarity classification of attribute word y; λ is the hyperparameter of the model; e f is the sentiment polarity cross entropy loss.
[0169] This embodiment provides a span-level multi-word sentiment consistency calibration stage, which can effectively inject the constraint relationship between different sentiment polarities into the sentiment table, and can effectively maximize the difference between the multi-word perceived sentiment tables of different sentiment polarities, overcoming the problem that the sentiment constraints between different sentiment polarities have not been effectively integrated into the model, improving the performance of the multi-word perceived sentiment tables of different sentiment polarities, and improving the overall performance of the model.
[0170] The disclosed embodiments can be widely applied in text classification, such as customer service scenarios, review analysis scenarios, smart judicial scenarios, and smart education scenarios.
[0171] The disclosed embodiment provides an attribute-level sentiment classification solution that applies the classification method of the present application. The solution mainly consists of a sentiment text enhancement module, a multi-word representation modeling module, a multi-word-aware sentiment table generation module, a sentiment table aggregation module, a span-level multi-word sentiment consistency calibration module, and a sentiment prediction module. The sentiment text enhancement module is used to generate more high-quality labeled data and make the data distribution of different sentiment polarities more balanced. The multi-word representation modeling module is used to obtain the start context representation and end context representation of each word in the sentence. The multi-word-aware sentiment table generation module is used to generate a multi-word-aware sentiment table with different sentiment intensities for different sentiment polarities. The sentiment table aggregation module is used to aggregate sentiment tables with different sentiment polarities to obtain a sentiment table that integrates multiple sentiment intensities of different sentiment polarities. The span-level multi-word sentiment consistency calibration module is used to calibrate the sentiment intensities of each word in the sentence on different sentiment polarity tables to remain different and have a large difference. The sentiment prediction module is used to output the sentiment polarity of a specific attribute word in the sentence.
[0172] Figure 10A model framework diagram of a classification method in an embodiment of the present disclosure is shown as follows: Figure 10 As shown, the main steps include:
[0173] The sentence is input into the emotional text enhancement module. The attribute emotional text generation module generates text with the same attribute words and emotional polarity as the input sentence. The attribute emotional verification module verifies whether the generated sentence is consistent with the original sentence in terms of attribute words and emotional expression. The attribute emotional correction module corrects sentences that fail the attribute emotional verification. The sentence output by the attribute emotional correction module is input into the attribute emotional verification module for further verification until it passes the attribute emotional verification. The text enhancement module can thus output high-quality enhanced text with different emotional polarities.
[0174] The sentence and attribute words are concatenated and input into the multi-word representation modeling module to obtain the start context representation and end context representation of each word in the sentence.
[0175] The obtained start context representation and end context representation of each word are input into the multi-word perception sentiment table generation module to generate a multi-word perception sentiment table with different sentiment polarities and different sentiment intensities for each word.
[0176] The sentiment table containing multiple words with different sentiment intensities and different sentiment polarities for each word in the sentence is input into the sentiment table aggregation module to generate a sentiment table that integrates multiple sentiment intensities with different sentiment polarities.
[0177] The obtained multi-word perception sentiment table containing different sentiment intensities of different sentiment polarities is input into the span-level multi-word sentiment consistency calibration module, so that the sentiment intensity of each word in the sentence has a large difference in different sentiment polarity tables. By designing multiple loss functions as the training targets of the model, the model has better sentiment modeling capabilities and improves the sentiment classification performance of the model.
[0178] The obtained sentence's sentiment table that integrates multiple sentiment intensities of different sentiment polarities is input into the sentiment prediction module, and the sentiment polarity of the specific attribute words in the sentence is output.
[0179] The emotional text enhancement module generates more high-quality annotated data based on existing text data and balances the data distribution between different emotional polarities in the original text data. The emotional text enhancement module primarily consists of an attribute emotional text generation module, an attribute emotional verification module, and an attribute emotional correction module. The attribute emotional text generation module primarily consists of a large model, used to generate text with the same attribute words and emotional polarity as the input sentence. Before generation, the number of each emotional polarity in the existing text data is counted. Based on the set target number of text for each emotional polarity, the number of texts to be generated for each emotional polarity is determined. During the generation process, the original text is concatenated into prompt words, such as "As a text generation expert, please analyze the attribute words and emotional polarity of the provided text, generate a reformulated text with the same attribute words and emotional polarity, and ensure emotional consistency with the provided text. The provided text is: <text>. Output reformulated text:", where <text> is a sentence in the original data.
[0180] The attribute sentiment verification module primarily consists of a large model, which is used to verify whether the generated sentence is consistent with the original sentence in terms of attribute terms and sentiment expression, and to provide corresponding explanations. The original text and the text generated by the attribute sentiment text generation module are concatenated to form prompt words. For example, "As a text verification expert, please score the provided original text and the generated text for comparison. The score ranges from 0 to 5, where 0 indicates a complete inconsistency between the attribute terms and the corresponding sentiment polarity, and 5 indicates a complete consistency between the attribute terms and the corresponding sentiment polarity. Original text: <Original text>. Generated text for comparison: <Generated text for comparison>. Please output the scoring results in JSON format and provide corresponding explanations." Here, <Original text> is the original sentence input to the attribute sentiment text generation module, and <Generated text for comparison> is the generated sentence to be compared, that is, the sentence generated by the attribute sentiment text generation module or the attribute sentiment correction module. The spliced prompt words are input into the large model, and the large model outputs the scoring results (0-5 points) and the corresponding explanations. The generated text with a score between 4-5 points is high-quality annotation data and is put into the text data. The generated text with a score between 0-3 points is low-quality text data and needs to be regenerated.
[0181] The attribute sentiment correction module, primarily composed of a large model, is used to correct low-quality generated text data. The low-quality text data, corresponding explanations, and original text are concatenated to form prompts. For example, "As a text correction expert, please regenerate high-quality text data based on the low-quality text, corresponding explanations, and original text, so that the attribute words and their corresponding sentiment polarities in the generated sentences are the same as those in the original text. Low-quality text: <Low-quality text data>. Corresponding explanation: <Corresponding explanation>. Original text: <Original text>. Output: ", where <Low-quality text data> is the low-quality text data to be corrected, <Corresponding explanation> is the corresponding explanation of the low-quality text output by the attribute sentiment verification module, and <Original text> is the original text input. The sentence output by the attribute sentiment correction module is then fed back into the attribute sentiment verification module until the generated text passes verification.
[0182] After all the data are generated, the sentences and attribute words are concatenated.
[0183] In the multi-word representation modeling module, BERT and a feedforward neural network are used to obtain the start context representation and end context representation of a word.
[0184] The multi-word-aware sentiment table generation module receives the start context representation of the start position word and the end context representation of the end position word in the span-level multi-word representation as input, and generates a multi-word-aware sentiment table with different sentiment intensities implied for each word with different sentiment polarities.
[0185] The sentiment table aggregation module receives multi-word-aware sentiment tables of different sentiment polarities as input and generates a sentiment table that integrates multiple sentiment intensities of different sentiment polarities.
[0186] The span-level multi-word sentiment consistency calibration module is used to further improve the performance of the multi-word-aware sentiment tables with different sentiment intensities at different sentiment polarities generated by the multi-word-aware table generation module, thereby further improving the overall performance of the model. For a given attribute word in a sentence, the sentiment intensities exhibited by a span consisting of multiple words at different sentiment polarities should be different. The span-level multi-word sentiment consistency calibration module receives as input the multi-word-aware sentiment tables with different sentiment intensities at different sentiment polarities generated by the multi-word-aware sentiment table generation module, and maximizes the difference between any two multi-word-aware sentiment tables with different sentiment polarities, thereby ensuring that each span consisting of multiple words cannot simultaneously obtain high sentiment intensities at different sentiment polarities.
[0187] The sentiment table that integrates multiple sentiment intensities with different sentiment polarities is input into the sentiment prediction module, and the sentiment polarity of the specific attribute words in the sentence is output.
[0188] In this embodiment, large-scale model data augmentation is explicitly considered to obtain more high-quality labeled data within the domain and to make the distribution of different sentiment polarities more uniform. This method can effectively integrate large-scale model data augmentation methods for obtaining more high-quality labeled data within the domain and making the distribution of different sentiment polarities more uniform into attribute sentiment polarity prediction, overcoming the problem that existing attribute-level sentiment classification methods have not yet effectively integrated large-scale model-based data augmentation methods into attribute sentiment classification. Through large-scale model-based data augmentation, the amount of high-quality labeled data within the domain can be increased and the distribution of data with different sentiment polarities can be more balanced, enabling the model to learn more comprehensive sentiment knowledge and improve the model's sentiment understanding ability. Secondly, this method explicitly considers and models the span-level multi-word expression information in the sentence. This method can effectively integrate the span-level multi-word expression information in the sentence into the construction, aggregation, and sentiment polarity prediction of sentiment table features, overcoming the problem that existing attribute-level sentiment classification methods have not yet effectively modeled and aggregated span-level multi-word expression information. This enables the model to learn more accurate and more informative sentiment representations, improving the model's ability to capture attribute-level sentiment expressions and the model's performance.
[0189] The module includes an attribute sentiment text generation module, an attribute sentiment verification module, an attribute sentiment correction module, a multi-word-aware sentiment table generation module, a sentiment table aggregation module, and a span-level multi-word sentiment consistency calibration module. The attribute-level sentiment text generation module effectively utilizes raw text to increase the amount of labeled data within the domain and to more evenly distribute data of different sentiment polarities. The attribute sentiment verification module effectively analyzes whether the generated attribute sentiment text data is high-quality labeled data and provides relevant explanations. The attribute sentiment correction module effectively converts low-quality attribute sentiment text data into high-quality attribute sentiment text data, thereby improving the ability to generate high-quality labeled data within the domain. The multi-word-aware sentiment table generation module effectively utilizes span-level multi-word information to generate multi-word-aware sentiment tables of different sentiment polarities and with different sentiment intensities. The sentiment table aggregation module effectively aggregates the features of multi-word-aware sentiment tables of different sentiment polarities to generate a sentiment table that integrates multiple sentiment intensities of different sentiment polarities, further improving the model's ability to model sentiment semantics. The span-level multi-word sentiment consistency calibration module can effectively inject the constraint relationship between different sentiment polarities into the sentiment table, effectively maximize the difference between multi-word perceived sentiment tables of different sentiment polarities, further improve the performance of multi-word perceived sentiment tables of different sentiment polarities, and improve the overall performance of the model.
[0190] It should be noted that the acquisition, storage, use, and processing of data in the technical solution disclosed herein are in compliance with the relevant provisions of national laws and regulations. Various types of data such as personal identity data, operation data, behavioral data, etc. related to individuals, customers, and groups obtained in the embodiments of the present disclosure have been authorized.
[0191] Based on the same inventive concept, the present disclosure also provides a classification device, as described in the following embodiments. Since the principle of solving the problem in the device embodiment is similar to that in the above method embodiment, the implementation of the device embodiment can refer to the implementation of the above method embodiment, and the repeated parts will not be repeated.
[0192] Figure 11 A schematic diagram of a classification device in an embodiment of the present disclosure is shown. Figure 11 As shown, the device includes:
[0193] The emotional text enhancement module 1101 is used to perform data enhancement on the input text and splice attribute words to determine the splicing sequence;
[0194] A multi-word representation modeling module 1102 is used to obtain the start context representation and the end context representation of the words in the concatenated sequence;
[0195] A fusion sentiment table determination module 1103 is configured to determine a fusion sentiment table based on the start context representation and the end context representation of the words in the concatenated sequence;
[0196] The sentiment prediction module 1104 is used to input the fused sentiment table into the sentiment prediction classification model to determine the sentiment polarity classification of the attribute words in the input text.
[0197] It should be noted that the aforementioned emotional text enhancement module 1101, multi-word representation modeling module 1102, fused emotional table determination module 1103, and emotional prediction module 1104 correspond to S202 to S208 in the method embodiment. The examples and application scenarios implemented by the aforementioned modules and corresponding steps are the same, but are not limited to the contents disclosed in the aforementioned method embodiment. It should be noted that the aforementioned modules, as part of the apparatus, can be executed in a computer system, such as a set of computer-executable instructions.
[0198] Those skilled in the art will appreciate that various aspects of the present disclosure may be implemented as systems, methods, or program products. Therefore, various aspects of the present disclosure may be implemented in the following forms: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, which may be collectively referred to herein as "circuits," "modules," or "systems."
[0199] Refer to the following Figure 1212 is a diagram to describe the electronic device 1200 according to this embodiment of the present disclosure. Figure 12 The electronic device 1200 shown is merely an example and should not limit the functions and scope of use of the embodiments of the present disclosure.
[0200] like Figure 12 As shown, electronic device 1200 is implemented as a general-purpose computing device. Components of electronic device 1200 may include, but are not limited to, the aforementioned at least one processing unit 1210, the aforementioned at least one storage unit 1220, and a bus 1230 connecting various system components (including storage unit 1220 and processing unit 1210).
[0201] The storage unit stores a program code, and the program code can be executed by the processing unit 1210, so that the processing unit 1210 performs the steps described in the "Exemplary Method" section of this specification according to various exemplary embodiments of the present disclosure. For example, the processing unit 1210 can perform the following steps of the above method embodiment: perform data enhancement on the input text and splice attribute words to determine a splicing sequence; obtain the start context representation and end context representation of the words in the splicing sequence; determine a fused sentiment table based on the start context representation and end context representation of the words in the splicing sequence; input the fused sentiment table into the sentiment prediction classification model to determine the sentiment polarity classification of the attribute words in the input text.
[0202] The storage unit 1220 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 12201 and / or a cache memory unit 12202 , and may further include a read-only memory unit (ROM) 12203 .
[0203] The storage unit 1220 may also include a program / utility 12204 having a set (at least one) of program modules 12205, such program modules 12205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0204] The bus 1230 may represent one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0205] Electronic device 1200 can also communicate with one or more external devices 1240 (e.g., a keyboard, pointing device, Bluetooth device, etc.), one or more devices that enable a user to interact with electronic device 1200, and / or any device that enables electronic device 1200 to communicate with one or more other computing devices (e.g., a router, modem, etc.). Such communication can occur via input / output (I / O) interface 1250. Furthermore, electronic device 1200 can communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network such as the Internet) via network adapter 1260. As shown, network adapter 1260 communicates with other modules of electronic device 1200 via bus 1230. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with electronic device 1200, including but not limited to microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0206] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
[0207] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart may be implemented as a computer program product, which includes: a computer program, which implements the above classification method when executed by a processor.
[0208] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided. The computer-readable storage medium may be a readable signal medium or a readable storage medium. A program product capable of implementing the above-mentioned method of the present disclosure is stored thereon. In some possible implementations, various aspects of the present disclosure may also be implemented in the form of a program product, which includes program code. When the program product is run on a terminal device, the program code is used to cause the terminal device to execute the steps according to various exemplary embodiments of the present disclosure described in the "Exemplary Methods" section above of this specification.
[0209] More specific examples of computer-readable storage media in the present disclosure may include, but are not limited to, an electrical connection having one or more conductors, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), optical fibers, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0210] In the present disclosure, a computer-readable storage medium may include a data signal propagated in baseband or as part of a carrier wave, which carries readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium that can transmit, propagate, or transfer a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0211] Alternatively, the program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination thereof.
[0212] In a specific implementation, the program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, and the like, as well as conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a standalone software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0213] It should be noted that although several modules or units of the device for action execution are mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be concretized in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be concretized.
[0214] Furthermore, although the steps of the method of the present disclosure are described in a particular order in the accompanying drawings, this does not require or imply that the steps must be performed in this particular order, or that all steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.
[0215] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
[0216] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the appended claims.
Claims
1. A classification method, characterized in that include: Perform data augmentation on the input text and concatenate attribute words to determine the concatenation sequence; Obtaining a start context representation and an end context representation of a word in the concatenated sequence; Determining a fused sentiment table according to the start context representation and the end context representation of the words in the concatenated sequence; Inputting the fused sentiment table into a sentiment prediction classification model to determine the sentiment polarity classification of the attribute words in the input text; The step of determining the fused sentiment table based on the start context representation and the end context representation of the words in the concatenated sequence includes: Construct a multi-word-aware sentiment table generation model; Inputting the start context representation and the end context representation of the words in the concatenated sequence into a multi-word perceived sentiment table generation model to generate a multi-word perceived sentiment table with different sentiment polarities and different sentiment intensities; Performing a maximum pooling operation on the multi-word perception sentiment table with different sentiment polarities and different sentiment intensities to determine a maximum pooled sentiment table; The emotion tables after the maximum pooling are spliced and fused to determine a fused emotion table.
2. The classification method according to claim 1, characterized in that Perform data enhancement on the text and concatenate attribute words to determine the concatenation sequence, including: Performing data enhancement on the input text to determine enhanced text; wherein the enhanced text includes a plurality of sentences; Attribute words of the enhanced text are extracted, multiple sentences in the enhanced text are spliced with the attribute words, and a splicing sequence including sentence contexts and attribute words is determined.
3. The classification method according to claim 2, characterized in that For text data enhancement, determine the enhanced text, including: Input the input text into the large model for data enhancement and determine the first text; Using the large model, verify the similarity between the attribute words and sentiment polarity of the first text and the attribute words and sentiment polarity of the input text; If the similarity between the attribute words and sentiment polarity of the first text verified by the large model and the attribute words and sentiment polarity of the input text does not meet the similarity threshold, the first text is corrected using the large model until the similarity between the attribute words and sentiment polarity of the first text and the attribute words and sentiment polarity of the input text meets the similarity threshold, and the first text is determined to be an enhanced text.
4. The classification method according to claim 1, characterized in that Obtaining a start context representation and an end context representation of a word in the concatenated sequence, including: Build a multi-word representation model using bidirectional encoder representation and feedforward neural network; The multi-word representation modeling model is used to obtain the start context representation and the end context representation of the words in the spliced sequence.
5. The classification method according to claim 4, characterized in that: Obtain the start context representation and the end context representation of the words in the concatenated sequence in the following manner: Where BERT(·) is the operation represented by the bidirectional encoder; W start 、W end 、b start and b end Parameters of the model for modeling multi-word representations; The context representation of the i-th word in the concatenated sequence output by the bidirectional encoder representation; The starting context representation of the i-th word in the concatenated sequence output by the multi-word representation modeling model; The ending context representation of the i-th word in the concatenated sequence output by the multi-word representation modeling model.
6. The classification method according to claim 1, characterized in that Generate a sentiment table of multiple words with different sentiment polarities and different sentiment intensities as follows: table pos (i,j)=W pos sd(i,j)+b pos table neg (i,j)=W neg sd(i,j)+b neg table neu (i,j)=W neu sd(i,j)+b neu Where σ(·) is the sigmoid function; is the outer product operation; sd(i,j) is the table feature of the span between word i and word j; The starting context representation of the i-th word in the concatenated sequence output by the multi-word representation modeling model; W is the ending context representation of the i-th word in the concatenated sequence output by the multi-word representation modeling model; pos 、W neg 、W neu 、b pos 、b neg and b neu Parameters for generating a model for multi-word-aware sentiment tables; table pos (i, j) is the emotional intensity of the positive emotion span between word i and word j in the multi-word perceived emotion table of positive emotion; neg (i, j) is the emotional intensity of the negative emotion between word i and word j in the multi-word perception emotional table of negative emotion; neu (i, j) is the emotional intensity of the neutral emotion between word i and word j in the multi-word perception emotional table of neutral emotion; pos (i,j),table neg (i,j) and table neu (i, j) constitutes a sentiment table of multiple words with different sentiment polarities and different sentiment intensities.
7. The classification method according to claim 1, characterized in that Determine the fusion emotion table as follows: Among them, max_pooling(·) is the maximum pooling operation; table pos A sentiment table for multi-word perception of positive sentiment; table neg A sentiment table for multi-word perception of negative sentiment; table neu Sentiment table for multi-word perception of neutral sentiment; The sentiment table value of the multi-word perception of the overall positive sentiment after maximum pooling; The sentiment table value of the multi-word perception of the overall negative sentiment after maximum pooling; is the sentiment table value of the multi-word perception of the overall neutral sentiment after the maximum pooling; formula [table pos ;table neg ;table neu ] in the symbol; for splicing and fusion operations; table fusion A fused emotion table that integrates multiple emotion intensities with different emotion polarities.
8. The classification method according to claim 1, characterized in that: The emotion prediction classification model includes: a linear layer and a function processing layer; Inputting the fused sentiment table into a sentiment prediction classification model to determine the sentiment polarity classification of the attribute words in the input text includes: Inputting the fused emotion table into the linear layer of the emotion prediction classification model to determine the emotion table features that fuse multiple emotion intensities of different emotion polarities; A function processing layer is used to perform sentiment polarity distribution analysis on the sentiment table feature integrating multiple sentiment intensities of different sentiment polarities, and to determine the sentiment polarity classification of the attribute words in the input text.
9. The classification method according to claim 8, characterized in that: Determine the sentiment polarity classification of the attribute words in the input text in the following manner: h s =W s table fusion +b s Among them, W s and b s Parameters of the sentiment prediction classification model; table fusion It is a fusion emotion table that integrates multiple emotion intensities with different emotion polarities; h s The emotional table feature of multiple emotional intensities with different emotional polarities is obtained after linear layer processing; Classify the sentiment polarity of attribute words in the input text.
10. The classification method according to claim 1, characterized in that: The training process of the emotion prediction classification model includes: Determine the sentiment consistency check loss based on a sentiment table of multiple words with different sentiment polarities and different sentiment intensities; Determine the sentiment polarity cross entropy loss based on the sentiment polarity classification of the enhanced text and attribute words; Determining a loss function according to the sentiment consistency check loss and the sentiment polarity cross entropy loss; The emotion prediction classification model is trained according to the loss function.
11. The classification method according to claim 10, characterized in that: The sentiment consistency check loss is determined as follows: Among them, l sr is the sentiment consistency check loss; K is the number of sentiment tables with different sentiment polarities; ||·|| is the sum of the squares of the absolute values of each element in the calculation matrix; table c and table c′ Sentiment table for any two multi-word perceptions with different sentiment polarities.
12. The classification method according to claim 10, characterized in that: The loss function is determined as follows: l=l f +λl sr Among them, l is the loss function; D is the enhanced text; l sr is the sentiment consistency verification loss; is the sentiment polarity classification of attribute words; λ is the hyperparameter of the model; l f is the sentiment polarity cross entropy loss.
13. A classification device, characterized in that: include: The emotional text enhancement module is used to perform data enhancement on the input text, splice attribute words, and determine the splicing sequence; A multi-word representation modeling module, configured to obtain a start context representation and an end context representation of the words in the concatenated sequence; A fusion sentiment table determination module is used to determine a fusion sentiment table based on the start context representation and the end context representation of the words in the spliced sequence; A sentiment prediction module, configured to input the fused sentiment table into a sentiment prediction classification model to determine the sentiment polarity classification of the attribute words in the input text; Among them, the fused emotion table determination module is also used to: construct a multi-word perceived emotion table generation model; input the start context representation and the end context representation of the words in the splicing sequence into the multi-word perceived emotion table generation model to generate a multi-word perceived emotion table with different emotion polarities and different emotion intensities; perform a maximum pooling operation on the multi-word perceived emotion table with different emotion polarities and different emotion intensities to determine the emotion table after maximum pooling; perform splicing and fusion on the emotion table after maximum pooling to determine the fused emotion table.
14. An electronic device, characterized in that: include: processor; as well as a memory for storing executable instructions of the processor; The processor is configured to perform the classification method according to any one of claims 1 to 12 by executing the executable instructions.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the classification method according to any one of claims 1 to 12 is implemented.
16. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the classification method according to any one of claims 1 to 12 is implemented.
Citation Information
Patent Citations
Chinese attribute level sentiment analysis method, system and equipment based on multi-task learning and medium
CN116029305A
Text-based sentiment classification method and apparatus, and computer device and storage medium
WO2023134083A1