CN116304063A - Simple emotion knowledge enhancement prompt tuning aspect-level emotion classification method - Google Patents
Simple emotion knowledge enhancement prompt tuning aspect-level emotion classification method Download PDFInfo
- Publication number
- CN116304063A CN116304063A CN202310564657.XA CN202310564657A CN116304063A CN 116304063 A CN116304063 A CN 116304063A CN 202310564657 A CN202310564657 A CN 202310564657A CN 116304063 A CN116304063 A CN 116304063A
- Authority
- CN
- China
- Prior art keywords
- emotion
- words
- tag words
- knowledge
- tuning
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 230000008451 emotion Effects 0.000 title claims abstract description 247
- 238000000034 method Methods 0.000 title claims abstract description 57
- 238000013507 mapping Methods 0.000 claims abstract description 38
- 238000005457 optimization Methods 0.000 claims abstract description 35
- 238000012549 training Methods 0.000 claims abstract description 25
- 239000013598 vector Substances 0.000 claims description 26
- 230000007935 neutral effect Effects 0.000 claims description 17
- 238000012545 processing Methods 0.000 claims description 9
- 238000013139 quantization Methods 0.000 claims description 8
- 238000012163 sequencing technique Methods 0.000 claims description 6
- 238000010276 construction Methods 0.000 claims description 5
- 238000012360 testing method Methods 0.000 claims description 5
- 238000000605 extraction Methods 0.000 claims description 4
- 238000010606 normalization Methods 0.000 claims description 3
- 238000013473 artificial intelligence Methods 0.000 abstract description 2
- 238000003058 natural language processing Methods 0.000 abstract description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 16
- 238000013528 artificial neural network Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 3
- 230000002996 emotional effect Effects 0.000 description 3
- 239000000284 extract Substances 0.000 description 3
- 239000002131 composite material Substances 0.000 description 2
- 230000036651 mood Effects 0.000 description 2
- 101100149325 Escherichia coli (strain K12) setC gene Proteins 0.000 description 1
- 235000010627 Phaseolus vulgaris Nutrition 0.000 description 1
- 244000046052 Phaseolus vulgaris Species 0.000 description 1
- 238000013459 approach Methods 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000002860 competitive effect Effects 0.000 description 1
- 238000013527 convolutional neural network Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000005065 mining Methods 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 238000004806 packaging method and process Methods 0.000 description 1
- 238000007781 pre-processing Methods 0.000 description 1
- 238000002360 preparation method Methods 0.000 description 1
- 230000000306 recurrent effect Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 238000012216 screening Methods 0.000 description 1
- 230000011218 segmentation Effects 0.000 description 1
- 238000000638 solvent extraction Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/35—Clustering; Classification
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/3331—Query processing
- G06F16/334—Query execution
- G06F16/3344—Query execution using natural language analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/3331—Query processing
- G06F16/334—Query execution
- G06F16/3346—Query execution using probabilistic model
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/205—Parsing
- G06F40/216—Parsing using statistical methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/279—Recognition of textual entities
- G06F40/289—Phrasal analysis, e.g. finite state techniques or chunking
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/30—Semantic analysis
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computational Linguistics (AREA)
- Artificial Intelligence (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Health & Medical Sciences (AREA)
- Audiology, Speech & Language Pathology (AREA)
- General Health & Medical Sciences (AREA)
- Probability & Statistics with Applications (AREA)
- Machine Translation (AREA)
Abstract
The invention discloses a simple emotion knowledge enhancement prompt optimization aspect-level emotion classification method, which belongs to the field of artificial intelligence natural language processing and comprises the following steps: constructing a prompt template, inputting the prompt template and the text to be classified into a pre-training language model for prediction, and obtaining the prediction probability of a plurality of words corresponding to the text to be classified; constructing an emotion knowledge mapping expression device, and optimizing a plurality of emotion tag words in the emotion knowledge mapping expression device to obtain optimized emotion tag words; based on the prediction probabilities of the words, obtaining the optimized prediction probability of the emotion tag words; and mapping the prediction probability of the optimized emotion tag words to category tags through the emotion knowledge mapping expressive machine to obtain the final prediction probability of the category tags. According to the invention, the semantic expression capability of the emotion tag words is improved by introducing the external emotion word library, and meanwhile, the deviation caused by single emotion tag words is reduced.
Description
Technical Field
The invention belongs to the field of artificial intelligence natural language processing, and particularly relates to a simple emotion knowledge enhancement prompt tuning aspect-level emotion classification method.
Background
Aspect-level emotion classification is the current classification method with the finest granularity, and emotion information expressed by each aspect word can be determined according to each aspect object in a text, and emotion is generally classified into three categories, namely positive, negative and neutral. Aspect-level emotion classification has wide application in consumer public praise analysis, social media, event trend prediction, public opinion monitoring, and user interest mining.
In general, most solutions to aspect-level emotion classification can be divided into neural network and pre-trained language model based approaches. Neural network-based methods attempt to build a variety of complex feature extractors to extract semantic features of the data itself (e.g., convolutional neural networks, recurrent neural networks, and graphical convolutional networks). The graph-convolution network-based model extracts grammatical features (sentence structure information) in combination with sentence dependency trees in addition to semantic features. While these methods are effective, they take advantage of the characteristics of the dataset itself and require more supervised data to train. In contrast, pre-trained language model based methods can take full advantage of the knowledge that large-scale data sets are rich. The method has good effect by enabling the pre-training language model to perform fine adjustment on the target data set, but a certain gap exists between the pre-training target and the downstream task, a large amount of supervision data is needed for fine adjustment, and the cost is high. In many practical cases, accurate marking data is scarce and requires intensive human labor. Recently, hint tuning has received much attention and has shown great advantage in low data scenarios.
For classification tasks, the most critical step in applying the hint tuning method is to define a mapping expression for the mapping relationship between class labels and words of a specific class (labeled words).
Some existing efforts have attempted to improve hint tuning performance by building manual or automatic map expressive machines. The manual map expressive is to represent category labels using manually screened appropriate word(s) (tag word (s)). While the automatic mapping expressive machine learns the tag words by means of discrete search or gradient descent. In the case of sample scarcity, the automatic construction of the mapping expressive machine requires training samples to learn constantly, and the manual mapping expressive machine is still dominant. The method of integrating the external emotion knowledge into the mapping expressive machine to increase the coverage of the tag word achieves excellent effects. However, the currently available emotion words contain only positive and negative emotions, resulting in only two levels, lacking neutral emotion words for the aspect level tripolar emotion classification task. In addition, in-field emotion words related to downstream tasks are lacking to improve predictive performance.
In summary, the existing technical problems are: the current emotion classification method based on the aspect of prompt tuning lacks a comprehensive emotion word library suitable for tripolar classification to expand the coverage range of emotion tag words in prompt tuning, so that prediction has deviation. Therefore, it is highly desirable to provide a simple emotion knowledge enhancement prompt tuning aspect-level emotion classification method.
Disclosure of Invention
The invention aims to provide a simple emotion knowledge enhancement prompt tuning aspect-level emotion classification method, which integrates emotion knowledge into a frame of a mapping expression device enhancement prompt tuning so as to solve the problems in the prior art.
In order to achieve the above purpose, the invention provides a simple emotion knowledge enhancement prompt tuning aspect-level emotion classification method, which comprises the following steps:
constructing a prompt template, inputting the prompt template and the text to be classified into a pre-training language model for prediction, and obtaining the prediction probability of a plurality of words corresponding to the text to be classified;
constructing an emotion knowledge mapping expression device, and optimizing a plurality of emotion tag words in the emotion knowledge mapping expression device to obtain optimized emotion tag words;
based on the prediction probabilities of the words, obtaining the optimized prediction probability of the emotion tag words;
and mapping the prediction probability of the optimized emotion tag words to category tags through the emotion knowledge mapping expressive machine to obtain the final prediction probability of the category tags.
Optionally, the process of constructing the emotion knowledge mapping expressive machine includes: extracting emotion tag words of positive emotion, neutral emotion and negative emotion from a data set for a triple emotion classification task, respectively acquiring word frequencies of the emotion tag words, and sequencing, and setting corresponding thresholds for different emotion tag words based on word frequency sequencing results to acquire emotion tag words in the field; and then continuously extracting emotion tag words of the positive emotion and the negative emotion from the binary emotion dictionary, obtaining the emotion tag words of the neutral emotion based on keyword search, further obtaining the emotion tag words outside the domain, and completing the construction of an emotion knowledge mapping expression device.
Optionally, the optimizing the plurality of emotion tag words in the emotion knowledge mapping expressive includes: and carrying out emotion tendentiousness optimization, learning vector quantization optimization, learnable weight optimization and small sample priori optimization on the emotion tag words.
Optionally, the process of optimizing emotion tendencies of the emotion tag words includes: and after the emotion tag words are subjected to de-duplication processing, acquiring categories of the emotion tag words based on a social media emotion analysis tool, and processing the emotion tag words without emotion tendency based on a part-of-speech recognition tool.
Optionally, the learning vector quantization optimization process for the emotion tag word includes: prototype vectors of different classes of emotion tag words are constructed based on learning vector quantization, and emotion tag words belonging to the same class are clustered.
Optionally, the process of performing learnable weight optimization on the emotion tag word includes: and distributing a learnable weight for each emotion label word, forming a vector by all the learnable weights, carrying out normalization processing, and optimizing the weight occupied by each emotion label word.
Optionally, the process of performing small sample prior optimization on the emotion tag word includes: presetting extraction proportion, acquiring a plurality of examples from a training set based on the extraction proportion, removing labels, acquiring a test set, acquiring prior probability of each emotion label word based on the test set, sequencing, and removing emotion label words which do not accord with the preset probability.
Optionally, the process of obtaining the final predicted probability of the category label includes: when in a zero sample scene, assuming that the contribution of the optimized emotion tag words to corresponding class prediction is the same, taking the average value of the optimized emotion tag words as the final prediction probability of the class tags; and taking the weighted average value of the optimized emotion label words as the final prediction probability of the class labels in the small sample scene.
The invention has the technical effects that:
the invention provides a method for improving emotion knowledge enhancement prompt and optimizing for aspect-level emotion classification, which improves semantic expression capacity of emotion tag words by introducing external knowledge and reduces deviation caused by single tag words.
The invention constructs a complete emotion word library suitable for the tripolar classification task of aspect level, and comprises active, passive and neutral emotion words inside and outside the field.
The invention provides a general optimization method for processing noise emotion knowledge, and the purpose of optimizing classification can be achieved by using rule combination.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application, illustrate and explain the application and are not to be construed as limiting the application. In the drawings:
FIG. 1 is a flow chart of a simple emotion knowledge enhancement prompt tuning aspect-level emotion classification method in an embodiment of the present invention;
FIG. 2 is a schematic diagram of an overall model for emotion classification in an embodiment of the present invention.
Detailed Description
It should be noted that, in the case of no conflict, the embodiments and features in the embodiments may be combined with each other. The present application will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer executable instructions, and that although a logical order is illustrated in the flowcharts, in some cases the steps illustrated or described may be performed in an order other than that illustrated herein.
Example 1
The current emotion classification method based on the aspect of prompt tuning lacks a comprehensive emotion word library suitable for tripolar classification tasks to expand the coverage range of emotion tag words in prompt tuning, so that prediction has deviation. To promote semantic expression of emotion tag words, a comprehensive word library containing three types of emotion needs to be constructed, but the current work does not have a summary about neutral emotion words, so that definition of neutral words and construction of the neutral emotion word library are difficult. In addition, the emotion tag words in the constructed emotion word library may contain noise, which affects the prediction result, so that a suitable optimization method is required to process the noise words. The optimized predictive probability of the emotion tag word needs to be mapped to the category to which the emotion tag word belongs, and the final score of each category is calculated. The calculation method for the mapping in different scenarios affects the final prediction and thus requires a suitable mapping method.
Therefore, as shown in fig. 1, the embodiment provides a simple aspect-level emotion classification method for emotion knowledge enhancement prompt tuning, which includes the following steps:
firstly, constructing a template and preprocessing texts to be classified. Because the prompt optimization is to add a prompt template in the sentence, the embodiment firstly constructs a template suitable for the aspect-level emotion classification task, then adds the template into the input sentence, and predicts the result by the pre-training language model.
Second, pre-training the language model preparation. This example compares two pre-trained language models of different scales, respectively: BERT, BERT-X (X: lap, res, refer to comment text through computer and restaurant respectively) (comments for electronic category in Amazon comment data, comments related to restaurant in yellow open dataset). The pre-trained language model needs to download pre-trained parameters and load them when in use.
And thirdly, constructing an emotion knowledge mapping expression device. That is, an external word stock is constructed that contains both positive, negative, neutral intra-domain and extra-domain emotion tag words.
And fourthly, optimizing the emotion knowledge mapping expressive machine. The embodiment provides an emotion knowledge optimization method to process noise words, reserve words with higher quality and improve semantic expression capacity of emotion tag words.
And fifthly, mapping the expressive machine by using emotion knowledge. Mapping the prediction of the emotion tag words to the category tags to obtain the final prediction probability of the category tags.
Firstly, constructing a prompt template suitable for an aspect-level emotion classification task, wherein the prompt template is as follows:
P 1 (s) = I felt the {aspect} was [MASK]. s
P 2 (s) = The {aspect} made me feel [MASK]. s
P 3 (s) = The {aspect} is [MASK]. s
P 4 (s) = It was a {MASK} {aspect}. s
where { aspect } represents the placeholder of the aspect word in the sentence, [ MASK ] is the position of the prediction result, and s is the input sentence.
Packaging the template and the input sentence, and sending the packaged template and the input sentence into a pre-training language model for prediction, wherein the pre-training language model gives the vocabulary of the pre-training language modelWord filling in [ MASK ]]Is a probability of (2). The probability that each word may be filled in is:
wherein, the liquid crystal display device comprises a liquid crystal display device,representing a pre-trained language model->Representation fill-in [ MASK ]]Word of->The sentence that is to be packaged is represented,representing a pre-trained language model->Predicting vocabulary +.>Every word->Filling in->Medium [ MASK]Is a probability of (2).
The embodiment defines that the emotion knowledge mapping expression device maps the probability of emotion label words to class labelsProbability of = { positive, negative, neutral }. The set of these emotion tag words ++>Is->Is a subset of the set of (c). Set->And set->A mapping relationship ƒ is formed>→/>The predictive probability of a category label can be expressed as:
wherein, the liquid crystal display device comprises a liquid crystal display device,representing category label->Representation mapping to specific class labels->Is>,/>Representing the emotion tag word->Is converted into class labels->Is a function of the probability of>Representing class label->Is used for the prediction probability of (1). Specifically, predictive probabilities for multiple emotion tag wordsThe probability of the contribution of a rate to a class label can be expressed as:
wherein, the liquid crystal display device comprises a liquid crystal display device,representing emotion tag words->Belonging to category label->Probability of (e.g., [ MASK)]= "good", and= "active", thenp=1),/>Representing the probability of the contribution of the predictive probability of a plurality of emotion tag words to a class tag, i.e. class tag +.>Is used for the prediction probability of (1).
It should be noted that the external emotion word library is not completely matched to the vocabulary in the pre-trained language model, and that some emotion tag words may not be in the vocabulary of the pre-trained language model, and the segmenter may divide them into words. The predictive probabilities of these emotion tag words are averaged.
And secondly, inputting the word segmentation device and the processed text sequence into a pre-trained language model after loading parameters, and executing forward propagation of the language model.
Third, in order to better combine hint tuning with the mask language model, appropriate emotion tag words are required in addition to the design templates. However, predicting [ MASK ] by context does not have a definite answer, and a single emotion tag word may lack comprehensive information resulting in bias. Therefore, the emotion tag words need to have wide coverage and less subjective deviation, and the external emotion word stock can be introduced to well meet the requirements.
The tripolar emotion classification task aims to extend the scope of different classes of emotion to finer granularity and diversity aspects. However, existing studies do not summarize descriptions of neutral mood words, nor are mood words within this field. Therefore, the research of this embodiment focuses on expanding neutral emotion words and adding intra-domain emotion words. In particular, the embodiment extracts positive, negative and neutral emotion opinion words from a data set (SemEval 2016 Task 5: restaurant and notebook computer field data) suitable for the triple emotion classification Task, then calculates word frequencies of the words, and the number of collected words is very large (as shown in brackets in table 2). But too many words may instead introduce noise and many words occur less frequently, which may not contribute much to the predictive label. Therefore, in this embodiment, the words are sorted according to word frequency, and different thresholds are set for emotion words with different polarities in consideration of making the number of each word as balanced as possible, and the specific thresholds are shown in table 1.
TABLE 1
To overcome the constraints of the domain, the present embodiment uses a previously researcher-summarized emotion dictionary, including both positive and negative emotion vocabularies. In addition, the embodiment also searches for "neutral emotion words in english" based on keywords, and collects more objective neutral emotion words from some documents (such as hundred degrees, diced beans, etc.) summarized by other people on the web page, as shown in table 2.
TABLE 2
Table 3 lists the number of words from different sources:
TABLE 3 Table 3
Fourth, although this embodiment has constructed a preliminary emotion knowledge map expressive machine, the sources of emotion knowledge are diverse, and the collected emotion tag words may contain noise and are not entirely suitable for pre-training language models. This embodiment requires processing of words containing noise, retaining words of higher quality, to improve the expressive power of emotional knowledge. The embodiment provides a general optimization method for processing noise-containing emotion words, which comprises four optimization rules.
Optimization rule 1: emotional tendency optimization
Since the construction of emotion tag words is completely unsupervised, a word may repeatedly appear in the same class or classes. For the first problem, the present embodiment performs a deduplication process on each type of word collected. For the second problem, this embodiment uses a social media emotion analysis tool, vader, to determine the category of the input word according to its composite score. The composite emotion score criteria for Vader are shown in Table 4.
TABLE 4 Table 4
Through observation of the data, the present embodiment also finds that some nouns and verbs in the emotion word library have no obvious emotional tendency, which is inconsistent with the templates constructed in the present embodiment. Thus, the present embodiment uses a part-of-speech recognition tool, textblob, to handle non-adjectives in emotion word libraries that have no explicit emotion tendencies.
Optimization rule 2: learning vector quantization optimization
Although this embodiment initially optimizes emotion tag words in terms of emotion tendencies expressed by emotion words, this embodiment cannot intuitively measure differences of different classes and similarities of the same class. In order to create a more differential mapping space for emotion tag words, the present embodiment uses Learning Vector Quantization (LVQ) to construct prototype vectors of different classes to characterize the clustering structure of emotion words, i.e. to make words belonging to the same class closer and words of different classes farther. Since LVQ can use the true class-aided clustering algorithm of the samples, this is very suitable for the screening requirements of this embodiment.
The embodiment is expressed by emotion wordsAnd its corresponding category->As a set of emotions. First, randomly extracting a sample from each emotion class as a prototype vector +.>Samples are then selected from the emotion words and their (euclidean) distance from each prototype vector is calculated, namely:
wherein, the liquid crystal display device comprises a liquid crystal display device,representation ofXIs a random sample of ∈,>representing prototype vector +.>Representation->To->(Euclidean) distance.
Then, select the distanceThe nearest prototype vector is used as a predicted class label and then is carried out with a real class labelAnd (5) comparing. If the partitioning result is correct, the corresponding prototype vector will be closer to this sample. Otherwise, the corresponding prototype vector is farther from the sample. The formula is as follows:
wherein, the liquid crystal display device comprises a liquid crystal display device,indicating distance->Nearest prototype vector, ">Representing a real category label->Category label representing predictions->Is a hyper-parameter representing learning rate, +.>Representing the updated prototype vector (prototype vector +.>Updated to)。
After the prototype vector is determined, the embodiment retains those emotion words that are closer to the prototype vector of the class for subsequent steps.
Optimization rule 3: learnable weight optimization
In a small sample scenario, the weight of each word may be constantly learned for optimization during the training process. In the training process, this embodiment expects that the emotion tag words that contribute significantly to the result will be weighted more heavily, while the noisy emotion tag words will be weighted less heavily. Each emotion labelWords are assigned a learnable weightThese weights form a vector +.>All initialized with zero vector, weights at each +.>And (3) normalization:
wherein, the liquid crystal display device comprises a liquid crystal display device,representing the normalized weights.
Notably, this optimization rule is not applicable to cases where there is no training data.
Optimization rule 4: small sample prior optimization
Another problem is that the prior probability of emotion tag words is highly variable. Some works have shown that some words will never be predicted. In the embodiment, small sample data without labels is used as a training set, and emotion label words with low prediction probability are removed, namely small sample prior optimization is performed. The present embodiment uses the model framework itself of the aspect-level emotion classification task to optimize the emotion knowledge map expressive. Specifically, the sentence s is distributed in the corpusDMeaning that all sentences and templates in the distribution are packaged as a new sentence. Each->Is put into->[ MASK of (A)]To calculate the probability of prediction. The whole sentence distribution expectation in the corpus is then treated asIs the prior probability of the emotion tag word. The present embodiment randomly extracts 200 examples from the training dataset in proportion and removes the tags to form a test setC. Every word->The prior probability of (c) may be approximated as:
wherein, the liquid crystal display device comprises a liquid crystal display device,is shown inDEvery word->Is a priori probability of (c).
The present embodiment then filters out the lower half of the prediction probability according to the ordering method. Since in the case of small samples the parameters are trained by a learnable weight optimization, the rule is only used in a zero sample environment.
Fifth, in this embodiment, a series of optimizations are performed on the emotion tag words in the emotion knowledge language expressive machine, but the optimized emotion tag word probability still needs to be mapped to the category tag probability.
In a zero sample scenario, no parameters are trained or updated. It is assumed that each signature number has the same contribution to the corresponding class prediction. Thus, useAverage value of predictive emotion tag words on +.>Is a predictive score of (a):
In a small sample scenario, the present embodiment usesWeighted average of emotion tag words in ++as class tag>Is a predictive score of (a):
the overall framework of the model for emotion classification provided in this embodiment is shown in fig. 2, which shows the complete process of emotion polarity prediction of the model on aspect words in sentences. The input sentences (restaurant field data from SemEval 2014 Task 4 Subtask 2) are packaged in templates, then are input into a pre-training language model BERT to obtain the prediction probability of each word filled in the MASK position, and then the emotion knowledge mapping expressive machine maps the prediction probability of the emotion label words to class labels to obtain the final prediction probability of each class. The process of constructing, optimizing and mapping the emotion knowledge mapping expression is shown in detail.
In the zero sample and small sample scenarios, the present embodiment verifies the effectiveness of the method proposed by the present invention on two common public data sets (SemEval 2014 Task 4 Subtask 2: restaurant and notebook data therein), as shown in tables 5 and 6:
in a zero sample scenario, the experimental results of the present embodiment model exceeded other baseline models. Specifically, using BERT as the two data sets of the pre-trained language model, the values of the prediction accuracy (Acc) were increased by 6.42% and 4.29% respectively, and the values of the macro average (MF 1) were increased by 12.01% and 9.99% respectively, as compared to the best results of the baseline model. Meanwhile, BERT-X is used as a pre-training language model, acc values are respectively increased by 1.78% and 4.32%, and macro average (MF 1) values are respectively increased by 10.81% and 7.88%. The accuracy and the value of the macro average are obviously improved, wherein the value of the macro average is increased more remarkably, the prediction variance is reduced, and the model generates more stable performance. This means that the additional emotion words broaden the semantics of the class labels, resulting in a more stable and accurate prediction in the initial state of the model. Thus, extending emotion tag words is effective in improving the performance of the model.
In small sample scenarios, the performance of hinting is in most cases superior to fine tuning. Particularly, the BERT model based on prompt tuning can be better than the BERT model based on fine tuning and learned through intra-domain knowledge, and the advantage of prompt tuning in a small sample scene is illustrated. In the prompt tuning method, the BERT-X-based model and the BERT-X-based model of the embodiment perform well under different training samples. Taking the BERT model as an example, when the number of training samples is 16, the accuracy rate is respectively increased by 3.1 percent and 3.76 percent on two data sets, and the macro average value is respectively increased by 2.91 percent and 5.48 percent; when the number of training samples is 1024, the accuracy rate is increased by 1.48% and 0.39% respectively on the two data sets, and the macro average value is increased by 1.57% and 1.13% respectively. Our model is superior to other prompt tuning based models, proving the effectiveness of the inclusion of external emotion tag words to improve the aspect-level emotion classification. However, as the number of training samples increases, the trend for improvement slows, which indicates that the method of the present embodiment is more competitive with only a small number of samples.
TABLE 5
TABLE 6
The foregoing is merely a preferred embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions easily contemplated by those skilled in the art within the technical scope of the present application should be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims (8)
1. A simple emotion knowledge enhancement prompt tuning aspect-level emotion classification method is characterized by comprising the following steps:
constructing a prompt template, inputting the prompt template and the text to be classified into a pre-training language model for prediction, and obtaining the prediction probability of a plurality of words corresponding to the text to be classified;
constructing an emotion knowledge mapping expression device, and optimizing a plurality of emotion tag words in the emotion knowledge mapping expression device to obtain optimized emotion tag words;
based on the prediction probabilities of the words, obtaining the optimized prediction probability of the emotion tag words;
and mapping the prediction probability of the optimized emotion tag words to category tags through the emotion knowledge mapping expressive machine to obtain the final prediction probability of the category tags.
2. The simple emotion knowledge enhancement hint tuning aspect-level emotion classification method of claim 1, wherein,
the process for constructing the emotion knowledge mapping expressive machine comprises the following steps: extracting emotion tag words of positive emotion, neutral emotion and negative emotion from a data set for a triple emotion classification task, respectively acquiring word frequencies of the emotion tag words, and sequencing, and setting corresponding thresholds for different emotion tag words based on word frequency sequencing results to acquire emotion tag words in the field; and then continuously extracting emotion tag words of the positive emotion and the negative emotion from the binary emotion dictionary, obtaining the emotion tag words of the neutral emotion based on keyword search, further obtaining the emotion tag words outside the domain, and completing the construction of an emotion knowledge mapping expression device.
3. The simple emotion knowledge enhancement hint tuning aspect-level emotion classification method of claim 1, wherein,
the optimizing process of the emotion tag words in the emotion knowledge mapping expressive machine comprises the following steps: and carrying out emotion tendentiousness optimization, learning vector quantization optimization, learnable weight optimization and small sample priori optimization on the emotion tag words.
4. The method for classifying an aspect-level emotion of simple emotion knowledge enhancement hint tuning of claim 3,
the emotion tendentiousness optimization process for the emotion tag words comprises the following steps: and after the emotion tag words are subjected to de-duplication processing, acquiring categories of the emotion tag words based on a social media emotion analysis tool, and processing the emotion tag words without emotion tendency based on a part-of-speech recognition tool.
5. The method for classifying an aspect-level emotion of simple emotion knowledge enhancement hint tuning of claim 3,
the learning vector quantization optimization process for the emotion tag words comprises the following steps: prototype vectors of different classes of emotion tag words are constructed based on learning vector quantization, and emotion tag words belonging to the same class are clustered.
6. The method for classifying an aspect-level emotion of simple emotion knowledge enhancement hint tuning of claim 3,
the process for performing the learnable weight optimization on the emotion tag words comprises the following steps: and distributing a learnable weight for each emotion label word, forming a vector by all the learnable weights, carrying out normalization processing, and optimizing the weight occupied by each emotion label word.
7. The method for classifying an aspect-level emotion of simple emotion knowledge enhancement hint tuning of claim 3,
the process of carrying out small sample priori optimization on the emotion tag words comprises the following steps: presetting extraction proportion, acquiring a plurality of examples from a training set based on the extraction proportion, removing labels, acquiring a test set, acquiring prior probability of each emotion label word based on the test set, sequencing, and removing emotion label words which do not accord with the preset probability.
8. The simple emotion knowledge enhancement hint tuning aspect-level emotion classification method of claim 1, wherein,
the process of obtaining the final predicted probability of the category label includes: when in a zero sample scene, assuming that the contribution of the optimized emotion tag words to corresponding class prediction is the same, taking the average value of the optimized emotion tag words as the final prediction probability of the class tags; and taking the weighted average value of the optimized emotion label words as the final prediction probability of the class labels in the small sample scene.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310564657.XA CN116304063B (en) | 2023-05-19 | 2023-05-19 | Simple emotion knowledge enhancement prompt tuning aspect-level emotion classification method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310564657.XA CN116304063B (en) | 2023-05-19 | 2023-05-19 | Simple emotion knowledge enhancement prompt tuning aspect-level emotion classification method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN116304063A true CN116304063A (en) | 2023-06-23 |
CN116304063B CN116304063B (en) | 2023-07-21 |
Family
ID=86794511
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310564657.XA Active CN116304063B (en) | 2023-05-19 | 2023-05-19 | Simple emotion knowledge enhancement prompt tuning aspect-level emotion classification method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116304063B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116932853A (en) * | 2023-07-25 | 2023-10-24 | 重庆邮电大学 | User demand acquisition method based on APP comment data |
CN117407527A (en) * | 2023-10-19 | 2024-01-16 | 重庆邮电大学 | Education field public opinion big data classification method |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113657123A (en) * | 2021-07-14 | 2021-11-16 | 内蒙古工业大学 | Mongolian aspect level emotion analysis method based on target template guidance and relation head coding |
US20220092267A1 (en) * | 2020-09-23 | 2022-03-24 | Jingdong Digits Technology Holding Co., Ltd. | Method and system for aspect-level sentiment classification by graph diffusion transformer |
CN115526171A (en) * | 2022-09-28 | 2022-12-27 | 上海销氪信息科技有限公司 | Intention identification method, device, equipment and computer readable storage medium |
CN115630156A (en) * | 2022-09-21 | 2023-01-20 | 内蒙古工业大学 | Mongolian emotion analysis method and system fusing Prompt and SRU |
-
2023
- 2023-05-19 CN CN202310564657.XA patent/CN116304063B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20220092267A1 (en) * | 2020-09-23 | 2022-03-24 | Jingdong Digits Technology Holding Co., Ltd. | Method and system for aspect-level sentiment classification by graph diffusion transformer |
CN113657123A (en) * | 2021-07-14 | 2021-11-16 | 内蒙古工业大学 | Mongolian aspect level emotion analysis method based on target template guidance and relation head coding |
CN115630156A (en) * | 2022-09-21 | 2023-01-20 | 内蒙古工业大学 | Mongolian emotion analysis method and system fusing Prompt and SRU |
CN115526171A (en) * | 2022-09-28 | 2022-12-27 | 上海销氪信息科技有限公司 | Intention identification method, device, equipment and computer readable storage medium |
Non-Patent Citations (2)
Title |
---|
FEI WANG, LONG CHEN, FEI XIE,ET AL: "Few-Shot Text Classification via Semi-Supervised Contrastive Learning", 《2022 4TH INTERNATIONAL CONFERENCE ON NATURAL LANGUAGE PROCESSING (ICNLP)》 * |
李佳洲: "面向文本的方面级情感分类研究及系统实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116932853A (en) * | 2023-07-25 | 2023-10-24 | 重庆邮电大学 | User demand acquisition method based on APP comment data |
CN117407527A (en) * | 2023-10-19 | 2024-01-16 | 重庆邮电大学 | Education field public opinion big data classification method |
Also Published As
Publication number | Publication date |
---|---|
CN116304063B (en) | 2023-07-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107066553B (en) | Short text classification method based on convolutional neural network and random forest | |
Shivaprasad et al. | Sentiment analysis of product reviews: A review | |
US20190294925A1 (en) | Systems and methods for intelligently curating machine learning training data and improving machine learning model performance | |
Ge et al. | Improving text classification with word embedding | |
CN108717408B (en) | Sensitive word real-time monitoring method, electronic equipment, storage medium and system | |
CN116304063B (en) | Simple emotion knowledge enhancement prompt tuning aspect-level emotion classification method | |
Sundararajan et al. | Multi-rule based ensemble feature selection model for sarcasm type detection in twitter | |
Quispe et al. | Using virtual edges to improve the discriminability of co-occurrence text networks | |
KR20200007713A (en) | Method and Apparatus for determining a topic based on sentiment analysis | |
CN110543564A (en) | Method for acquiring domain label based on topic model | |
CN113255340B (en) | Theme extraction method and device for scientific and technological requirements and storage medium | |
Subramanian et al. | A survey on sentiment analysis | |
CN108038106B (en) | Fine-grained domain term self-learning method based on context semantics | |
CN110688479A (en) | Evaluation method and sequencing network for generating abstract | |
CN111581364B (en) | Chinese intelligent question-answer short text similarity calculation method oriented to medical field | |
Jeyakarthic et al. | Optimal bidirectional long short term memory based sentiment analysis with sarcasm detection and classification on twitter data | |
CN113486670A (en) | Text classification method, device and equipment based on target semantics and storage medium | |
CN116757195A (en) | Implicit emotion recognition method based on prompt learning | |
CN111581984A (en) | Statement representation method based on task contribution degree | |
Sheng et al. | A paper quality and comment consistency detection model based on feature dimensionality reduction | |
Siji George | Genetic Algorithm Based Hybrid Model Of Convolutional Neural Network And Random Forest Classifier For Sentiment Classification | |
KR20070118154A (en) | Information processing device and method, and program recording medium | |
CN113761123A (en) | Keyword acquisition method and device, computing equipment and storage medium | |
CN114662488A (en) | Word vector generation method and device, computing device and computer-readable storage medium | |
Wang et al. | Content-based weibo user interest recognition |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |