A User Emotion Analysis Method for Psychological Counseling
By constructing a mental health emotional dictionary and using the Ebbinghaus forgetting curve for weight allocation, combined with the interactive attention mechanism, the problem of ignoring early dialogue content and forward neighbor sentences in the existing technology is solved, and the accuracy of user sentiment analysis in psychological counseling text is improved.
Patent Information
- Application Number
- CN202311024823.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-12
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2043-08-12
AI Technical Summary
When processing psychological counseling texts, the existing dialogue emotion analysis methods ignore the impact of early dialogue content and forward neighbor sentences on the user's current emotional state, resulting in a low accuracy of emotional classification.
By constructing a mental health emotional dictionary, we can identify emotional words in the historical text of both parties in the conversation, and use the Ebbinghaus forgetting curve to weight the sequence of historical emotional words to enhance the emotional characteristics of the text. At the same time, interactive attention mechanism is used to mine the user's own emotional transmission and the emotional interaction between the user and the consultant.
It improves the accuracy of user emotion analysis, can better capture changes in the user's current emotional state, and provides more accurate probability of emotional tendency, helping psychological counselors to conduct psychological intervention and support more effectively.
Smart Images

Figure CN117056511B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of natural language processing, and specifically to a method for user emotion analysis for psychological counseling. Background Art
[0002] When people seek psychological counseling, they often pour out their emotional troubles and inner contradictions, expressing mood swings and emotional needs. The words and tones of psychological counselors convey soothing and supportive information, making users feel understood and accepted. This kind of soothing and support helps to relieve users' anxiety and stress and improve their emotional state. Therefore, performing emotion analysis on users in psychological counseling texts, mining the emotional transmission of users themselves, as well as the emotional transfer generated in the interaction between users and counselors, and identifying the changes in users' emotions enable counselors to better understand users' emotional states, thereby effectively conducting psychological intervention and support, and also providing help for psychological counseling AI assistants to detect users' emotional changes in real time to generate appropriate responses.
[0003] Existing dialogue emotion analysis methods are mainly divided into three types: context-based modeling, speaker-based modeling, and external knowledge-based modeling. Context-based modeling methods capture the influence of context information on utterances and extract features for emotion classification by obtaining context information. Speaker-based modeling methods associate emotion analysis tasks with the characteristics and personalization of speakers, considering that different speakers may have different emotional expression ways and characteristics, so as to more accurately predict their emotional states. External knowledge-based modeling methods enhance the semantic understanding and emotion recognition capabilities of the model by using external language resources, emotion lexicons, knowledge graphs, etc. The above methods perform emotion analysis by taking the dialogue history text as a whole feature. However, during the dialogue process, as time goes by, the early dialogue content may gradually become blurred or forgotten, and the content of the first few sentences before the user's current sentence may have a strong emotional impact on the user's current state. The present invention defines the sentences that have a strong emotional impact on the user's current emotional state as forward neighboring sentences. Due to ignoring the different degrees of influence of the early dialogue content and forward neighboring sentences on the user's current emotional state, the classification accuracy is relatively low.
[0004] Aiming at the above deficiencies, the present invention proposes a method for user emotion analysis for psychological counseling. The difference of the present invention lies in that by constructing a mental health emotion lexicon, identifying emotion words in the historical texts of both parties in the dialogue, and using the Ebbinghaus forgetting curve to assign weights to the historical emotion word sequences, the emotional characteristics of the text are enhanced. At the same time, an interactive attention mechanism is used to mine the emotional transmission of users themselves and the emotional interaction between users and counselors. Summary of the Invention
[0005] The purpose of the present invention is to provide a user emotion analysis method for psychological counseling. First, the psychological counseling text is divided into the user's current sentence, the user's historical text, and the counselor's historical text, and the emotion word sequences of the historical texts of both parties in the conversation are extracted respectively using the constructed mental health emotion dictionary. Then, the current sentence and the historical emotion word sequences of both parties in the conversation are input into a BiLSTM to obtain corresponding feature vectors, and the historical emotion word sequences are weighted using the Ebbinghaus forgetting curve. Next, the user text features and the emotion features of both parties in the conversation are used to obtain inertial features and interaction features through an interactive attention mechanism, and the emotion tendency probability is calculated by combining the user text features and inputting them into Softmax.
[0006] The present invention adopts the following technical solutions to achieve the invention purpose:
[0007] A user emotion analysis method for psychological counseling, comprising the following steps:
[0008] Step 1: After preprocessing the data by noise reduction, word segmentation, and stop word removal, calculate the emotion tendency of the vocabulary to construct a mental health emotion dictionary. The basic steps are as follows:
[0009] Step 1.1: Noise reduction processing. Remove special symbols, extra spaces, and urls in the psychological counseling text.
[0010] Step 1.2: Word segmentation operation. Extract proper nouns in the field of psychology from four aspects: psychological counseling and psychotherapy, general psychology, personality psychology, and social psychology in the "Dictionary of Psychology", obtain the psychology word set, and when using the jieba word segmentation tool to segment the text, add the custom psychology word set to improve the accuracy of word segmentation of psychological counseling texts.
[0011] Step 1.3: Stop word removal processing. Remove the words that appear in the stop word list from the word segmentation results of the psychological counseling text.
[0012] Step 1.4: Obtain the seed word set and the candidate word set. By counting the number of times each vocabulary appears in the text and the number of documents in which it appears in the entire corpus, calculate the term frequency TF and the inverse document frequency IDF, and then calculate the TF-IDF value. Remove low-frequency words to obtain the candidate emotion word set, and screen out high-frequency words to obtain the positive and negative emotion seed word sets.
[0013] Step 1.5: Construct a mental health emotion dictionary. By calculating the PMI value between the candidate word set and the seed word set and performing a difference calculation, obtain the emotion value SO-PMI(w) of each word and compare it with the threshold to obtain the emotion tendency of the vocabulary, and then construct a mental health emotion dictionary.
[0014] The calculation formula of the emotion tendency point mutual information algorithm is as follows:
[0015]
[0016] Parameter description: w1 and w2 respectively represent sentiment words with undetermined sentiment polarities, Pw and Nw respectively represent positive and negative sentiment seed words, P(w1, w2) represents the probability of the co-occurrence of two words w1 and w2, P(w1) and P(w2) respectively represent the probabilities of the individual occurrences of the two words. When calculating the sentiment tendency of w1 with the seed words, if the final difference is greater than 0, w1 is a positive sentiment word; if it is equal to 0, it is a neutral word; if it is less than 0, it is a negative sentiment word.
[0017] Step 2: Preprocess the psychological counseling text to obtain the user's current text sequence, and combine with the mental health sentiment dictionary constructed in Step 1 to obtain the user's historical sentiment word sequence and the counselor's historical sentiment word sequence. The basic steps are as follows:
[0018] Step 2.1: First divide the psychological counseling text into three parts, namely the user's current sentence, the user's historical text, and the counselor's historical text, and then perform noise reduction, word segmentation, and stop word removal operations on the three parts. When using the jieba word segmentation tool for word segmentation, add a custom psychological word set for word segmentation operations. After the above processing, obtain the user's current text sequence, the user's historical text sequence, and the counselor's historical text sequence.
[0019] Step 2.2: Use the self-built mental health sentiment dictionary to match with the user's historical text sequence and the counselor's historical text sequence respectively. If the word in the historical text sequence is in the sentiment dictionary, keep it; otherwise, remove it. Thus, obtain the user's historical sentiment word sequence and the counselor's historical sentiment word sequence.
[0020] Step 3: For the user's current text sequence, the user's historical sentiment word sequence, and the counselor's historical sentiment word sequence obtained in Step 2, extract the corresponding feature vectors through BiLSTM and weighted processing. The basic steps are as follows:
[0021] Step 3.1: For the user's current text sequence, the user's historical sentiment word sequence, and the counselor's historical sentiment word sequence obtained in Step 2, use Word2Vec for word embedding training to obtain the word vectors of each word.
[0022] Step 3.2: Input the word vectors obtained from the training of the user's current text sequence into BiLSTM to obtain the text feature vector of the user's current sentence.
[0023]
[0024] Parameter description: represents the forward hidden state at time t, represents the backward hidden state at time t, ht represents the hidden state at time t, and H represents the user text feature vector.
[0025] Step 3.3: Input the word vectors obtained by training the user historical sentiment word sequence and the counselor historical sentiment word sequence into the BiLSTM respectively to obtain the corresponding user historical sentiment features and counselor historical sentiment features.
[0026] Step 3.4: Use the Ebbinghaus forgetting curve to assign weights to the user historical sentiment features and counselor historical sentiment features according to the positions of the sentiment word sequences to obtain the user weighted historical sentiment features and counselor weighted historical sentiment features. The weighted calculation process is as follows:
[0027]
[0028] Parameter description: β A (t) represents the weight function, c is 1.25, k is 1.84, α A (t) represents the weight value after weight constraint, represents the hidden state at time t, H AQ represents the user weighted historical sentiment features.
[0029]
[0030] Parameter description: β B (t) represents the weight function, c is 1.25, k is 1.84, α B (t) represents the weight value after weight constraint, represents the hidden state at time t, H BQ represents the counselor weighted historical sentiment features.
[0031] Step 4: For the three feature vectors obtained in Step 3, obtain the inertial features and interaction features through the interactive attention mechanism. The basic steps are as follows:
[0032] Step 4.1: For each hidden vector of each element of the user text feature vector, calculate the attention scores with each element in the user weighted historical sentiment features, and then perform weighted averaging to obtain the interactive representation of the user text features with respect to the user weighted historical sentiment features;
[0033]
[0034] Parameter description: represents the element h i and between the attention scores, f represents the function for calculating the similarity score of the element h i and similarity score, Represents the representation of user text features for the user's weighted historical sentiment features.
[0035] For the hidden vector of each element of the user's weighted historical sentiment features, calculate the attention scores between each element in the user text features, and then perform weighted averaging to obtain the interactive representation of the user's weighted historical sentiment features for the user text features;
[0036]
[0037] Parameter description: Represents an element The attention score between and h i f represents calculating the element The attention score between and h i The function for calculating the similarity score, Represents the interactive representation of the user's weighted historical sentiment features for the user text features.
[0038] Based on the above two interactive representations, obtain the inertial features of the interaction between the user's current emotional state and the user's historical emotional state.
[0039]
[0040] Parameter description: I represents the inertial features, W I and b I Represent the weights and bias terms of the inertial features.
[0041] Step 4.2: Process the user text features and the counselor's historical sentiment features in the same way as in Step 4.1, and then obtain the interactive features M of the emotional transfer between the user and the counselor.
[0042] Step 5: Integrate the features obtained in Step 3 and Step 4 and output them to the fully connected layer and Softmax to obtain the classification result. The basic steps are as follows:
[0043] Step 5.1: Integrate the user text features, inertial features, and interactive features.
[0044]
[0045] Parameter description: s represents the integration result of the user text features H, inertial features I, and interactive features M.
[0046] Step 5.2: Input the integrated feature vector into the Softmax layer through the fully connected layer to calculate the user's emotional tendency probability.
[0047]
[0048] Parameter description: W s and bs which are respectively represented as a weight matrix and a bias term, represent the prediction result. Description of the Drawings
[0049] Figure 1 is a flowchart of a user emotion analysis method for psychological counseling;
[0050] Figure 2 is a schematic diagram for constructing a mental health emotion dictionary;
[0051] Figure 3 is a schematic diagram of the process for obtaining user text features and weighted historical emotion word features based on BiLSTM;
[0052] Figure 4 is a schematic diagram of obtaining inertial features and interaction features based on an interactive attention mechanism. Detailed Embodiments
[0053] The present invention will be further explained and illustrated below through specific embodiments.
[0054] The present invention provides a user emotion analysis method for psychological counseling, as Figure 1 shown. The specific steps are as follows:
[0055] S1. After preprocessing the data by noise reduction, word segmentation, and stop word removal, calculate the emotional tendency of the vocabulary to construct a mental health emotion dictionary. The following Figure 2 is an explanation:
[0056] S1.1. Noise reduction processing. Remove a large number of special symbols (such as "@, #, %", etc.), extra spaces, and urls in the psychological counseling text.
[0057] S1.2. Word segmentation operation. First, obtain the psychological word set, and then apply the psychological word set to the word segmentation operation to improve the accuracy of the word segmentation result of the psychological counseling text.
[0058] S1.2.1. Extract the proper nouns in the field of psychology from the four aspects of psychological counseling and psychotherapy, general psychology, personality psychology, and social psychology in the "Dictionary of Psychology", such as "anxiety, empathy, post-traumatic stress disorder...", etc., to obtain the psychological word set;
[0059] S1.2.2. Use the jieba word segmentation tool to perform word segmentation on the psychological counseling text, such as "you / this / is / trauma / post / stress / disorder", and add the custom psychological word set to segment "you / this / is / post-traumatic stress disorder", regarding "post-traumatic stress disorder" (abbreviated as PTSD) as a psychological term to improve the word segmentation accuracy.
[0060] S1.3. Stop word processing. Remove the words in the stop word list from the psychological counseling text, such as "de", "zai", "huo", and "shi", etc., to obtain the words with the main content of the text.
[0061] S1.4. Obtain the seed word set and candidate word set. By counting the number of times each word appears in the text and the number of documents in which it appears in the entire corpus, calculate the term frequency TF and inverse document frequency IDF, and then calculate the TF-IDF value. Remove low-frequency words to obtain the candidate sentiment word set, and screen out high-frequency words to obtain the positive seed word set "like, love, happy, confident, happy, hardworking, etc.", and the negative sentiment seed word set "anxiety disorder, bad, fear, trouble, sad, etc.".
[0062] S1.5. Construct a mental health sentiment dictionary. By calculating the PMI value between the candidate word set and the seed word set, and performing a difference calculation, obtain the sentiment value SO-PMI(w) of each word and compare it with the threshold. Finally, when the difference is greater than 0, w is a positive sentiment word; when it is equal to 0, it is a neutral word; when it is less than 0, it is a negative sentiment word. Thus, obtain the sentiment tendency of the word, and further construct a mental health sentiment dictionary.
[0063] S2. Preprocess the psychological counseling text to obtain the user's current text sequence, and combine the mental health sentiment dictionary constructed in S1 to obtain the user's historical sentiment word sequence and the counselor's historical sentiment word sequence.
[0064] S2.1. Divide a psychological counseling text into three parts, the psychological counseling text where represents the user's consultation words in the i-th round. First, divide it into three parts, namely the user's current sentence the user's historical text and the counselor's historical text
[0065] S2.2. Perform noise reduction, word segmentation, and stop word removal operations on the text. When using the jieba word segmentation tool for word segmentation, add a custom psychological word set for word segmentation operations. After the above processing, obtain the user's current text sequence W, the user's historical text sequence W AH and the counselor's historical text sequence W BH .
[0066] S2.3. Further process the user's historical text and the counselor's historical text sequence. Use the constructed mental health sentiment dictionary to match with W AH , W BH respectively. When the word in the historical text sequence is in the mental health sentiment dictionary, keep it; otherwise, remove it. Thus, obtain the user's historical sentiment word sequence where Denote the i-th sentiment word in the user's historical text and the sequence of the counselor's historical sentiment words where Denote the i-th sentiment word in the counselor's historical text.
[0067] S3. For the user's current text sequence, the user's historical sentiment word sequence, and the counselor's historical sentiment word sequence obtained in S2, through BiLSTM and weighted processing, extract the corresponding feature vectors. Combine Figure 3 The following is an explanation
[0068] S3.1. For the obtained user's current text sequence W = {w1, w2, w3,..., w n}, the user's historical sentiment word sequence and the counselor's historical sentiment word sequence Use Word2Vec for word embedding training to obtain the word vectors of each word.
[0069] S3.2. Input the word vectors obtained from training the user's current text sequence into BiLSTM to obtain the text feature vector of the user's current sentence
[0070]
[0071] Parameter description: Denote the forward hidden state at time t, Denote the backward hidden state at time t, h t Denote the hidden state at time t, H denotes the user's text feature.
[0072] S3.3. Input the word vectors obtained from training the user's historical sentiment word sequence and the counselor's historical sentiment word sequence into BiLSTM respectively to obtain the corresponding user's historical sentiment feature and the counselor's historical sentiment feature
[0073]
[0074] Parameter description: Denote the hidden state at time t of the user's historical sentiment word sequence, H A Denote the user's historical sentiment feature. Denote the hidden state at time t of the counselor's historical sentiment word sequence, H B Denote the counselor's historical sentiment feature.
[0075] S3.4. Use the Ebbinghaus forgetting curve to assign weights to the user's historical sentiment feature and the counselor's historical sentiment feature according to the position of the sentiment word sequence to obtain the user's weighted historical sentiment feature and the counselor's weighted historical sentiment feature. The weighted calculation process is as follows:
[0076]
[0077] Parameter description: β A (t) represents the weight function, c is 1.25, k is 1.84, α A (t) represents the weight value after weight constraint, represents the hidden state at time t, H AQ represents the user's weighted historical sentiment feature.
[0078] Similarly, the counselor's weighted historical sentiment feature H is calculated BQ .
[0079] S4. For the three feature vectors obtained in S3, inertial features and interaction features are obtained through the interactive attention mechanism, combined with Figure 4 The following is an explanation:
[0080] S4.1. For each element's hidden vector of the user text feature vector, calculate the attention score with each element in the user's weighted historical sentiment feature, and then perform weighted averaging to obtain the interactive representation of the user text feature with respect to the user's weighted historical sentiment feature,
[0081]
[0082] Parameter description: represents the element h i and The attention score between them, f represents calculating the element h i and The function of the similarity score, expresses the interactive representation of the user text feature with respect to the user's weighted historical sentiment feature.
[0083] For each element's hidden vector of the user's weighted historical sentiment feature, calculate the attention score with each element in the user text feature, and then perform weighted averaging to obtain the interactive representation of the user's weighted historical sentiment feature with respect to the user text feature,
[0084]
[0085] Parameter description: represents the element and h i The attention score between them, f represents calculating the element and h i The function of the similarity score, expresses the interactive representation of the user's weighted historical sentiment feature with respect to the user text feature.
[0086] According to the above two interactive representations, the inertial feature of the interaction between the user's current sentiment state and the user's historical sentiment state is obtained.
[0087]
[0088] Parameter description: I represents the inertial feature, W I and b I represent the weight and bias terms of the inertial feature.
[0089] S4.2. Process the user text feature and the counselor's historical sentiment feature in the same way as S4.1, and then obtain the interaction feature of the emotional transfer between the user and the counselor.
[0090]
[0091] Parameter description: M represents the interaction feature, W M and b M represent the weight and bias terms of the inertial feature.
[0092] S5. Integrate the features of S3 and S4, and output them to the fully connected layer and the Softmax layer to calculate the user's emotional tendency probability.
[0093] S5.1. Integrate the user text feature obtained from S3 with the inertial feature and the interaction feature obtained from S4.
[0094]
[0095] Parameter description: s represents the integration result of the user text feature H, the inertial feature I, and the interaction feature M.
[0096] S5.2. Input the integrated feature vector into the Softmax layer through the fully connected layer to calculate the user's emotional tendency probability.
[0097]
[0098] Parameter description: W s and b s represent the weight matrix and the bias term respectively, represents the prediction result.
[0099] For those skilled in the art, it is obvious that the present invention is not limited to the details of the above exemplary embodiments, and the present invention can be implemented in other specific forms without departing from the spirit or basic characteristics of the present invention. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-restrictive. The scope of the present invention is defined by the appended claims rather than the above description. Therefore, all changes falling within the meaning and scope of the equivalent elements of the claims are intended to be included in the present invention. Any reference signs in the claims should not be regarded as limiting the claims involved.
[0100] In addition, it should be understood that although this specification is described according to embodiments, not every embodiment only contains an independent technical solution. This narrative manner of the specification is only for clarity. Those skilled in the art should regard the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.
Claims
1. A user emotion analysis method for psychological counseling, characterized in that It includes the following steps: Step 1: After preprocessing the psychological counseling dialogue corpus by noise reduction, word segmentation, and stop word removal, calculate the TF-IDF value of each word according to the word segmentation result and calculate the SO-PMI(w) value to construct a mental health emotion dictionary; Step 2: Preprocess the psychological counseling text to obtain the user's current text sequence, and combine the self-built mental health emotion dictionary to obtain the user's historical emotion word sequence and the counselor's historical emotion word sequence; Step 3: Obtain the user's text features through the BiLSTM model for the user's current text sequence, and pass the user's historical emotion word sequence and the counselor's historical emotion word sequence through the BiLSTM model respectively and perform weighted processing to obtain the user's historical emotion features and the counselor's historical emotion features; Step 4: Obtain the inertial features of the user's own emotion transfer through the interaction attention mechanism for the user's text features and the user's historical emotion features, and obtain the interaction features of the emotion transfer between the two through the interaction attention mechanism for the user's text features and the counselor's historical emotion features; Step 5: After fusing the obtained user's text features, inertial features, and interaction features, input them into the Softmax layer through the fully connected layer to calculate the user's emotion tendency probability; Among them, Step 4 includes: Step 4.1: For each element's hidden vector of the user's text feature vector, calculate the attention score with each element in the user's weighted historical emotion features, and then perform weighted average to obtain the interaction representation of the user's text features for the user's weighted historical emotion features, Among them, represents the attention score between element h i and f represents the function for calculating the similarity score between element h i and The function expresses the interactive representation of the user text features for the user weighted historical sentiment features. For each element's hidden vector of the user's weighted historical emotion features, calculate the attention score with each element in the user's text features, and then perform weighted average to obtain the interaction representation of the user's weighted historical emotion features for the user's text features, Among them, represents the attention score between the element i and h, f represents the function for calculating the similarity score between the element i and h, expresses the interactive representation of the user-weighted historical sentiment feature with respect to the user text feature. According to the above two interaction representations, obtain the inertial features of the interaction between the user's current emotion state and the user's historical emotion state, Among them, I represents the inertial feature, W I and b I represent the weight and bias term of the inertial feature; Step 4.2: Process the user's text features and the counselor's historical emotion features in the same way as Step 4.1 to obtain the interaction features of the emotion transfer between the user and the counselor, Among them, M represents the interaction feature, and W M and b M represent the weights and bias terms of the inertial features.
2. The method for user emotion analysis for psychological counseling according to claim 1, wherein Step 1 includes: Step 1.1: Noise reduction processing, removing special symbols, extra spaces, and urls in the psychological counseling text; Step 1.2: Word segmentation operation, extracting proper nouns in the field of psychology from four aspects of psychological counseling and psychotherapy, general psychology, personality psychology, and social psychology in the "Dictionary of Psychology" to obtain a set of psychological words. When using the jieba word segmentation tool to segment the text, add the custom set of psychological words to improve the accuracy of word segmentation of psychological counseling text; Step 1.3: Stop word removal processing, removing the words that appear in the stop word list from the word segmentation result of the psychological counseling text; Step 1.4: Obtain the seed word set and candidate word set. By counting the number of times each word appears in the text and the number of documents in which it appears in the entire corpus, calculate the term frequency TF and inverse document frequency IDF, and then calculate the TF-IDF value to obtain the positive and negative emotion seed word sets, as well as the candidate emotion word sets; Step 1.5: Construct a mental health emotion dictionary. By calculating the PMI values of the candidate word set and the seed word set, and performing a difference calculation, the emotion value SO-PMI(w) of each word is obtained and compared with the threshold, so as to obtain the emotion tendency of the word, and then a mental health emotion dictionary is constructed. The calculation formula is as follows: Where, w1 and w2 respectively represent emotion words with undetermined emotion polarities, Pw and Nw respectively represent positive and negative emotion seed words, P(w1, w2) represents the probability that two words w1 and w2 appear together, P(w1) and P(w2) respectively represent the probabilities that the two words appear alone. When calculating the emotion tendency of w1 with the seed words, if the final difference is greater than 0, w1 is a positive emotion word; if it is equal to 0, it is a neutral word; if it is less than 0, it is a negative emotion word.
3. The user emotion analysis method for psychological counseling according to claim 1, wherein Step 2 includes: Step 2.1: Divide a psychological counseling text into three parts, namely the user's current sentence, the user's historical text, and the counselor's historical text; Step 2.2: Perform noise reduction, word segmentation, and stop word removal operations on these three texts. When using the jieba word segmentation tool for word segmentation, add a custom psychological word set for word segmentation operations to obtain the user's current text sequence, the user's historical text sequence, and the counselor's historical text sequence; Step 2.3: Further process the user's historical text sequence and the counselor's historical text sequence. Using the constructed mental health emotion dictionary, match them with the user's and counselor's historical text sequences respectively, and extract the emotion words in the historical text sequences to obtain the user's historical emotion word sequence and the counselor's historical emotion word sequence.
4. The user emotion analysis method for psychological counseling according to claim 1, wherein Step 3 includes: Step 3.1: Use Word2Vec to perform word embedding training on the obtained user's current text sequence, the user's historical emotion word sequence, and the counselor's historical emotion word sequence to obtain the word vector of each word; Step 3.2: Input the word vector obtained by training the user's current text sequence into BiLSTM to obtain the text feature vector of the user's current sentence, H = {h1, h2, h3,..., h T} Among them, represents the forward hidden state at time t, represents the backward hidden state at time t, and h t represents the hidden state at time t, and H represents the user text feature; Step 3.3: Input the word vectors obtained by training the user's historical emotion word sequence and the counselor's historical emotion word sequence into BiLSTM respectively to obtain the corresponding user's historical emotion feature and the counselor's historical emotion feature, Among them, and respectively represent the hidden states of the user and the counselor's historical sentiment word sequences at time t, H A and H B respectively represent the user's historical sentiment features and the counselor's historical sentiment features; Use the Ebbinghaus forgetting curve to assign weights to the user's historical emotion feature and the counselor's historical emotion feature according to the position of the emotion word sequence to obtain the user's weighted historical emotion feature and the counselor's weighted historical emotion feature. The weighted calculation process is as follows: Among them, β A (t) represents a weight function, c is 1.25, k is 1.84, α A (t) represents the weight value after weight constraint, represents the hidden state at time t, H AQ represents the user-weighted historical sentiment feature; Among them, β B (t) represents a weight function, c is 1.25, k is 1.84, α B (t) represents the weight value after weight constraint, represents the hidden state at time t, H BQ represents the weighted historical emotional feature of the counselor.
5. The user emotion analysis method for psychological counseling according to claim 1, characterized in that Step 5 includes: Step 5.1: Integrate the user's text feature, inertia feature, and interaction feature, Where, s represents the integration result of the user's text feature H, inertia feature I, and interaction feature M; Step 5.2: Input the integrated feature vector into the Softmax layer through the fully connected layer to calculate the probability of the user's emotion tendency, Among them, W s and b s represent the weight matrix and the bias term respectively, indicating the prediction result.