Classification method and device, storage medium and electronic equipment
By enhancing data and splicing attribute words on the input text, obtaining and fusing emotional representations, the problems of insufficient labeling data and neglecting span-level multi-word expression in attribute-level emotion classification are solved, and the accuracy and model performance of emotional polarity classification are improved .
Patent Information
- Application Number
- CN202411365394.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2044-09-27
AI Technical Summary
The existing attribute-level emotion classification method is not effective in identifying the emotional polarity of attribute words, mainly due to the lack of high-quality labeling data and uneven distribution of data, and the ignorance of the span-level multi-word expression in the sentence to model emotions. The effect leads to a high classification error rate.
By data augmenting the input text and splicing attribute words, obtaining the start and end context representation of the word, fusing the emotion table, and entering it into the emotion prediction classification model to improve the accuracy of emotion polarity classification.
Through data enhancement, more high-quality labeled data can be obtained, and emotional polarity distribution can be balanced, and span-level multi-word expression information can be effectively modeled and aggregated, which improves the model's emotional understanding ability and the ability to capture attribute-level emotional expressions, and achieves efficient and accurate Emotional polarity classification.
Smart Images

Figure CN119226517A_ABST
Abstract
Description
Background Art
[0002] Attribute-level sentiment analysis is a fine-grained sentiment analysis that aims to identify the sentiment polarity of attribute words that appear explicitly in a sentence. The sentiment polarity of attribute words is generally divided into positive, negative, and neutral. Compared with coarse-grained sentiment analysis, fine-grained attribute-level sentiment analysis can provide product providers or service providers with more comprehensive sentiment polarity about a certain attribute, thereby helping to improve the quality of products or services. Coarse-grained sentiment analysis cannot provide sentiment polarity about a specific attribute word. It generally assumes that the entire sentence or the entire document has only one sentiment polarity, and cannot handle the different sentiment polarities of complex 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 the 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 the 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 the practice of the present disclosure.
[0008] According to one aspect of the present disclosure, a classification method is provided, comprising:
[0009] Perform data enhancement 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 the words 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 and attribute words are concatenated to determine a concatenation sequence, 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 concatenated with the attribute words, and a concatenated sequence including sentence contexts and attribute words is determined.
[0016] In some embodiments, data enhancement is performed on text to determine the enhanced text, including:
[0017] Input the input text into the large model for data enhancement and determine the first text;
[0018] 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;
[0019] If the similarity between the attribute words and sentiment polarity of the first text and the attribute words and sentiment polarity of the input text verified by the large model 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 meet the similarity threshold, and the first text is determined as an enhanced text.
[0020] In some embodiments, obtaining the start context representation and the end context representation of the words in the concatenated sequence includes:
[0021] A multi-word representation model is constructed using bidirectional encoder representation and feed-forward neural network;
[0022] The multi-word representation model is used to obtain the start context representation and the end context representation of the words in the concatenated sequence.
[0023] In some embodiments, the start context representation and the end context representation of the words in the concatenated sequence are obtained in the following manner:
[0024]
[0025] Among them, 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; Represent the context representation of the i-th word in the concatenated sequence output by the bidirectional encoder; 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 according to 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 multi-word perceived emotion tables with different emotion polarities and different emotion intensities are fused to determine a fused emotion 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 , Wneu , b pos , b neg and b neu Parameters for generating a model for multi-word-aware sentiment tables; table pos (i, j) is the sentiment intensity of the positive sentiment span between word i and word j in the multi-word perceived sentiment table of positive sentiment; table neg (i, j) is the sentiment intensity of the negative sentiment span between word i and word j in the multi-word perceived sentiment table of negative sentiment; table neu (i, j) is the sentiment intensity of the neutral sentiment span between word i and word j in the multi-word perceived sentiment table of neutral sentiment; table 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, the sentiment tables of multiple words with different sentiment polarities and different sentiment intensities are merged to determine the merged sentiment table, including:
[0037] Performing a maximum pooling operation on the multi-word perceived 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 concatenated 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 Multi-word sentiment table for positive sentiment; table neg Multi-word perceived sentiment table for negative sentiment; table neu Sentiment table for multi-word perception of neutral sentiment; It is the multi-word perceived sentiment table value of the overall positive sentiment after maximum pooling; It is the multi-word perceived sentiment table value of the overall negative sentiment after maximum pooling; is the multi-word perceived sentiment table value of the overall neutral sentiment after maximum pooling; formula [table pos ;table neg ;table neu] in the symbol; for splicing and fusion operations; table fusion A fused emotion table that combines 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 of the fused emotion table with multiple emotion intensities of different emotion polarities;
[0045] The function processing layer is used to perform sentiment polarity distribution analysis on the sentiment table features of the multiple sentiment intensities fused with different sentiment polarities, so as 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 are the parameters of the sentiment prediction classification model; table fusion It is a fusion emotion table that integrates multiple emotion intensities with different emotion polarities; s It is the emotional table feature of multiple emotional intensities with different emotional polarities obtained through 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 multi-word perceived sentiment tables with different sentiment polarities; ||·|| is the sum of the absolute value squares of each element in the calculation matrix; table c and table c′ A 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 Verify loss for sentiment consistency; 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 and splice attribute words to determine the splicing sequence;
[0063] A multi-word representation modeling module, used to obtain the start context representation and the end context representation of the words in the concatenated sequence;
[0064] A fusion sentiment table determination module, used to determine a fusion sentiment table according to the start context representation and the end context representation of the words in the concatenated 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 also provided, which includes: 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, the classification method described in any one of the above 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 the end context representation of the words in the splicing sequence; determining the fused emotion table according to the start context representation and the end context representation of the words in the splicing sequence; inputting the fused emotion table into the emotion prediction classification model to determine the emotion polarity classification of the attribute words in the input text. The embodiments of the present disclosure explicitly consider obtaining more high-quality annotated data in the field and making the distribution of different emotion polarities more uniform through data enhancement, and can effectively integrate the data enhancement method for obtaining more high-quality annotated data in the field and making the distribution of different emotion polarities more uniform into the attribute emotion polarity prediction, overcoming the problem that the existing attribute-level emotion classification method has not yet effectively integrated the data enhancement method into the attribute emotion classification. Through data enhancement, the amount of high-quality annotated data in the field can be increased and the data distribution of different emotion polarities can be made more balanced, so that the model can learn more comprehensive emotion knowledge and improve the emotion understanding ability of the model. By obtaining the start context representation and end context representation of the words in the concatenated 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 methods have 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 ability to capture attribute-level sentiment expressions and the model's performance, and being able to more accurately identify the sentiment polarity of specific attribute words in a sentence, 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 present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] The accompanying drawings herein are incorporated into the specification 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 accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[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 in an embodiment of the present disclosure is shown.
[0075] Figure 4 A schematic diagram of a process of determining enhanced text in a classification method in an embodiment of the present disclosure is shown.
[0076] Figure 5 A schematic diagram showing a process of obtaining a start context representation and an end context representation of a word in a concatenated sequence in a classification method according to an embodiment of the present disclosure is shown.
[0077] Figure 6 A schematic diagram of a process of determining a fused sentiment table in a classification method in 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 in 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] Fig. 9 A schematic diagram showing the training process of a sentiment prediction classification model of a classification method in an embodiment of the present disclosure is shown.
[0081] Fig.10 A model framework diagram of a classification method in an embodiment of the present disclosure is shown.
[0082] Fig.11 A schematic diagram of a classification device in an embodiment of the present disclosure is shown.
[0083] Fig.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 implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the disclosure will be more comprehensive and complete and to 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 only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented 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. 2 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 may be a wired network or a wireless network.
[0089] Optionally, the wireless network or wired network described above uses standard communication technology and / or protocol. The network is usually the Internet, but it 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 dedicated 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 through 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) can also 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 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 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 device 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 this. 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 only for illustration, and any number of terminal devices, networks and servers may be provided according to actual needs, and the embodiments of the present disclosure do not limit this.
[0095] Under the above system architecture, a classification method is provided in an embodiment of the present disclosure, and the method 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 a 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 a 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 identify the sentiment polarity of attribute words through predefined rules and sentiment dictionaries. 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 are heavily dependent on the quality of manually designed features, and manually designing features is also a very time-consuming and laborious 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] There are still some deficiencies in the above schemes. For example, the above methods require a large amount of high-quality annotated data, but in some practical scenarios, there is often a lack of high-quality annotated data and the data distribution is uneven, which makes the model unable to perform well in identifying the sentiment polarity of attribute words. Secondly, most of these methods use words in sentences to model the sentiment polarity of attribute words, ignoring the role of span-level multi-word expressions in sentences in modeling the sentiment of attribute words.
[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 concatenating attribute words to determine a concatenation 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 according to 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 embodiment explicitly considers obtaining more high-quality annotated data in the field and making the distribution of different sentiment polarities more uniform through data enhancement, and can effectively integrate the data enhancement method of 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, overcoming the problem that the existing attribute-level sentiment classification method has not yet effectively integrated the data enhancement method into the attribute sentiment classification. Through data enhancement, the amount of high-quality annotated data in the field can be increased and the distribution of data of different sentiment polarities can be made more balanced, so that the model can 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 concatenated 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 methods have 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 ability to capture attribute-level sentiment expressions and the model's performance, and being able to more accurately identify the sentiment polarity of specific attribute words in a sentence, achieving efficient and accurate sentiment polarity classification.
[0105] Figure 3 A schematic diagram of the process of determining a 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 concatenated to determine the concatenation sequence, including:
[0106] Step S302: performing data enhancement on the input text to determine enhanced text; wherein the enhanced text includes a plurality of 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] The prior art ignores the use of large model data enhancement to obtain more high-quality annotated data in the field and to make the distribution of different sentiment polarities more even. The data enhancement method based on the large model has not been effectively integrated into the modeling of the attribute-level sentiment classification model. Through data enhancement based on the large model, the amount of high-quality annotated data in the field can be increased and the data distribution of different sentiment polarities can be more even, so that the model can learn more comprehensive sentiment knowledge. Input the input text into the large model for data enhancement, generate more high-quality annotated data, determine the enhanced text, and include multiple sentences in the enhanced text. The number of sentences in the enhanced text is set before the data enhancement is performed by the large model. For example, the input text includes 10 sentences, and the enhancement multiple is set to 10 times. Then, the enhanced text output by the large model includes 10×10=100 sentences. Extract the attribute words in the enhanced text, splice the multiple sentences in the enhanced text with the attribute words, and determine the splicing sequence containing the sentence context and the 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 the attribute word, [SEP] is set again to form a complete concatenation unit. The concatenated sequence containing the sentence context and the attribute word 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 (Large Model) involved in the embodiment refers to a machine learning model with a large number of parameters, complex structure, and usually trained on a large-scale data set. These models are designed to learn complex patterns in data and perform well in a variety of tasks. Such models have received widespread attention and application in many fields due to their powerful representation capabilities and wide application potential. Large Language Model (LLM) is a kind of large model. The basis for sentiment polarity classification based on the disclosure is a text formed by natural language. The large language model can process natural language tasks and achieve text enhancement.
[0110] Figure 4 A schematic diagram of a process of 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: inputting 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 as an enhanced text.
[0114] The input text is input into the large model for data enhancement to generate 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] The large model in the embodiment 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 sentiment polarity as the sentences contained in the input text. Before generation, the number of each sentiment polarity in the existing text data is counted, and the number of texts of each sentiment polarity to be generated is obtained according to the set target text number of each sentiment polarity. During the generation process, the original input text is spliced into prompt words, for example, "You are a text generation expert. Please analyze the attribute words and sentiment polarity according to the provided text, generate a reformulated text with the same attribute words and sentiment polarity, and ensure the sentiment 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] In the text verification stage, 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 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 original input text and the generated text for comparison. 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." Where <Original text> is the original input text input to the attribute emotional 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 the corresponding explanations. The generated text with a score between 4-5 points is high-quality annotation data, and 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, and 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] In the text correction stage, it is used to correct the generated low-quality text data. The low-quality text data, the corresponding explanation and the original text are spliced to form prompt words, such as "You are a text correction expert. Please regenerate high-quality text data based on the low-quality text, the corresponding explanation and the original text, so that the attribute words and their corresponding emotional polarity in the generated sentence are the same as 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, that is, the first text that does not meet the similarity threshold, <Corresponding explanation> is the corresponding explanation of the low-quality text output in the text verification stage, and <Original text> is the original input text input. The sentence output in the text correction stage is input into the text verification stage again until the similarity between the attribute words and emotional polarity of the first text and the attribute words and emotional polarity of the input text meets the similarity threshold, and the generated text passes the verification, and the first text that passes the 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, 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, and can effectively integrate the span-level multi-word expression information in the sentence into the sentiment table feature construction, aggregation and sentiment polarity prediction, and 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 give 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 ability to generate high-quality annotated data in the field.
[0120] This example innovatively considers obtaining more high-quality annotated data in the field and making the distribution of different sentiment polarities more even through large-model data enhancement. The three stages of text generation, text verification, and text correction proposed can effectively integrate the large-model data enhancement method of obtaining more high-quality annotated data in the field and making the distribution of different sentiment polarities more even into the attribute sentiment polarity prediction, overcoming the problem that the existing attribute-level sentiment classification method has not effectively integrated the large-model-based data enhancement method into the attribute sentiment classification. Through data generation, verification, and correction based on large models, the amount of high-quality annotated data in the field can be increased and the distribution of data of different sentiment polarities can be made more balanced, so that the model can learn more comprehensive sentiment knowledge and improve 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 concatenated 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 words in the concatenated sequence includes:
[0122] Step S502: construct a multi-word representation model using a bidirectional encoder representation and a feedforward neural network;
[0123] Step S504: using the multi-word representation modeling model, obtaining 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 the end context representation of the words in the concatenated sequence are obtained. The above-mentioned "word" refers to a single word in a sentence, and the word consists of one or more characters.
[0125] In the embodiment, the start context representation and the end context representation of the words in the concatenated sequence are obtained in the following manner:
[0126]
[0127] Among them, 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; Represent the context representation of the i-th word in the concatenated sequence output by the bidirectional encoder; 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 in a classification method according to an embodiment of the present disclosure is shown. Figure 6 As shown, in the embodiment, determining the fusion sentiment table according to the start context representation and the end context representation of the words in the concatenated sequence includes:
[0129] Step S602: constructing a multi-word-aware 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 the multi-word perceived sentiment table generation model to generate a multi-word perceived sentiment table with different sentiment polarities and different sentiment intensities;
[0131] Step S606: Fusing the multi-word perceived emotion tables with different emotion polarities and different emotion intensities to determine a fused emotion table.
[0132] Determining the fused sentiment table is divided into two steps. The first step is to generate the sentiment table, which specifically includes: constructing a multi-word-aware sentiment 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 concatenated sequence, inputting them into the multi-word-aware sentiment table generation model, and generating a multi-word-aware sentiment table in which each word contains different sentiment intensities with respect to different sentiment 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 sentiment intensity of the positive sentiment span between word i and word j in the multi-word perceived sentiment table of positive sentiment; table neg (i, j) is the sentiment intensity of the negative sentiment span between word i and word j in the multi-word perceived sentiment table of negative sentiment; table neu (i, j) is the sentiment intensity of the neutral sentiment span between word i and word j in the multi-word perceived sentiment table of neutral sentiment; table 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 perceived sentiment table of overall negative sentiment 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 multi-word perceived emotion table with different emotion polarities and different emotion intensities, and determining the emotion table after the maximum pooling;
[0140] Step S704: concatenate and fuse the emotion tables after the maximum pooling to determine a fused emotion table.
[0141] The above-generated multi-word perceived sentiment tables with different sentiment polarities and different sentiment intensities are subjected to maximum operations respectively to obtain multiple sentiment tables after maximum pooling; the multiple sentiment tables after maximum pooling are concatenated and fused to obtain a fused sentiment 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 Multi-word sentiment table for positive sentiment; table neg Multi-word perceived sentiment table for negative sentiment; table neu Sentiment table for multi-word perception of neutral sentiment; It is the multi-word perceived sentiment table value of the overall positive sentiment after maximum pooling; It is the multi-word perceived sentiment table value of the overall negative sentiment after maximum pooling; is the multi-word perceived sentiment table value of the overall neutral sentiment after maximum pooling; formula [table pos ;table neg ;table neu The symbol ";" in ] is a splicing and fusion operation; table fusion A fused emotion table that combines multiple emotion intensities with different emotion polarities.
[0146] This embodiment innovatively considers and models the span multi-word expression information in a sentence, proposes a multi-word-aware sentiment table generation model, and fuses multi-word-aware sentiment tables containing different sentiment intensities with respect to different sentiment polarities to determine a fused sentiment table, which can effectively integrate the span-level multi-word expression information in a sentence into the sentiment table feature construction, aggregation, and sentiment polarity prediction, overcoming the problem that existing attribute-level sentiment classification methods have not effectively modeled and aggregated 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 sentiment table is fused to determine that the fused sentiment table can effectively aggregate the sentiment table features of multiple words perception with different sentiment polarities, generate a sentiment table of multiple sentiment intensities integrating different sentiment polarities, and further enhance the model's modeling ability for sentiment 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: inputting the fused emotion table into the linear layer of the emotion prediction classification model to determine the emotion table features of the fused 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 of multiple sentiment intensities fused with 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 is composed of a linear layer and a softmax function. The fused sentiment table of multiple sentiment intensities with different sentiment polarities is input into the linear layer of the sentiment prediction classification model, and the sentiment table features of multiple sentiment intensities with different sentiment polarities are output; the sentiment table features of 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 data enhancement and span-level multi-word-aware attribute-level sentiment classification scheme provided in this embodiment overcomes the problem that the 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 in the following manner:
[0155]
[0156] Among them, W s and b s are the parameters of the sentiment prediction classification model; table fusion It is a fusion emotion table that integrates multiple emotion intensities with different emotion polarities; sIt is the emotional table feature of multiple emotional intensities with different emotional polarities obtained through linear layer processing; Classify the sentiment polarity of attribute words in the input text.
[0157] Fig. 9 A schematic diagram of the training process of a sentiment prediction classification model shown in a classification method in an embodiment of the present disclosure is shown. Fig. 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 according to the sentiment table of multiple words with different sentiment polarities and different sentiment intensities;
[0159] Step S904: Determine the sentiment polarity cross entropy loss according to the sentiment polarity classification of the enhanced text and the attribute words;
[0160] Step S906: determining a loss function according to the emotion consistency check loss and the emotion 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 multi-word perceived sentiment tables with different sentiment polarities and different sentiment intensities, so a 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. Receive multi-word perceived sentiment tables with different sentiment polarities and different sentiment intensities as input, maximize the difference between any two multi-word perceived sentiment tables with different sentiment polarities, thereby ensuring that each span composed of multiple words cannot simultaneously obtain high sentiment intensities on multi-word perceived sentiment tables with different sentiment polarities, and calculate the sentiment consistency verification loss l sr For the enhanced text obtained through data enhancement, combined with the sentiment polarity classification of attribute words, the sentiment polarity cross entropy loss is calculated. According to the sentiment consistency check loss and the sentiment polarity cross entropy loss, the loss function is determined. According to the loss function, the sentiment prediction classification model is trained. When the loss function is controlled to reach the target value, the sentiment prediction classification model training is completed.
[0163] In the embodiment, the emotion consistency check loss is determined as follows:
[0164]
[0165] Among them, l sris the sentiment consistency check loss; K is the number of multi-word perceived sentiment tables with different sentiment polarities; ||·|| is the sum of the absolute value squares of each element in the calculation matrix; table c and table c′ A 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 Verify loss for sentiment consistency; 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 multi-word perceived sentiment tables of different sentiment polarities, thereby overcoming the problem that the sentiment constraints between different sentiment polarities have not been effectively integrated into the model, improving the performance of multi-word perceived sentiment tables of different sentiment polarities, and improving the overall performance of the model.
[0170] The disclosed embodiments can be widely used in text classification, such as customer service scenarios, comment analysis scenarios, smart judicial scenarios, and smart education scenarios.
[0171] The disclosed embodiment provides an attribute-level sentiment classification solution using the classification method of the present application, which is mainly composed 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 annotated 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 the 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 containing different sentiment intensities for different sentiment polarities. The sentiment table aggregation module is used to aggregate sentiment tables of different sentiment polarities to obtain a sentiment table of multiple sentiment intensities that fuses 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 a sentence.
[0172] Fig.10A model framework diagram of a classification method in an embodiment of the present disclosure is shown, such as Fig.10 As shown, the main steps include:
[0173] The sentence is input into the emotional text enhancement module, and the attribute emotional text generation module is used to generate text with the same attribute words and emotional polarity as the input sentence. The attribute emotional verification module is used to check whether the generated sentence is consistent with the original sentence in attribute words and emotional expression. The attribute emotional correction module is used to correct the sentences that fail the attribute emotional verification. The sentences output by the attribute emotional correction module are input into the attribute emotional verification module for verification again until the attribute emotional verification passes. The text enhancement module can thus output high-quality enhanced texts under 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 a multi-word-aware sentiment table generation module to generate a multi-word-aware sentiment table containing different sentiment intensities for each word with respect to different sentiment polarities.
[0176] The multi-word perceived sentiment table containing different sentiment intensities for each word in the sentence with respect to different sentiment polarities is input into the sentiment table aggregation module to generate a sentiment table integrating multiple sentiment intensities with different sentiment polarities.
[0177] The obtained multi-word perceived 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 in different sentiment polarity tables has a large difference. By designing a variety of loss functions as the training objectives of the model, the model is equipped with better sentiment modeling capabilities and the sentiment classification performance of the model is improved.
[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 word in the sentence is output.
[0179] In the emotional text enhancement module, more high-quality annotated data can be generated based on the existing text data, and the data distribution between different emotional polarities in the original text data can be more balanced. The emotional text enhancement module is mainly composed of an attribute emotional text generation module, an attribute emotional verification module, and an attribute emotional correction module. The attribute emotional text generation module is mainly composed of a large model, which is 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, 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 text is spliced into prompt words, such as "You are a text generation expert. Please analyze the attribute words and emotional polarity in the provided text, generate a restated text with the same attribute words and emotional polarity, and ensure the emotional consistency with the provided text. The provided text is: <text>. Output the restated text:", where <text> is the sentence in the original data.
[0180] The attribute sentiment verification module is mainly composed of a large model, which is used to check whether the generated sentence is consistent with the original sentence in terms of attribute words and sentiment expression, and give corresponding explanations. The original text and the text generated by the attribute sentiment text generation module are spliced to form prompt words, such as "You are a text verification expert. Please score the original text and the generated text for comparison. The score range is 0-5 points, where 0 points means that the attribute words and the corresponding sentiment polarity are completely inconsistent, and 5 points means that the attribute words and the corresponding sentiment 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 sentence input to the attribute sentiment text generation module, and <comparison generated text> is the generated sentence to be compared, that is, the sentence generated by the attribute sentiment text generation module or the sentence generated by the attribute sentiment correction module. The spliced prompt words are input into the big model, and the big 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 emotion correction module is mainly composed of a large model, which is used to correct the generated low-quality text data. The low-quality text data, the corresponding explanation and the original text are spliced to form prompt words, such as "You are a text correction expert. Please regenerate high-quality text data based on the low-quality text, the corresponding explanation and the original text, so that the attribute words and their corresponding emotional polarity in the generated sentence are the same as 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 emotion verification module, and <Original text> is the input original text. The sentence output by the attribute emotion correction module is input into the attribute emotion verification module again until the generated text passes the 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 feed-forward 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 for each word with respect to 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, and further improve the performance of the model as a whole. 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 in the multi-word-aware sentiment tables.
[0187] The sentiment table integrating multiple sentiment intensities with different sentiment polarities is input into the sentiment prediction module, and the sentiment polarity of specific attribute words in the sentence is output.
[0188] In this embodiment, it is explicitly considered to obtain more high-quality annotated data in the field and make the distribution of different sentiment polarities more uniform through large model data enhancement. This method can effectively integrate 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, overcoming the problem that the existing attribute-level sentiment classification method has not effectively integrated the data enhancement method based on the large model into the attribute sentiment classification. Through data enhancement based on the large model, the amount of high-quality annotated data in the field can be increased and the data distribution of different sentiment polarities can be more balanced, so that the model can learn more comprehensive sentiment knowledge and improve the model's sentiment understanding ability. Secondly, this method explicitly considers and models the span multi-word expression information in the sentence. This method 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 the span-level multi-word expression information, so that the model can learn more accurate and more useful information-containing sentiment representations, and improve the model's attribute-level sentiment expression capture ability and model performance.
[0189] Attribute sentiment text generation module, attribute sentiment verification module, attribute sentiment correction module, multi-word-aware sentiment table generation module, sentiment table aggregation module, span-level multi-word sentiment consistency calibration module. The attribute-level sentiment text generation module can effectively use the original text to increase the number of annotated data in the field and make the data distribution of different sentiment polarities more balanced. The attribute sentiment verification module can effectively analyze whether the generated attribute sentiment text data is high-quality annotated data and give relevant explanations. The attribute sentiment correction module can effectively modify low-quality attribute sentiment text data into high-quality attribute sentiment text data, and improve the ability to generate high-quality annotated data in the field. The multi-word-aware sentiment table generation module can effectively use span-level multi-word information to generate multi-word-aware sentiment tables with different sentiment intensities about different sentiment polarities. The sentiment table aggregation module can effectively aggregate the multi-word-aware sentiment table features 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, and can effectively maximize the difference between multi-word-aware sentiment tables of different sentiment polarities, further improve the performance of multi-word-aware 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 in this disclosure are in compliance with the relevant provisions of national laws and regulations, and 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 this disclosure have all been authorized.
[0191] Based on the same inventive concept, the present disclosure also provides a classification device 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] Fig.11 A schematic diagram of a classification device in an embodiment of the present disclosure is shown. Fig.11 As shown, the device comprises:
[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 a start context representation and an end context representation of a word in a concatenated sequence;
[0195] A fusion sentiment table determination module 1103 is used to determine a fusion sentiment table according to 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 above-mentioned emotional text enhancement module 1101, multi-word representation modeling module 1102, fusion emotional table determination module 1103 and emotional prediction module 1104 correspond to S202 to S208 in the method embodiment, and the examples and application scenarios implemented by the above-mentioned modules and corresponding steps are the same, but are not limited to the contents disclosed in the above-mentioned method embodiment. It should be noted that the above-mentioned modules as part of the device 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 specifically implemented in the following forms, namely: complete hardware implementation, complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as "circuits", "modules" or "systems".
[0199] Refer to the following Fig.121200 according to this embodiment of the present disclosure is described. Fig.12 The electronic device 1200 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0200] like Fig.12 As shown, the electronic device 1200 is in the form of a general computing device. The components of the electronic device 1200 may include but are not limited to: at least one processing unit 1210, at least one storage unit 1220, and a bus 1230 connecting different system components (including the storage unit 1220 and the 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 executes the steps described in the above "Exemplary Method" section of this specification according to various exemplary embodiments of the present disclosure. For example, the processing unit 1210 can execute 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 storage unit (RAM) 12201 and / or a cache storage unit 12202 , and may further include a read-only storage 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] Bus 1230 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0205] The electronic device 1200 may also communicate with one or more external devices 1240 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1200, and / or communicate with any device that enables the electronic device 1200 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1250. Furthermore, the electronic device 1200 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 1260. As shown, the network adapter 1260 communicates with other modules of the electronic device 1200 via a bus 1230. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the 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 implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation 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, including 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 implementation 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, which may be a readable signal medium or a readable storage medium. A program product capable of implementing the above 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 a program code, and 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 implementations of the present disclosure described in the above “Exemplary Method” section 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 fiber, 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, wherein a readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A readable signal medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit 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 of the foregoing.
[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++, etc., and 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 separate 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 through 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., using an Internet service provider to connect through the Internet).
[0213] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, 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 embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0214] In addition, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the 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, etc.
[0215] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation 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, including 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 implementation of the present disclosure.
[0216] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the appended claims.
Claims
1. A classification method, characterized in that: include: Perform data enhancement on the input text and concatenate attribute words to determine the concatenation sequence; Obtaining a start context representation and an end context representation of the words 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; 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.
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 concatenated with the attribute words, and a concatenated 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 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; If the similarity between the attribute words and sentiment polarity of the first text and the attribute words and sentiment polarity of the input text verified by the large model 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 meet the similarity threshold, and the first text is determined as an enhanced text.
4. The classification method according to claim 1, characterized in that: Obtaining the start context representation and the end context representation of the words in the concatenated sequence, including: A multi-word representation model is constructed using bidirectional encoder representation and feed-forward neural network; The multi-word representation model is used to obtain the start context representation and the end context representation of the words in the concatenated sequence.
5. The classification method according to claim 4, characterized in that: The start context representation and the end context representation of the words in the concatenated sequence are obtained as follows: Among them, 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; Represent the context representation of the i-th word in the concatenated sequence output by the bidirectional encoder; 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: Determining a fusion sentiment table according to 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; The multi-word perceived emotion tables with different emotion polarities and different emotion intensities are fused to determine a fused emotion table.
7. The classification method according to claim 6, characterized in that: Generate a multi-word sentiment table 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 sentiment intensity of the positive sentiment span between word i and word j in the multi-word perceived sentiment table of positive sentiment; table neg (i, j) is the sentiment intensity of the negative sentiment span between word i and word j in the multi-word perceived sentiment table of negative sentiment; table neu (i, j) is the sentiment intensity of the neutral sentiment span between word i and word j in the multi-word perceived sentiment table of neutral sentiment; table 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.
8. The classification method according to claim 6, characterized in that: The multi-word perception emotion tables with different emotion polarities and different emotion intensities are merged to determine a merged emotion table, including: Performing a maximum pooling operation on the multi-word perceived 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 concatenated and fused to determine a fused emotion table.
9. The classification method according to claim 8, characterized in that: Determine the fusion sentiment table as follows: Among them, max_pooling(·) is the maximum pooling operation; table pos Multi-word sentiment table for positive sentiment; table neg Multi-word perceived sentiment table for negative sentiment; table neu Sentiment table for multi-word perception of neutral sentiment; It is the multi-word perceived sentiment table value of the overall positive sentiment after maximum pooling; It is the multi-word perceived sentiment table value of the overall negative sentiment after maximum pooling; is the multi-word perceived sentiment table value of the overall neutral sentiment after maximum pooling; formula [table pos ;table neg ;table neu ] in the symbol; for splicing and fusion operations; table fusion A fused emotion table that combines multiple emotion intensities with different emotion polarities.
10. 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 of the fused emotion table with multiple emotion intensities of different emotion polarities; The function processing layer is used to perform sentiment polarity distribution analysis on the sentiment table features of the multiple sentiment intensities fused with different sentiment polarities, so as to determine the sentiment polarity classification of the attribute words in the input text.
11. The classification method according to claim 10, characterized in that: The sentiment polarity classification of the attribute words in the input text is determined as follows: h s =W s table fusion +b s Among them, W s and b s are the parameters of the sentiment prediction classification model; table fusion It is a fusion emotion table that integrates multiple emotion intensities with different emotion polarities; s It is the emotional table feature of multiple emotional intensities with different emotional polarities obtained through linear layer processing; Classify the sentiment polarity of attribute words in the input text.
12. The classification method according to claim 6, 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.
13. The classification method according to claim 12, 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 multi-word perceived sentiment tables with different sentiment polarities; ||·|| is the sum of the absolute squares of the elements in the calculation matrix; table c and table c′ A sentiment table for any two multi-word perceptions with different sentiment polarities.
14. The classification method according to claim 12, 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 Verify loss for sentiment consistency; is the sentiment polarity classification of attribute words; λ is the hyperparameter of the model; l f is the sentiment polarity cross entropy loss.
15. A classification device, characterized in that: include: The emotional text enhancement module is used to perform data enhancement on the input text and splice attribute words to determine the splicing sequence; A multi-word representation modeling module, used to obtain the start context representation and the end context representation of the words in the concatenated sequence; A fusion sentiment table determination module, used to determine a fusion sentiment table according to the start context representation and the end context representation of the words in the concatenated sequence; 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.
16. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the classification method according to any one of claims 1 to 14 by executing the executable instructions.
17. 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 14 is implemented.
18. 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 14 is implemented.
Citation Information
Patent Citations
Attribute-level sentiment analysis method based on multi-task learning
CN111414476A
Chinese attribute level sentiment analysis method, system and equipment based on multi-task learning and medium
CN116029305A
Attribute word sentiment classification method and related equipment
CN117708331A
Text-based sentiment classification method and apparatus, and computer device and storage medium
WO2023134083A1
