A method and electronic device for fine-grained depressive emotion recognition in interview text based on large language model and emotion dictionary
By combining large language model and emotion dictionary, a deep neural network model is constructed to extract fine-grained emotional characteristics in interview text, and the shortcomings of large language models in the existing technology in recognition of depression emotions are solved, achieving more efficient and accurate depression Emotion recognition.
Patent Information
- Application Number
- CN202410644220.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-23
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2044-05-23
AI Technical Summary
In the prior art, in text-based depressive emotions recognition, there are shortcomings in the application of large language models, resulting in low recognition accuracy and efficiency, and lack of effective attention to fine-grained emotional changes.
A fine-grained depression emotion recognition method based on interview text based on large language model and emotion dictionary was used. The ChatGLM3-6b model was used to generate retelling texts through the command prompt template, construct an emotion dictionary and extract emotional features using the bart-large-mnli model, combining depth Neural network model performs emotion recognition.
It improves the accuracy and effectiveness of fine-grained depression emotions recognition, provides richer text emotions distribution characteristics, and enhances the interpretability of the recognition results.
Smart Images

Figure CN118504578B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of natural language processing detection technology, and more specifically to a method and electronic device for identifying fine-grained depressive emotions in interview texts based on a large language model and an emotion dictionary. Background Art
[0002] Depression is a common psychological disorder. Depressed patients may experience anxiety, helplessness, worthlessness, and guilt, and these symptoms may last for weeks, months, or even longer. Text-based depression recognition methods identify potential depressive tendencies by analyzing individual language expressions. These methods usually use natural language processing techniques, such as sentiment analysis and text classification, to identify language features related to depression. In the context of big data analysis, combined with related technologies of large language models, it can provide more powerful support for auxiliary diagnosis of depression. Analyze depression-related vocabulary, sentence structure, emotional expression, etc., so as to provide doctors with more comprehensive and accurate patient information and assist doctors in diagnosis and treatment.
[0003] In recent years, the use of deep learning technology in depression recognition has made some progress, among which a lot of work has been involved based on text, audio, vision, EEG, gait and other information. However, in text-based depression recognition, the use of large language models to assist depression detection is still insufficient, which limits the accuracy and efficiency of depression recognition, and is not conducive to the accuracy and efficiency of depression detection. As the model with the most language understanding and generation capabilities, it is valuable and meaningful to explore the application of large language models in the field of depression recognition. For example, there is currently work that integrates the acoustic feature information of speech into large language models for depression detection, there are also depression detection methods based on GPT to promote mental health diagnosis, and there are also large language models that summarize depression-related key points in text for analysis and diagnosis. Secondly, the current emotion recognition of depression is mainly based on face-to-face communication information collection. However, since this information is usually short and fragmented, it creates obstacles to the semantic understanding of the text analysis model, which affects the effect of the model. Text with complete sentence information and reasonable semantic structure is beneficial for both feature extraction of pre-trained language models and analytical interpretability. Regarding the completeness of sentence information, relevant work has proved that the question text and answer text in the interview record have an important impact on the final recognition results. Finally, the current depression recognition method is insufficient in parsing the subtle emotional changes in depression text, which reduces the accuracy and effectiveness of depression recognition. Among the many depression recognition methods, there are both text-based and audio-based and facial expression information, but they mainly focus on coarse-grained low-dimensional emotional distributions such as positive, neutral and negative, and lack attention to more comprehensive and fine-grained emotional information.
[0004] Therefore, how to provide a method and electronic device for fine-grained depression emotion recognition in interview texts based on a large language model and an emotion dictionary that can solve the above problems is an issue that technical personnel in this field urgently need to solve. Summary of the invention
[0005] In view of this, the present invention provides a method and electronic device for fine-grained depressive emotion recognition in interview texts based on a large language model and an emotion dictionary, so as to solve the technical problems existing in the above-mentioned prior art.
[0006] In order to achieve the above object, the present invention provides the following technical solutions:
[0007] A method for fine-grained depression emotion recognition in interview texts based on a large language model and emotion dictionary, including:
[0008] With the help of the instruction prompt template, the large language model ChatGLM3-6b is used to analyze the interview text and generate the restatement text;
[0009] Constructing an emotion dictionary, the emotion dictionary includes emotion categories and corresponding emotion words, and using the bart-large-mnli pre-trained language model to extract emotion features matching the restatement text with the emotion dictionary to obtain emotion feature matrices at different granularities;
[0010] A deep neural network model is constructed, and the deep neural network model is trained by selecting emotion feature matrices corresponding to different emotion words, and the trained deep neural network model is used for emotion recognition to obtain fine-grained depression emotion recognition results.
[0011] Preferably, the instruction prompt template uses the large language model ChatGLM3-6b to analyze the interview text and generate a restatement text, including:
[0012] Obtain the interview text X, divide the interview text X into question-answer pair sequences in order, and fill them into the custom-designed instruction prompt templates respectively to obtain the instruction prompt text;
[0013] The instruction prompt text is input into the large language model ChatGLM3-6b, and the restatement text is output. The interview text X is represented as the restatement text S = {S1, S2, ..., S i ,…,S n}.
[0014] Preferably, the interview text X is divided into a sequence of question-answer pairs in order, which is expressed as:
[0015] X={q1,a1,q2,a2,…,q i ,a i ,…,q n ,an}
[0016] Among them, q represents the question text, a represents the answer text, and n represents the number of question-answer pairs in the interview text X.
[0017] Preferably, the interview text X is divided into question-answer pairs in order, and the sequences are respectively filled into the custom-designed instruction prompt template to obtain the instruction prompt text, which includes:
[0018] The interview text X is divided into a sequence of question-answer pairs in order. Each question-answer pair is input into an instruction prompt template consisting of instructions, questions, answers, and restatement texts to obtain instruction prompt texts, where the instructions are custom designed and the question texts and answer texts are filled into the question-answer pairs respectively.
[0019] Preferably, the constructing of the sentiment dictionary includes:
[0020] Constructing the sentiment dictionary D set :emotion_dictionary, represented as:
[0021] D set ={emotion_word1,emotion_word2,…,emotion_word 279}
[0022] Among them, emotion_word represents the emotional word, and the emotional dictionary D set There are 279 emotion words in total;
[0023] Depending on the difficulty of the task, from D set Select different sizes of emotion subsets D subset , the emotion subset is expressed as:
[0024] D subset ={emotion_word1,emotion_word2,…,emotion_word j ,…,emotion_word m}
[0025] Where m≤279.
[0026] Preferably, the bart-large-mnli pre-trained language model is used to extract the emotional features of the restated text and the emotional dictionary to obtain the emotional feature matrix at different granularities, including:
[0027] Construct an emotion expression template, fill the emotion words of the emotion subset into the emotion expression template, and obtain the emotion hypothesis sentence set:
[0028] E={e1,e2,…,ej ,…,e m}
[0029] Among them, e j and e m Indicated by emotion_word j and emotion_wordx constitute the emotion expression sentence;
[0030] Will restate the text S in S i As a premise sentence, each sentence in E is used as a hypothesis sentence and combined into the bart-large-mnli pre-trained language model to obtain S i The one-dimensional sentiment vector f i :
[0031] f i = {pro i,1 ,pr oi,2 ,…,pro i,j ,…pro i,m}
[0032] Where i represents S i The number of the restatement text S, j represents the number of the emotion expression sentence in E; for each S in the restatement text S i The obtained f i Combine them to get the emotion feature matrix f:
[0033] f={f1,f2,…,f i ,…,f n}
[0034] Among them, f i Represented as S in the restatement text S i The resulting one-dimensional sentiment vector.
[0035] Preferably, the structure of the deep neural network model includes: a one-dimensional convolution layer, a maximum pooling layer, a multi-head attention layer and a linear layer;
[0036] The emotion feature matrix passes through three one-dimensional convolution layers with different convolution kernel sizes and two maximum pooling layers, then passes through a multi-head attention layer to learn sequence key information, and finally passes through a linear layer to obtain fine-grained depression emotion recognition results.
[0037] Preferably, the process expression of the emotion feature matrix after three one-dimensional convolution layers with different convolution kernel sizes and two maximum pooling layers is:
[0038] f conv1 =σ(f*W1+b1)
[0039] f pool1=max_pooling(f conv1 )
[0040] f conv2 =σ(f pool1 *W2+b2)
[0041] f pool2 =max_pooling(f conv2 )
[0042] f conv3 =σ(f pool2 *W3+b3)
[0043] Among them, f conv and f pool are the convolution and pooling outputs respectively, W1W2W3 are the weight matrices that need to be trained, b1b2b3 are the corresponding bias vectors, the activation function σ is the ReLU function, that is, σ(x)=max(0,x), max_pooling is the maximum pooling layer, and f is the emotion feature matrix.
[0044] Preferably, the process expression of learning the key information of the sequence through a multi-head attention layer and finally obtaining the fine-grained depression emotion recognition result through a linear layer is:
[0045] MHA=Attention(Q,K,V)
[0046] Q=f conv3 *W Q +b Q
[0047] K=f conv3 *W K +b K
[0048] V=f conv3 *W V +b V
[0049] Y=σ(MHA*W f +b f )
[0050] Where W Q W K W V are the weight matrices for query, key, and value, respectively, and b Q b K b Vis the corresponding bias vector, QKV is the query matrix, key matrix and value matrix respectively. Attention() means to aggregate the sequence information by weighting V by the matching scores of Q and K to obtain the output MHA of the multi-head attention layer. W f is the weight matrix of the fully connected layer, b f is the corresponding bias vector.
[0051] An electronic device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, a method for fine-grained depressive emotion recognition in interview texts based on a large language model and an emotion dictionary is implemented.
[0052] Through the above technical solutions, it can be known that compared with the prior art, the present invention discloses a method and electronic device for fine-grained depression recognition of interview texts based on a large language model and an emotion dictionary. By using the powerful language understanding and generation capabilities of the large language model ChatGLM3-6b, an instruction prompt template is constructed, the interview text is analyzed, and the restatement text with clear semantics and complete sentences is generated. This new method not only improves the quality of the text, but also provides richer information for depression recognition. In order to extract the most comprehensive and complete text emotion distribution features, the present invention constructs an emotion dictionary, which contains more detailed emotion categories and corresponding emotion vocabulary. The bart-large-mnli pre-trained language model is used to extract emotion features matching the emotion dictionary. According to the specificity of the depression analysis task, subsets of emotion dictionaries of different scales are selected to obtain different emotion feature matrices. A deep neural network model is constructed, and emotion features are learned using multi-layer one-dimensional convolution, pooling, and attention mechanisms to achieve fine-grained depression recognition. This method not only improves the accuracy of fine-grained depression recognition, but also has good interpretability. These innovative methods provide new perspectives and directions for the study of depression emotion recognition, and are expected to promote further development in the field of deep learning-assisted depression diagnosis. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0054] Figure 1 It is a schematic diagram of the method flow of the present invention;
[0055] Figure 2Schematic diagram of the overall framework of the recognition process provided by the present invention. DETAILED DESCRIPTION
[0056] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0057] See also Figure 1 The embodiment of the present invention discloses a method for fine-grained depression emotion recognition in interview texts based on a large language model and an emotion dictionary, comprising:
[0058] With the help of the instruction prompt template, the large language model ChatGLM3-6b is used to analyze the interview text and generate the restatement text;
[0059] Constructing an emotion dictionary, the emotion dictionary includes emotion categories and corresponding emotion words, and using the bart-large-mnli pre-trained language model to extract emotion features matching the restatement text with the emotion dictionary to obtain emotion feature matrices at different granularities;
[0060] A deep neural network model is constructed, and the deep neural network model is trained by selecting emotion feature matrices corresponding to different emotion words, and the trained deep neural network model is used for emotion recognition to obtain fine-grained depression emotion recognition results.
[0061] In a specific embodiment, in response to the problems existing in the prior art, the present invention firstly analyzes the interview text by using the powerful language understanding and generation capabilities of the large language model ChatGLM3-6b in conjunction with the instruction prompt template, and generates a restatement text with clear semantics and complete sentences. Secondly, an emotion dictionary is constructed, which contains more detailed emotion categories and corresponding emotion vocabulary, and the bart-large-mnli pre-trained language model is used to extract emotion features that match the emotion dictionary. By selecting different emotion words, the emotion feature matrix at different granularities is obtained. A deep neural network model is constructed, and multi-layer one-dimensional convolution, pooling and attention mechanisms are used to learn emotion features to achieve fine-grained depression recognition. For simpler binary depression classification tasks, more complex fine-grained depression classification tasks and regression tasks, emotion subsets of different scales are flexibly selected to adapt to the difficulty of the task.
[0062] The framework of the present invention is as follows Figure 2As shown in the figure, the framework overview is as follows: The problem is defined as follows: According to the conversational nature of the interview, the conversation text X between the subject and the subject consists of question-answer pairs arranged in chronological order, which can be expressed as X = {q1, a1, q2, a2, …, q i ,a i ,…,q n ,a n}, after the model’s mapping function f, the output is Y.
[0063] Y=f(X)#(1)
[0064] Here, i represents the serial number of the question-answer pair, and there are n question-answer pairs in total. For classification tasks, Y represents the classification result, and for regression tasks, Y represents the regression value.
[0065] like Figure 2 As shown in the figure, the entire framework can be divided into three layers from top to bottom, namely, the large language model text restatement layer, the pre-trained language model emotion feature extraction layer, and the deep neural network training layer. First, in the large language model text restatement layer, the interview text X is divided into question-answer pairs in order and filled into the custom-designed instruction prompt template. The present invention selects the ChatGLM3-6b large language model to complete the text restatement task, inputs the instruction prompt text, and obtains the restatement text S i , that is, the text X can be further expressed as S = {S1, S2, ..., S i ,…,S n Then, in the emotion feature extraction layer of the pre-trained language model, an emotion dictionary D with rich emotion categories is introduced. set :emotion_dictionary, represented as:
[0066] D set ={emotion_word1,emotion_word2,…,emotion_word 279}
[0067] Among them, emotion_word represents the emotional word, and the emotional dictionary D set There are 279 emotion words in total;
[0068] According to the difficulty of the task, select emotion subsets of different dimensional sizes. For classification tasks, you can choose a low-dimensional emotion subset, and for regression tasks, you can choose a high-dimensional emotion subset. The emotion subset can be expressed as:
[0069] D subset ={emotion_word1,emotion_word2,…,emotion_word j ,…,emotion_word m}
[0070] Where m≤279. Using the template, construct the emotion expression sentence e={e1,e2,…,e j ,…,e m}, where e j and e m Indicated by emotion_word j and emotion_word m Emotional expression sentences such as j = Emotional expression sentence "I feel emotion_word j ”, respectively, and restate the S in the text i Input into the pre-trained text classification model bart-large-mnli to obtain the sentiment distribution feature vector:
[0071] f i = {pro i,1 ,pro i,2 ,…,pro i,j …,pro i,m};
[0072] Among them, pro i,j Yes j and S i The probability value of emotional consistency between i,j ∈[0,1], and finally the emotional feature matrix f={f1,f2,…,f i ,…f n In the deep neural network training layer, the feature matrix passes through three layers of one-dimensional convolution with different convolution kernel sizes and two layers of maximum pooling, and then passes through a layer of multi-head attention to learn the key information of the sequence, and finally passes through a linear layer to obtain the fine-grained depression classification or regression result Y.
[0073] In a specific embodiment, the large language model text restatement layer includes:
[0074] This embodiment is applied to automatic depression detection based on interview text, because the conversation text in the interview scenario shows obvious incoherence, repetitiveness, omission and ambiguity, as well as errors and irregularities in language use. These characteristics make the analysis and interpretation of interview conversation texts more complicated than written texts, and multiple factors such as context and interview background need to be considered. The current pre-trained language models, such as GPT-3, BERT, RoBERTa, etc., mostly use written standard texts from books, articles, and web pages. Therefore, compared with directly extracting features from the interview conversation text, the feature information extracted from the conversation text after the large language model is restated should be more effective. ChatGLM3-6b is an open source Chinese and English pre-trained language model that can be used for a variety of natural language processing tasks, such as text classification, machine translation, text generation, etc. The model has been pre-trained on Chinese and English corpora and has good cross-language capabilities, so the present invention uses this model as the basic model for question-answer text restatement.
[0075] First, the interview text in the real scenario can be expressed as:
[0076] X={q1,a1,q2,a2,…,q i ,a i ,…,q n ,a n};
[0077] Where q represents the question text, a represents the answer text, and n represents the number of question-answer pairs in sample X. Each question-answer pair is input into the instruction prompt template consisting of instruction, question, answer, and restatement text. The instruction is custom designed. Fill in the question-answer pair and input the instruction prompt template into ChatGLM3-6b to obtain the question-answer pair restatement text S. Figure 2 Q n and a n For example, the complete command prompt template is as follows:
[0078] Instructions: The following is the question asked by the questioner and the answer to the question by the respondent. The answer may be a bit messy, so please try to use the original words and sentences, and write a declarative sentence from the respondent's perspective in the first person to combine the question and answer. Do not add or delete anything.
[0079] Question: How did you feel at that moment?
[0080] Answer: I feel energized and fulfilled. I feel like I can do it all.
[0081] Restate the text: In that moment, I felt energized, fulfilled, and satisfied, as if I could accomplish anything.
[0082] From top to bottom, they are predefined instructions, questions and answers, and the generated text of the large language model. The final restated dialogue is:
[0083] S={S1,S2,…,S i ,…,S n}#(2)
[0084] S i Compared with the original question-answer pair, the sentence is fluent, semantically complete, and has a clear structure, which is helpful whether it is used directly for pre-trained language models to extract embedded representations or for other text-based feature extraction.
[0085] In a specific embodiment, the pre-trained language model emotion feature extraction layer includes:
[0086] The restatement of the interview text is obtained as S = {S1, S2, ..., S i , ..., S n}After that, in order to extract the emotional feature matrix respectively, the present invention introduces an emotional dictionary, which covers a variety of expression words of various emotions, a total of 279 emotional words. At the same time, in order to extract the emotional vocabulary and the S in the restatement text i The present invention uses the pre-trained language model bart-large-mnli to establish a connection between them. BART is a Transformer-based pre-trained model for natural language processing tasks, and bart-large-mnli is a model that Facebook fine-tuned for multi-domain natural language inference (MNLI) tasks based on the BART model. The MNLI dataset is a large-scale multi-domain natural language inference dataset that contains sentence pairs in multiple fields. By fine-tuning on the MNLI dataset, the bart-large-mnli model can better handle text classification tasks in multiple fields.
[0087] Specifically, the emotion dictionary D set :emotion_dictionary can be expressed as:
[0088] D set ={emotion_Word1, emotion_Word2,..., emotion_word 279}#(3)
[0089] More specifically, in actual use, different sizes of emotion dictionary subsets are generally selected according to the difficulty of the task. For a relatively simple binary depression emotion classification task, six emotion words, sadness, joy, love, anger, fear, and surprise, can be selected. For a more complex fine-grained depression emotion classification and regression task, a more comprehensive emotion subset or full set can be selected. The emotion subset can be expressed as:
[0090] D subset ={emotion_word1,emotion_word2,...,emotion_word j , ..., emotion_word m}#(4)
[0091] Where m≤279. The input of the bart-large-mnli model is a sentence pair, which is a premise sentence and a hypothesis sentence respectively, and outputs a probability value pro∈[0,1], which indicates the confidence of the hypothesis that can be inferred based on the premise. Therefore, the present invention also designs an emotion expression template sentence "I feel (emotion word )”, fill the emotion words of the emotion subset into the template to obtain the emotion hypothesis sentence set:
[0092] E = {e1, e2, ..., e j , ..., e m}#(5)
[0093] where e j and e m Indicated by emotion_word j and emotion_word m Emotional expression sentences, such as j =I feel emotion_word j , will restate the S in the text i As the premise sentence, each sentence in E is used as a hypothesis sentence and combined into bart-large-mnli to get S i The one-dimensional sentiment vector f i :
[0094] f i = {pro i,1 , pro i,2 ,…,pro i,j ,...pro i,m}#(6)
[0095] Where i represents S iis the serial number of the restated text S, and j is the serial number of the emotional expression sentence in E. Finally, for each S in the restated text S i The obtained f i Combine them to get the emotion feature matrix f:
[0096] f={f1,f2,...,f i ..., f n}#(7)
[0097] In one specific embodiment, the deep neural network training layer includes:
[0098] The interview text X is a serialized text with a time sequence. Correspondingly, the emotional feature matrix f is also a serialized two-dimensional feature matrix with a time sequence. The present invention uses multi-layer one-dimensional convolution, maximum pooling and attention mechanism to learn the relationship between sequences and capture key features. Finally, the classic linear layer is used to complete the classification and regression tasks. Multi-layer one-dimensional convolution and pooling layers help to extract the temporal local patterns of emotional features and simplify the model by reducing the dimension, while the multi-head attention layer provides global context understanding, captures long-distance dependencies, and dynamically assigns weights to different emotional features in the sequence. The combination of these two layers provides an effective tool for understanding and predicting the changes of emotional states over time.
[0099] Specifically, there are three one-dimensional convolution layers, and the convolution kernel size increases from 9 to 5 and then to 3. Features of different scales are captured at different levels, and the feature learning process from local to global and from specific to abstract is achieved by gradually reducing the convolution kernel size. Two maximum pooling layers are added in the middle to gradually reduce the feature dimension, retain key information and prevent overfitting. This process can be expressed by the formula:
[0100] f conv1 =σ(f*W1+b1)#(8)
[0101] f pool1 =max_pooling(f conv1 )#(9)
[0102] f conv2 =σ(f pool1 *W2+b2)#(10)
[0103] f pool2 =max_pooling(f conv2 )#(11)
[0104] f conv3 =σ(f pool2 *W3+b3)#(12)
[0105] Among them, fconv and f pool are the convolution and pooling outputs respectively, W1W2W3 is the weight matrix to be trained, b1b2b3 is the corresponding bias vector, the activation function σ is the ReLU function, that is, σ(x=max(0,x), max_pooling is the maximum pooling layer, and f is the emotion feature matrix.
[0106] The convolution output continues to serve as the input of the subsequent multi-head attention layer and linear layer, and finally obtains the classification or regression result Y, which is expressed by the formula:
[0107] MHA=Attention(Q,K,V)#(13)
[0108] Q=f conv3 *W Q +b Q #(14)
[0109] K=f conv3 *W K +b K #(15)
[0110] V=f conv3 *W V +b V #(16)
[0111] Y=σ(MHA*W f +b f )#(17)
[0112] Where W Q W K W V are the weight matrices for query, key, and value, respectively, and b Q b K b V is the corresponding bias vector, QKV is the query matrix, key matrix and value matrix respectively. Attention() means to aggregate the sequence information by weighting V by the matching scores of Q and K to obtain the output MHA of the multi-head attention layer. W f is the weight matrix of the fully connected layer, b f is the corresponding bias vector.
[0113] Specifically, this embodiment proposes a method for fine-grained depression emotion recognition in interview texts based on a large language model and a sentiment dictionary, combines the large language model with the pre-trained language model, and uses the sentiment dictionary to deeply analyze the fine-grained emotional feature distribution in the text, providing a new idea and technical means for depression detection.
[0114] On the other hand, an embodiment of the present invention discloses an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the above-mentioned method for fine-grained depressive emotion recognition in interview texts based on a large language model and an emotion dictionary are implemented.
[0115] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0116] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for fine-grained depressive emotion recognition in interview texts based on a large language model and an emotion dictionary, characterized in that: include: With the help of the instruction prompt template, the large language model ChatGLM3-6b is used to analyze the interview text and generate a restatement text, including: Obtain the interview text X, divide the interview text X into question-answer pair sequences in order, and fill them into the custom-designed instruction prompt templates respectively to obtain the instruction prompt text; The interview text X is divided into question-answer pair sequences in order, which can be expressed as: X={q1,a1,q2,a2,…,q i ,a i ,…,q n ,a n } Where q represents the question text, a represents the answer text, and n represents the number of question-answer pairs in the interview text X; The interview text X is divided into question-answer pairs in order, and each pair is filled into a custom-designed instruction prompt template to obtain an instruction prompt text including: The interview text X is divided into a sequence of question-answer pairs in order, and each question-answer pair is input into an instruction prompt template consisting of an instruction, a question, an answer, and a restatement text to obtain an instruction prompt text, where the instruction is a custom design, and the question text and the answer text are filled into the question-answer pair respectively; The instruction prompt text is input into the large language model ChatGLM3-6b, and the restatement text is output. The interview text X is represented as the restatement text S = {S1, S2, ..., S i ,…,S n }; Construct an emotion dictionary, which includes emotion categories and corresponding emotion words, and use the bart-large-mnli pre-trained language model to extract the emotion features that match the restatement text with the emotion dictionary, and obtain the emotion feature matrix at different granularities, including: Construct an emotion expression template, fill the emotion words of the emotion subset into the emotion expression template, and obtain the emotion hypothesis sentence set: E={e1,e2,…,e j ,…,the m } Among them, e j and e m Indicated by emotion_word j and emotion_word m Emotional expression sentences; Will restate the text S in S i As a premise sentence, each sentence in E is used as a hypothesis sentence and combined into the bart-large-mnli pre-trained language model to obtain S i The one-dimensional sentiment vector f i : F i ={for i,1 ,for i,2 ,…,for i,j ,…for i,m } Where i represents S i The number of the restatement text S, j represents the number of the emotion expression sentence in E; for each S in the restatement text S i The obtained f i Combine them to get the emotion feature matrix f: f={f1,f2,…,f i ,…,f n } Among them, f i Represented as S in the restatement text S i The resulting one-dimensional sentiment vector; A deep neural network model is constructed, and the deep neural network model is trained by selecting emotion feature matrices corresponding to different emotion words, and the trained deep neural network model is used for emotion recognition to obtain fine-grained depression emotion recognition results.
2. According to claim 1, a method for fine-grained depression emotion recognition in interview text based on a large language model and an emotion dictionary is characterized in that: The constructing of the sentiment dictionary includes: Constructing the sentiment dictionary D set :emotion_dictionary, represented as: D set ={emotion_word1,emotion_word2,…,emotion_word 279 } Among them, emotion_word represents the emotional word, and the emotional dictionary D set There are 279 emotion words in total; Depending on the difficulty of the task, from D set Select different sizes of emotion subsets D subset , the emotion subset is expressed as: D subset = {emotion_word1,emotion_word2,…,emotion_word j ,…,emotion_word m}, where m ≤ 279.
3. According to claim 1, a method for fine-grained depressive emotion recognition in interview text based on a large language model and an emotion dictionary is characterized in that: The structure of the deep neural network model includes: a one-dimensional convolution layer, a maximum pooling layer, a multi-head attention layer and a linear layer; The emotion feature matrix passes through three one-dimensional convolution layers with different convolution kernel sizes and two maximum pooling layers, then passes through a multi-head attention layer to learn sequence key information, and finally passes through a linear layer to obtain fine-grained depression emotion recognition results.
4. According to claim 3, a method for fine-grained depressive emotion recognition in interview text based on a large language model and an emotion dictionary is characterized in that: The process expression of the emotion feature matrix after three one-dimensional convolution layers with different convolution kernel sizes and two maximum pooling layers is: f conv1 =σ(f*W1+b1) f pool1 =max_pooling(f conv1 ) f conv2 =σ(f pool1 *W2+b2) f pool2 =max_pooling(f conv2 ) f conv3 =σ(f pool2 *W3+b3) Among them, f conv and f pool are the convolution and pooling outputs respectively, W1W2W3 are the weight matrices that need to be trained, b1b2b3 are the corresponding bias vectors, the activation function σ is the ReLU function, that is, σ(x)=max(0,x), max_pooling is the maximum pooling layer, and f is the emotion feature matrix.
5. According to claim 3, a method for fine-grained depressive emotion recognition in interview text based on a large language model and an emotion dictionary is characterized in that: The process expression of learning the key information of the sequence through a multi-head attention layer and finally obtaining the fine-grained depression emotion recognition result through a linear layer is: MHA=Attention(Q,K,V) Q=f conv3 *W Q +b Q K=f conv3 *W K +b K V=f conv3 *W V +b V Y=σ(MHA*W f +b f ) Where W Q W K W V are the weight matrices for query, key, and value, respectively, and b Q b K b V is the corresponding bias vector, W f is the weight matrix of the fully connected layer, b f is the corresponding bias vector, QKV are the query matrix, key matrix and value matrix respectively, and Attention() means weighting V by the matching scores of Q and K, aggregating the sequence information, and obtaining the output MHA of the multi-head attention layer.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method for fine-grained depressive emotion recognition in interview text based on a large language model and an emotion dictionary is implemented as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Automated classification of emotio-cogniton
CA3207044A1
Depression emotion detection method and system based on soft prompt topic modeling
CN116992867A