Generative dialogue method and system based on mental health scale

Through a generative dialogue method based on the mental health scale, the scale database and deep learning model are used to solve the problem of insufficient interaction and timeliness of existing psychological counseling tools, and the flexible response to users' complex emotions and personalized needs is achieved. Large-scale mental health monitoring intervention.

CN119252485APending Publication Date: 2025-01-03NEWLAND DIGITAL TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411349150.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-26
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

Existing psychological counseling tools cannot flexibly respond to users' complex emotions and personalized needs, and the interaction is insufficient in a timely manner. Traditional mental health scales require professional explanations to be explained by professionals to achieve large-scale timely monitoring and intervention.

Method used

Generative dialogue method based on the mental health scale, through creating a scale database, generating a question-and-answer library, using word embedding modules and LSTM modules, dynamically adjusting the scales and models with user information, realizing dialogue content generation and optimization .

Benefits of technology

It improves the interactivity and timeliness of psychological counseling, and can flexibly respond to users' complex emotions and personalized needs, without the need for professional guidance, and achieve large-scale and timely mental health monitoring and intervention.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119252485A_ABST
    Figure CN119252485A_ABST
Patent Text Reader

Abstract

The invention provides a generative dialogue method and system based on psychological health scales in the technical field of psychological counseling. The method comprises the following steps: S1, acquiring a large number of psychological health scales, generating a question and answer library based on each psychological health scale, and generating a scale question and answer set based on the question and answer library; s2, training the generative dialogue model by using the scale question and answer set; s3, acquiring input user information, matching a corresponding mental health scale from the scale database based on the user information, and converting the mental health scale into a corresponding scale question; s4, inputting the scale questions into the generative dialogue model, outputting dialogue questions, obtaining user answers input based on the dialogue questions, and generating dialogue contents based on the dialogue questions and the user answers; and S5, dynamically adjusting the mental health scale based on the dialogue content, and optimizing the generative dialogue model. The psychological counseling system has the advantage that the interactivity and timeliness of psychological counseling are greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of psychological counseling technology, and in particular to a generative dialogue method and system based on a mental health scale. Background Art

[0002] With the acceleration of social pace and the increase of life pressure, mental health problems are becoming more and more common. When people have mental health problems, they need to seek help from psychologists; however, the number of psychologists is limited, and the cost of seeking help from psychologists is high and the time is inflexible, making it difficult for many people to obtain timely and effective psychological help.

[0003] Psychological counseling tools based on chatbots can overcome the above problems to a certain extent. However, most of these psychological counseling tools are based on preset dialogue scripts and cannot flexibly respond to users' complex emotions and personalized needs, that is, they are not interactive enough, resulting in limited psychological counseling effects. Traditional mental health scales require guidance and explanation from professionals, making it difficult to achieve large-scale and timely mental health monitoring and intervention.

[0004] Therefore, how to provide a generative dialogue method and system based on the mental health scale to improve the interactivity and timeliness of psychological counseling has become a technical problem that needs to be solved urgently. Summary of the invention

[0005] The technical problem to be solved by the present invention is to provide a generative dialogue method and system based on the mental health scale to improve the interactivity and timeliness of psychological counseling.

[0006] In a first aspect, the present invention provides a generative dialogue method based on a mental health scale, comprising the following steps:

[0007] Step S1, creating a scale database, acquiring a large number of mental health scales and storing them in the scale database, generating a question-and-answer database based on each mental health scale, and generating a scale question-and-answer set based on the question-and-answer database;

[0008] Step S2: creating a generative dialogue model based on the word embedding module and the LSTM module, and training the generative dialogue model using the scale question and answer set;

[0009] Step S3, obtaining input user information, storing the user information in a pre-created user database, matching a corresponding mental health scale from a scale database based on the user information, and converting the mental health scale into corresponding scale questions;

[0010] Step S4: input each of the scale questions into a generative dialogue model, output the dialogue question, obtain the user's answer based on the dialogue question input, and generate dialogue content based on each of the dialogue questions and the user's answer;

[0011] Step S5: dynamically adjust the mental health scale based on the conversation content, and optimize the generative conversation model.

[0012] Furthermore, the step S1 is specifically as follows:

[0013] Create a scale database, obtain a large number of mental health scales and store them in the scale database, set user profiles for each mental health scale, and generate a structured question-and-answer database based on each mental health scale, wherein the question-and-answer database records scale questions, answer options corresponding to the scale questions, and scoring criteria corresponding to each answer option;

[0014] A scale question and answer set including a number of scale questions and corresponding answer options is generated based on the question and answer library, and each scale question in the scale question and answer set is labeled with a psychological problem and a dialogue scene; the psychological problems include at least depression, anxiety and neutrality.

[0015] Furthermore, the step S2 is specifically as follows:

[0016] Create a generative dialogue model based on the word embedding module and the LSTM module;

[0017] The word embedding module is built based on Word2Vec's CBOW and is used to associate the scale questions and annotations in the scale question and answer set. The objective function is:

[0018]

[0019] Where T represents the total number of words in the scale question and answer set; w t represents the central word in each word to predict the psychological problem; t-c and w t+c represents the context words associated with the central word, and the context window size is c; logP(w t |w t-c ,...,w t+c ) represents the probability of predicting the central word through the context words; Indicates the wth t The word vector of the central word; Indicates the wth t The word vector of the context word of the central word; V represents the size of the vocabulary consisting of words in the scale question and answer set; represents the average vector representation of all context words;

[0020] The LSTM module is used to capture the long-term dependencies of the context in the scale question and answer set, uses the cross entropy function as the loss function, and uses the Adam optimizer for compilation; the formula of the loss function is:

[0021]

[0022] Among them, L represents the loss value of the loss function; N represents the number of samples in the scale question-answer set; C represents the number of categories of psychological problems; y i,c represents the true label of sample i, that is, the real psychological problem; represents the predicted probability of sample i;

[0023] The training set is divided into a training set and a validation set in a ratio of 7:3, and the generative dialogue model is trained using the training set until the loss value of the loss function is less than a preset loss threshold, and then the trained generative dialogue model is verified using the validation set to determine whether the prediction accuracy is greater than the preset accuracy threshold. If so, the training is terminated; if not, the training set is expanded to continue training the generative dialogue model;

[0024] The calculation formula of the prediction accuracy is:

[0025] Accuracy=(TP+TN) / (TP+TN+FP+FN);

[0026] Among them, Accuracy represents the prediction accuracy; TP represents true positive examples, that is, the number of examples that were originally True and predicted to be True; FN represents false negative examples, that is, the number of examples that were originally True and predicted to be False; TN represents true negative examples, that is, the number of examples that were originally False and predicted to be False; FP represents false positive examples, that is, the number of examples that were originally False and predicted to be True; True and False represent the true and false of psychological problems respectively.

[0027] Furthermore, the step S3 is specifically as follows:

[0028] Obtaining input user information, the user information at least including gender, age, occupation, educational background, marital status, and psychological self-evaluation;

[0029] The user information is stored in a pre-created user database, and the access rights and identity authentication mechanism of the user database are set; the access rights are to add, delete, modify or query; the identity authentication mechanism is specifically:

[0030] Obtain an input database access request carrying an account number, password, timestamp, device serial number, and hash value, where the hash value is obtained by hashing the account number, password, timestamp, and device serial number; after performing integrity check on the account number, password, timestamp, and device serial number using the hash value, perform timeliness check using the timestamp, then verify the device serial number using a preset device management table, and then perform legitimacy check using the account number and password to complete identity authentication;

[0031] A user portrait is generated based on the user information, a corresponding mental health scale is matched from a scale database based on the user portrait, and the mental health scale is converted into corresponding scale questions.

[0032] Furthermore, the step S5 is specifically as follows:

[0033] Perform sentiment analysis on the conversation content through natural language processing technology to generate a mental health assessment result, display the mental health assessment result, obtain assessment feedback for the mental health assessment result, dynamically adjust the mental health scale based on the assessment feedback, and optimize the generative dialogue model based on the adjusted mental health scale to adjust the output dialogue questions and the output order of each dialogue question.

[0034] In a second aspect, the present invention provides a generative dialogue system based on a mental health scale, comprising the following modules:

[0035] A scale question and answer set generation module is used to create a scale database, obtain a large number of mental health scales and store them in the scale database, generate a question and answer library based on each mental health scale, and generate a scale question and answer set based on the question and answer library;

[0036] A generative dialogue model training module, used to create a generative dialogue model based on the word embedding module and the LSTM module, and train the generative dialogue model using the scale question and answer set;

[0037] A user information input module, used to obtain input user information, store the user information in a pre-created user database, match a corresponding mental health scale from a scale database based on the user information, and convert the mental health scale into corresponding scale questions;

[0038] A dialogue module, used to input each of the scale questions into a generative dialogue model, output the dialogue questions, obtain user answers based on the dialogue questions input, and generate dialogue content based on each of the dialogue questions and the user answers;

[0039] A dynamic optimization module is used to dynamically adjust the mental health scale based on the conversation content and optimize the generative conversation model.

[0040] Furthermore, the scale question and answer set generation module is specifically used for:

[0041] Create a scale database, obtain a large number of mental health scales and store them in the scale database, set user profiles for each mental health scale, and generate a structured question-and-answer database based on each mental health scale, wherein the question-and-answer database records scale questions, answer options corresponding to the scale questions, and scoring criteria corresponding to each answer option;

[0042] A scale question and answer set including a number of scale questions and corresponding answer options is generated based on the question and answer library, and each scale question in the scale question and answer set is labeled with a psychological problem and a dialogue scene; the psychological problems include at least depression, anxiety and neutrality.

[0043] Furthermore, the generative dialogue model training module is specifically used for:

[0044] Create a generative dialogue model based on the word embedding module and the LSTM module;

[0045] The word embedding module is built based on Word2Vec's CBOW and is used to associate the scale questions and annotations in the scale question and answer set. The objective function is:

[0046]

[0047] Where T represents the total number of words in the scale question and answer set; w t represents the central word in each word to predict the psychological problem; t-c and w t+c represents the context words associated with the central word, and the context window size is c; logP(w t |w t-c ,...,w t+c ) represents the probability of predicting the central word through the context words; Indicates the wth t The word vector of the central word; Indicates the wth t The word vector of the context word of the central word; V represents the size of the vocabulary consisting of words in the scale question and answer set; represents the average vector representation of all context words;

[0048] The LSTM module is used to capture the long-term dependencies of the context in the scale question and answer set, uses the cross entropy function as the loss function, and uses the Adam optimizer for compilation; the formula of the loss function is:

[0049]

[0050] Among them, L represents the loss value of the loss function; N represents the number of samples in the scale question-answer set; C represents the number of categories of psychological problems; y i,c represents the true label of sample i, that is, the real psychological problem; represents the predicted probability of sample i;

[0051] The training set is divided into a training set and a validation set in a ratio of 7:3, and the generative dialogue model is trained using the training set until the loss value of the loss function is less than a preset loss threshold, and then the trained generative dialogue model is verified using the validation set to determine whether the prediction accuracy is greater than the preset accuracy threshold. If so, the training is terminated; if not, the training set is expanded to continue training the generative dialogue model;

[0052] The calculation formula of the prediction accuracy is:

[0053] Accuracy=(TP+TN) / (TP+TN+FP+FN);

[0054] Among them, Accuracy represents the prediction accuracy; TP represents true positive examples, that is, the number of examples that were originally True and predicted to be True; FN represents false negative examples, that is, the number of examples that were originally True and predicted to be False; TN represents true negative examples, that is, the number of examples that were originally False and predicted to be False; FP represents false positive examples, that is, the number of examples that were originally False and predicted to be True; True and False represent the true and false of psychological problems respectively.

[0055] Furthermore, the user information input module is specifically used for:

[0056] Obtaining input user information, the user information at least including gender, age, occupation, educational background, marital status, and psychological self-evaluation;

[0057] The user information is stored in a pre-created user database, and the access rights and identity authentication mechanism of the user database are set; the access rights are to add, delete, modify or query; the identity authentication mechanism is specifically:

[0058] Obtain an input database access request carrying an account number, password, timestamp, device serial number, and hash value, where the hash value is obtained by hashing the account number, password, timestamp, and device serial number; after performing integrity check on the account number, password, timestamp, and device serial number using the hash value, perform timeliness check using the timestamp, then verify the device serial number using a preset device management table, and then perform legitimacy check using the account number and password to complete identity authentication;

[0059] A user portrait is generated based on the user information, a corresponding mental health scale is matched from a scale database based on the user portrait, and the mental health scale is converted into corresponding scale questions.

[0060] Furthermore, the dynamic optimization module is specifically used for:

[0061] Perform sentiment analysis on the conversation content through natural language processing technology to generate a mental health assessment result, display the mental health assessment result, obtain assessment feedback for the mental health assessment result, dynamically adjust the mental health scale based on the assessment feedback, and optimize the generative dialogue model based on the adjusted mental health scale to adjust the output dialogue questions and the output order of each dialogue question.

[0062] The advantages of the present invention are:

[0063] 1. By creating a scale database, a large number of mental health scales are obtained and stored in the scale database, a question and answer library is generated based on each mental health scale, and a scale question and answer set is generated based on the question and answer library; then a generative dialogue model is created based on the word embedding module and the LSTM module, and the generative dialogue model is trained using the scale question and answer set; then the input user information is obtained, the user information is stored in a pre-created user database, the corresponding mental health scale is matched from the scale database based on the user information, the mental health scale is converted into the corresponding scale question input into the generative dialogue model, the dialogue question is output, the user answer based on the dialogue question input is obtained, the dialogue content is generated based on each dialogue question and the user answer, and the mental health scale is dynamically adjusted based on the dialogue content to optimize the generative dialogue model; that is, the dialogue based on the generative dialogue model trained with the scale question and answer set can flexibly respond to the user's complex emotions and personalized needs, and the dialogue can be quickly started based on the user information, without the guidance and explanation of professionals, and large-scale and timely mental health monitoring and intervention can be achieved, thereby greatly improving the interactivity and timeliness of psychological counseling.

[0064] 2. By marking the psychological problems and dialogue scenarios for each scale question in the scale question and answer set, it is convenient to quickly start corresponding dialogues based on psychological problems or dialogue scenarios, which greatly improves the flexibility of psychological counseling.

[0065] 3. By setting the access rights and identity authentication mechanism of the user database; the access rights are to add, delete, modify or query; the specific identity authentication mechanism is: obtain the input database access request carrying the account password, timestamp, device serial number and hash value, perform integrity verification through the hash value, perform timeliness verification through the timestamp, then verify the device serial number through the device management table, and then perform legitimacy verification through the account password to complete the identity authentication; that is, access to the user database needs to go through four verifications of hash value, timestamp, device serial number and account password, and after the verification is passed, only the corresponding operations can be performed according to the access rights, which greatly improves the security of user database access and ensures the security of user information storage.

[0066] 4. Generate a user portrait through user information, and convert the corresponding mental health scale from the scale database into the corresponding scale questions based on the user portrait. That is, perform subsequent conversations based on matching the most relevant mental health scale based on user information, effectively improve the targeted nature of the conversation, and thus greatly improve the psychological counseling effect.

[0067] 5. By obtaining evaluation feedback on the results of mental health assessment, dynamically adjusting the mental health scale based on the evaluation feedback, and optimizing the generative dialogue model based on the adjusted mental health scale, the output dialogue questions and the output order of each dialogue question are adjusted, that is, the corresponding counseling strategies are continuously optimized and adjusted during the dialogue process, thereby greatly improving the psychological counseling effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0068] The present invention will be further described below in conjunction with embodiments with reference to the accompanying drawings.

[0069] Figure 1 It is a flow chart of a generative dialogue method based on a mental health scale of the present invention.

[0070] Figure 2 It is a structural schematic diagram of a generative dialogue system based on a mental health scale of the present invention. DETAILED DESCRIPTION

[0071] The overall idea of ​​the technical solution in the embodiments of the present application is as follows: the conversation is conducted based on a generative dialogue model trained with a scale question and answer set, which can flexibly respond to the user's complex emotions and personalized needs, and the conversation can be quickly started based on user information without the need for professional guidance and explanation, so as to improve the interactivity and timeliness of psychological counseling.

[0072] Please refer to Figure 1 to Figure 2 As shown, a preferred embodiment of a generative dialogue method based on a mental health scale of the present invention comprises the following steps:

[0073] Step S1, creating a scale database, acquiring a large number of mental health scales and storing them in the scale database, generating a question-and-answer database based on each mental health scale, and generating a scale question-and-answer set based on the question-and-answer database;

[0074] Step S2: creating a generative dialogue model based on the word embedding module and the LSTM module, and training the generative dialogue model using the scale question and answer set;

[0075] Step S3, obtaining input user information, storing the user information in a pre-created user database, matching a corresponding mental health scale from a scale database based on the user information, and converting the mental health scale into corresponding scale questions;

[0076] Step S4: input each of the scale questions into a generative dialogue model, output the dialogue question, obtain the user's answer based on the dialogue question input, and generate dialogue content based on each of the dialogue questions and the user's answer;

[0077] Step S5: dynamically adjust the mental health scale based on the conversation content, and optimize the generative conversation model.

[0078] The step S1 is specifically as follows:

[0079] A scale database is created, a large number of mental health scales are obtained and stored in the scale database, a user profile of each mental health scale is set, and a structured question-and-answer database is generated based on each mental health scale, wherein the question-and-answer database records scale questions, answer options corresponding to the scale questions, and scoring criteria corresponding to each answer option; the mental health scale at least includes a self-rating anxiety scale (SAS), a self-rating depression scale (SDS), and a psychological stress scale (PSS); the mental health scale includes a series of questions related to mental health, which are used to evaluate the user's mental state;

[0080] A scale question and answer set including several scale questions and corresponding answer options is generated based on the question and answer library, and each scale question in the scale question and answer set is labeled with psychological problems and dialogue scenes; the psychological problems at least include depression, anxiety and neutrality. The dialogue scenes at least include daily dialogues and emotional exchanges. Through the situational guidance of the dialogue scenes, users can relax, truly reflect their psychological conditions, and make users feel more involved.

[0081] By marking the psychological problems and dialogue scenarios for each scale question in the scale question and answer set, it is convenient to quickly start corresponding dialogues based on psychological problems or dialogue scenarios, which greatly improves the flexibility of psychological counseling.

[0082] The step S2 is specifically as follows:

[0083] Create a generative dialogue model based on the word embedding module and the LSTM module;

[0084] The word embedding module is built based on Word2Vec's CBOW (Continuous Bag of Words) and is used to associate the scale questions and annotations in the scale question and answer set. The objective function is:

[0085]

[0086] Where T represents the total number of words in the scale question and answer set; w t represents the central word in each word to predict the psychological problem; t-c and w t+c represents the context words associated with the central word, and the context window size is c; logP(w t |w t-c ,...,w t+c ) represents the probability of predicting the central word through the context words; Indicates the wth t The word vector of the central word; Indicates the wth t The word vector of the context word of the central word; V represents the size of the vocabulary consisting of words in the scale question and answer set; represents the average vector representation of all context words;

[0087] The LSTM module is used to capture the long-term dependencies of the context in the scale question and answer set, uses the cross entropy function as the loss function, and uses the Adam optimizer for compilation; the formula of the loss function is:

[0088]

[0089] Among them, L represents the loss value of the loss function; N represents the number of samples in the scale question-answer set; C represents the number of categories of psychological problems; y i,c represents the true label of sample i, that is, the real psychological problem; represents the predicted probability of sample i;

[0090] The training set is divided into a training set and a validation set in a ratio of 7:3, and the generative dialogue model is trained using the training set until the loss value of the loss function is less than a preset loss threshold, and then the trained generative dialogue model is verified using the validation set to determine whether the prediction accuracy is greater than the preset accuracy threshold. If so, the training is terminated; if not, the training set is expanded to continue training the generative dialogue model;

[0091] The calculation formula of the prediction accuracy is:

[0092] Accuracy=(TP+TN) / (TP+TN+FP+FN);

[0093] Among them, Accuracy represents the prediction accuracy; TP represents true positive examples, that is, the number of examples that were originally True and predicted to be True; FN represents false negative examples, that is, the number of examples that were originally True and predicted to be False; TN represents true negative examples, that is, the number of examples that were originally False and predicted to be False; FP represents false positive examples, that is, the number of examples that were originally False and predicted to be True; True and False represent the true and false of psychological problems respectively.

[0094] The step S3 is specifically as follows:

[0095] Obtaining user information input through a form or dialog box, wherein the user information includes at least gender, age, occupation, educational background, marital status, and psychological self-evaluation;

[0096] The user information is stored in a pre-created user database, and the access rights and identity authentication mechanism of the user database are set to protect the user's privacy and ensure the accuracy and integrity of the data; the access rights are to add, delete, modify or query; the identity authentication mechanism is specifically:

[0097] Obtain an input database access request carrying an account number, password, timestamp, device serial number, and hash value, where the hash value is obtained by hashing the account number, password, timestamp, and device serial number; after performing integrity check on the account number, password, timestamp, and device serial number using the hash value, perform timeliness check using the timestamp, then verify the device serial number using a preset device management table, and then perform legitimacy check using the account number and password to complete identity authentication;

[0098] By setting the access rights and identity authentication mechanism of the user database; the access rights are to add, delete, modify or query; the specific identity authentication mechanism is: obtain the input database access request carrying the account password, timestamp, device serial number and hash value, perform integrity verification through the hash value, perform timeliness verification through the timestamp, then verify the device serial number through the device management table, and then perform legitimacy verification through the account password to complete the identity authentication; that is, access to the user database needs to go through four verifications of hash value, timestamp, device serial number and account password, and after the verification is passed, only the corresponding operations can be performed according to the access rights, which greatly improves the security of user database access and thus ensures the security of user information storage.

[0099] A user portrait is generated based on the user information, a corresponding mental health scale is matched from a scale database based on the user portrait, and the mental health scale is converted into corresponding scale questions.

[0100] A user portrait is generated through user information, and the corresponding mental health scale is matched from the scale database based on the user portrait and converted into the corresponding scale questions. That is, subsequent conversations are carried out based on matching the most relevant mental health scale based on user information, which effectively improves the targeted nature of the conversation and greatly improves the effect of psychological counseling.

[0101] The step S5 is specifically as follows:

[0102] The emotional analysis of the conversation content is performed through natural language processing technology to generate a mental health assessment result, the mental health assessment result is displayed, and evaluation feedback for the mental health assessment result is obtained. The mental health scale is dynamically adjusted based on the evaluation feedback, and the generative dialogue model is optimized based on the adjusted mental health scale to adjust the output dialogue questions and the output order of each dialogue question. The evaluation feedback is the user's active feedback on whether it is in line with the interest and whether to adopt the mental health assessment result.

[0103] By obtaining evaluation feedback on the results of mental health assessments, dynamically adjusting the mental health scale based on the evaluation feedback, and optimizing the generative dialogue model based on the adjusted mental health scale to adjust the output dialogue questions and the output order of each dialogue question, that is, continuously optimizing and adjusting the corresponding counseling strategies during the dialogue process, thereby greatly improving the psychological counseling effect.

[0104] A preferred embodiment of a generative dialogue system based on a mental health scale of the present invention includes the following modules:

[0105] A scale question and answer set generation module is used to create a scale database, obtain a large number of mental health scales and store them in the scale database, generate a question and answer library based on each mental health scale, and generate a scale question and answer set based on the question and answer library;

[0106] A generative dialogue model training module, used to create a generative dialogue model based on the word embedding module and the LSTM module, and train the generative dialogue model using the scale question and answer set;

[0107] A user information input module, used to obtain input user information, store the user information in a pre-created user database, match a corresponding mental health scale from a scale database based on the user information, and convert the mental health scale into corresponding scale questions;

[0108] A dialogue module, used to input each of the scale questions into a generative dialogue model, output the dialogue questions, obtain user answers based on the dialogue questions input, and generate dialogue content based on each of the dialogue questions and the user answers;

[0109] A dynamic optimization module is used to dynamically adjust the mental health scale based on the conversation content and optimize the generative conversation model.

[0110] The scale question and answer set generation module is specifically used for:

[0111] A scale database is created, a large number of mental health scales are obtained and stored in the scale database, a user profile of each mental health scale is set, and a structured question-and-answer database is generated based on each mental health scale, wherein the question-and-answer database records scale questions, answer options corresponding to the scale questions, and scoring criteria corresponding to each answer option; the mental health scale at least includes a self-rating anxiety scale (SAS), a self-rating depression scale (SDS), and a psychological stress scale (PSS); the mental health scale includes a series of questions related to mental health, which are used to evaluate the user's mental state;

[0112] A scale question and answer set including several scale questions and corresponding answer options is generated based on the question and answer library, and each scale question in the scale question and answer set is labeled with psychological problems and dialogue scenes; the psychological problems at least include depression, anxiety and neutrality. The dialogue scenes at least include daily dialogues and emotional exchanges. Through the situational guidance of the dialogue scenes, users can relax, truly reflect their psychological conditions, and make users feel more involved.

[0113] By marking the psychological problems and dialogue scenarios for each scale question in the scale question and answer set, it is convenient to quickly start corresponding dialogues based on psychological problems or dialogue scenarios, which greatly improves the flexibility of psychological counseling.

[0114] The generative dialogue model training module is specifically used for:

[0115] Create a generative dialogue model based on the word embedding module and the LSTM module;

[0116] The word embedding module is built based on Word2Vec's CBOW (Continuous Bag of Words) and is used to associate the scale questions and annotations in the scale question and answer set. The objective function is:

[0117]

[0118] Where T represents the total number of words in the scale question and answer set; w t represents the central word in each word to predict the psychological problem;t-c and w t+c represents the context words associated with the central word, and the context window size is c; logP(w t |w t-c ,...,w t+c ) represents the probability of predicting the central word through the context words; Indicates the wth t The word vector of the central word; Indicates the wth t The word vector of the context word of the central word; V represents the size of the vocabulary consisting of words in the scale question and answer set; represents the average vector representation of all context words;

[0119] The LSTM module is used to capture the long-term dependencies of the context in the scale question and answer set, uses the cross entropy function as the loss function, and uses the Adam optimizer for compilation; the formula of the loss function is:

[0120]

[0121] Among them, L represents the loss value of the loss function; N represents the number of samples in the scale question-answer set; C represents the number of categories of psychological problems; y i,c represents the true label of sample i, that is, the real psychological problem; represents the predicted probability of sample i;

[0122] The training set is divided into a training set and a validation set in a ratio of 7:3, and the generative dialogue model is trained using the training set until the loss value of the loss function is less than a preset loss threshold, and then the trained generative dialogue model is verified using the validation set to determine whether the prediction accuracy is greater than the preset accuracy threshold. If so, the training is terminated; if not, the training set is expanded to continue training the generative dialogue model;

[0123] The calculation formula of the prediction accuracy is:

[0124] Accuracy=(TP+TN) / (TP+TN+FP+FN);

[0125] Among them, Accuracy represents the prediction accuracy; TP represents true positive examples, that is, the number of examples that were originally True and predicted to be True; FN represents false negative examples, that is, the number of examples that were originally True and predicted to be False; TN represents true negative examples, that is, the number of examples that were originally False and predicted to be False; FP represents false positive examples, that is, the number of examples that were originally False and predicted to be True; True and False represent the true and false of psychological problems respectively.

[0126] The user information input module is specifically used for:

[0127] Obtaining user information input through a form or dialog box, wherein the user information includes at least gender, age, occupation, educational background, marital status, and psychological self-evaluation;

[0128] The user information is stored in a pre-created user database, and the access rights and identity authentication mechanism of the user database are set to protect the user's privacy and ensure the accuracy and integrity of the data; the access rights are to add, delete, modify or query; the identity authentication mechanism is specifically:

[0129] Obtain an input database access request carrying an account number, password, timestamp, device serial number, and hash value, where the hash value is obtained by hashing the account number, password, timestamp, and device serial number; after performing integrity check on the account number, password, timestamp, and device serial number using the hash value, perform timeliness check using the timestamp, then verify the device serial number using a preset device management table, and then perform legitimacy check using the account number and password to complete identity authentication;

[0130] By setting the access rights and identity authentication mechanism of the user database; the access rights are to add, delete, modify or query; the specific identity authentication mechanism is: obtain the input database access request carrying the account password, timestamp, device serial number and hash value, perform integrity verification through the hash value, perform timeliness verification through the timestamp, then verify the device serial number through the device management table, and then perform legitimacy verification through the account password to complete the identity authentication; that is, access to the user database needs to go through four verifications of hash value, timestamp, device serial number and account password, and after the verification is passed, only the corresponding operations can be performed according to the access rights, which greatly improves the security of user database access and thus ensures the security of user information storage.

[0131] A user portrait is generated based on the user information, a corresponding mental health scale is matched from a scale database based on the user portrait, and the mental health scale is converted into corresponding scale questions.

[0132] A user portrait is generated through user information, and the corresponding mental health scale is matched from the scale database based on the user portrait and converted into the corresponding scale questions. That is, subsequent conversations are carried out based on matching the most relevant mental health scale based on user information, which effectively improves the targeted nature of the conversation and greatly improves the effect of psychological counseling.

[0133] The dynamic optimization module is specifically used for:

[0134] The emotional analysis of the conversation content is performed through natural language processing technology to generate a mental health assessment result, the mental health assessment result is displayed, and evaluation feedback for the mental health assessment result is obtained. The mental health scale is dynamically adjusted based on the evaluation feedback, and the generative dialogue model is optimized based on the adjusted mental health scale to adjust the output dialogue questions and the output order of each dialogue question. The evaluation feedback is the user's active feedback on whether it is in line with the interest and whether to adopt the mental health assessment result.

[0135] By obtaining evaluation feedback on the results of mental health assessments, dynamically adjusting the mental health scale based on the evaluation feedback, and optimizing the generative dialogue model based on the adjusted mental health scale to adjust the output dialogue questions and the output order of each dialogue question, that is, continuously optimizing and adjusting the corresponding counseling strategies during the dialogue process, thereby greatly improving the psychological counseling effect.

[0136] In summary, the advantages of the present invention are:

[0137] 1. By creating a scale database, a large number of mental health scales are obtained and stored in the scale database, a question and answer library is generated based on each mental health scale, and a scale question and answer set is generated based on the question and answer library; then a generative dialogue model is created based on the word embedding module and the LSTM module, and the generative dialogue model is trained using the scale question and answer set; then the input user information is obtained, the user information is stored in a pre-created user database, the corresponding mental health scale is matched from the scale database based on the user information, the mental health scale is converted into the corresponding scale question input into the generative dialogue model, the dialogue question is output, the user answer based on the dialogue question input is obtained, the dialogue content is generated based on each dialogue question and the user answer, and the mental health scale is dynamically adjusted based on the dialogue content to optimize the generative dialogue model; that is, the dialogue based on the generative dialogue model trained with the scale question and answer set can flexibly respond to the user's complex emotions and personalized needs, and the dialogue can be quickly started based on the user information, without the guidance and explanation of professionals, and large-scale and timely mental health monitoring and intervention can be achieved, thereby greatly improving the interactivity and timeliness of psychological counseling.

[0138] 2. By marking the psychological problems and dialogue scenarios for each scale question in the scale question and answer set, it is convenient to quickly start corresponding dialogues based on psychological problems or dialogue scenarios, which greatly improves the flexibility of psychological counseling.

[0139] 3. By setting the access rights and identity authentication mechanism of the user database; the access rights are to add, delete, modify or query; the specific identity authentication mechanism is: obtain the input database access request carrying the account password, timestamp, device serial number and hash value, perform integrity verification through the hash value, perform timeliness verification through the timestamp, then verify the device serial number through the device management table, and then perform legitimacy verification through the account password to complete the identity authentication; that is, access to the user database needs to go through four verifications of hash value, timestamp, device serial number and account password, and after the verification is passed, only the corresponding operations can be performed according to the access rights, which greatly improves the security of user database access and ensures the security of user information storage.

[0140] 4. Generate a user portrait through user information, and convert the corresponding mental health scale from the scale database into the corresponding scale questions based on the user portrait. That is, perform subsequent conversations based on matching the most relevant mental health scale based on user information, effectively improve the targeted nature of the conversation, and thus greatly improve the psychological counseling effect.

[0141] 5. By obtaining evaluation feedback on the results of mental health assessment, dynamically adjusting the mental health scale based on the evaluation feedback, and optimizing the generative dialogue model based on the adjusted mental health scale, the output dialogue questions and the output order of each dialogue question are adjusted, that is, the corresponding counseling strategies are continuously optimized and adjusted during the dialogue process, thereby greatly improving the psychological counseling effect.

[0142] Although the specific implementation modes of the present invention are described above, those skilled in the art should understand that the specific implementation modes described are only illustrative and are not intended to limit the scope of the present invention. Equivalent modifications and changes made by those skilled in the art in accordance with the spirit of the present invention should be included in the scope of protection of the claims of the present invention.

Claims

1. A generative dialogue method based on a mental health scale, characterized by: The steps include: Step S1, creating a scale database, acquiring a large number of mental health scales and storing them in the scale database, generating a question-and-answer database based on each mental health scale, and generating a scale question-and-answer set based on the question-and-answer database; Step S2: creating a generative dialogue model based on the word embedding module and the LSTM module, and training the generative dialogue model using the scale question and answer set; Step S3, obtaining input user information, storing the user information in a pre-created user database, matching a corresponding mental health scale from a scale database based on the user information, and converting the mental health scale into corresponding scale questions; Step S4: input each of the scale questions into a generative dialogue model, output the dialogue question, obtain the user's answer based on the dialogue question input, and generate dialogue content based on each of the dialogue questions and the user's answer; Step S5: dynamically adjust the mental health scale based on the conversation content, and optimize the generative conversation model.

2. A generative dialogue method based on a mental health scale as claimed in claim 1, characterized in that: The step S1 is specifically as follows: Create a scale database, obtain a large number of mental health scales and store them in the scale database, set user profiles for each mental health scale, and generate a structured question-and-answer database based on each mental health scale, wherein the question-and-answer database records scale questions, answer options corresponding to the scale questions, and scoring criteria corresponding to each answer option; A scale question and answer set including a number of scale questions and corresponding answer options is generated based on the question and answer library, and each scale question in the scale question and answer set is labeled with a psychological problem and a dialogue scene; the psychological problems include at least depression, anxiety and neutrality.

3. A generative dialogue method based on a mental health scale as claimed in claim 1, characterized in that: The step S2 is specifically as follows: Create a generative dialogue model based on the word embedding module and the LSTM module; The word embedding module is built based on Word2Vec's CBOW and is used to associate the scale questions and annotations in the scale question and answer set. The objective function is: Where T represents the total number of words in the scale question and answer set; w t represents the central word in each word to predict the psychological problem; t-c and w t+c represents the context words associated with the central word, and the context window size is c; logP(w t |w t-c ,...,w t+c ) represents the probability of predicting the central word through the context words; Indicates the wth t The word vector of the central word; Indicates the wth t The word vector of the context word of the central word; V represents the size of the vocabulary consisting of words in the scale question and answer set; represents the average vector representation of all context words; The LSTM module is used to capture the long-term dependencies of the context in the scale question and answer set, uses the cross entropy function as the loss function, and uses the Adam optimizer for compilation; the formula of the loss function is: Among them, L represents the loss value of the loss function; N represents the number of samples in the scale question-answer set; C represents the number of categories of psychological problems; y i,c represents the true label of sample i, that is, the real psychological problem; represents the predicted probability of sample i; The training set is divided into a training set and a validation set in a ratio of 7:3, and the generative dialogue model is trained using the training set until the loss value of the loss function is less than a preset loss threshold, and then the trained generative dialogue model is verified using the validation set to determine whether the prediction accuracy is greater than the preset accuracy threshold. If so, the training is terminated; if not, the training set is expanded to continue training the generative dialogue model; The calculation formula of the prediction accuracy is: Accuracy=(TP+TN) / (TP+TN+FP+FN); Among them, Accuracy represents the prediction accuracy; TP represents true positive examples, that is, the number of examples that were originally True and predicted to be True; FN represents false negative examples, that is, the number of examples that were originally True and predicted to be False; TN represents true negative examples, that is, the number of examples that were originally False and predicted to be False; FP represents false positive examples, that is, the number of examples that were originally False and predicted to be True; True and False represent the true and false of psychological problems respectively.

4. A generative dialogue method based on a mental health scale as claimed in claim 1, characterized in that: The step S3 is specifically as follows: Obtaining input user information, the user information at least including gender, age, occupation, educational background, marital status, and psychological self-evaluation; The user information is stored in a pre-created user database, and the access rights and identity authentication mechanism of the user database are set; the access rights are to add, delete, modify or query; the identity authentication mechanism is specifically: Obtain an input database access request carrying an account number, password, timestamp, device serial number, and hash value, where the hash value is obtained by hashing the account number, password, timestamp, and device serial number; after performing integrity check on the account number, password, timestamp, and device serial number using the hash value, perform timeliness check using the timestamp, then verify the device serial number using a preset device management table, and then perform legitimacy check using the account number and password to complete identity authentication; A user portrait is generated based on the user information, a corresponding mental health scale is matched from a scale database based on the user portrait, and the mental health scale is converted into corresponding scale questions.

5. A generative dialogue method based on a mental health scale as claimed in claim 1, characterized in that: The step S5 is specifically as follows: Perform sentiment analysis on the conversation content through natural language processing technology to generate a mental health assessment result, display the mental health assessment result, obtain assessment feedback for the mental health assessment result, dynamically adjust the mental health scale based on the assessment feedback, and optimize the generative dialogue model based on the adjusted mental health scale to adjust the output dialogue questions and the output order of each dialogue question.

6. A generative dialogue system based on a mental health scale, characterized by: Includes the following modules: A scale question and answer set generation module is used to create a scale database, obtain a large number of mental health scales and store them in the scale database, generate a question and answer library based on each mental health scale, and generate a scale question and answer set based on the question and answer library; A generative dialogue model training module, used to create a generative dialogue model based on the word embedding module and the LSTM module, and train the generative dialogue model using the scale question and answer set; A user information input module, used to obtain input user information, store the user information in a pre-created user database, match a corresponding mental health scale from a scale database based on the user information, and convert the mental health scale into corresponding scale questions; A dialogue module, used to input each of the scale questions into a generative dialogue model, output the dialogue questions, obtain user answers based on the dialogue questions input, and generate dialogue content based on each of the dialogue questions and the user answers; A dynamic optimization module is used to dynamically adjust the mental health scale based on the conversation content and optimize the generative conversation model.

7. A generative dialogue system based on a mental health scale as claimed in claim 6, characterized in that: The scale question and answer set generation module is specifically used for: Create a scale database, obtain a large number of mental health scales and store them in the scale database, set user profiles for each mental health scale, and generate a structured question-and-answer database based on each mental health scale, wherein the question-and-answer database records scale questions, answer options corresponding to the scale questions, and scoring criteria corresponding to each answer option; A scale question and answer set including a number of scale questions and corresponding answer options is generated based on the question and answer library, and each scale question in the scale question and answer set is labeled with a psychological problem and a dialogue scene; the psychological problems include at least depression, anxiety and neutrality.

8. A generative dialogue system based on a mental health scale as claimed in claim 6, characterized in that: The generative dialogue model training module is specifically used for: Create a generative dialogue model based on the word embedding module and the LSTM module; The word embedding module is built based on Word2Vec's CBOW and is used to associate the scale questions and annotations in the scale question and answer set. The objective function is: Where T represents the total number of words in the scale question and answer set; w t represents the central word in each word to predict the psychological problem; t-c and w t+c represents the context words associated with the central word, and the context window size is c; logP(w t w t-c ,...,w t+c ) represents the probability of predicting the central word through the context words; Indicates the wth t The word vector of the central word; Indicates the wth t The word vector of the context word of the central word; V represents the size of the vocabulary consisting of words in the scale question and answer set; represents the average vector representation of all context words; The LSTM module is used to capture the long-term dependencies of the context in the scale question and answer set, uses the cross entropy function as the loss function, and uses the Adam optimizer for compilation; the formula of the loss function is: Among them, L represents the loss value of the loss function; N represents the number of samples in the scale question-answer set; C represents the number of categories of psychological problems; y i,c represents the true label of sample i, that is, the real psychological problem; represents the predicted probability of sample i; The training set is divided into a training set and a validation set in a ratio of 7:3, and the generative dialogue model is trained using the training set until the loss value of the loss function is less than a preset loss threshold, and then the trained generative dialogue model is verified using the validation set to determine whether the prediction accuracy is greater than the preset accuracy threshold. If so, the training is terminated; if not, the training set is expanded to continue training the generative dialogue model; The calculation formula of the prediction accuracy is: Accuracy=(TP+TN) / (TP+TN+FP+FN); Among them, Accuracy represents the prediction accuracy; TP represents true positive examples, that is, the number of examples that were originally True and predicted to be True; FN represents false negative examples, that is, the number of examples that were originally True and predicted to be False; TN represents true negative examples, that is, the number of examples that were originally False and predicted to be False; FP represents false positive examples, that is, the number of examples that were originally False and predicted to be True; True and False represent the true and false of psychological problems respectively.

9. A generative dialogue system based on a mental health scale as claimed in claim 6, characterized in that: The user information input module is specifically used for: Obtaining input user information, the user information at least including gender, age, occupation, educational background, marital status, and psychological self-evaluation; The user information is stored in a pre-created user database, and the access rights and identity authentication mechanism of the user database are set; the access rights are to add, delete, modify or query; the identity authentication mechanism is specifically: Obtain an input database access request carrying an account number, password, timestamp, device serial number, and hash value, where the hash value is obtained by hashing the account number, password, timestamp, and device serial number; after performing integrity check on the account number, password, timestamp, and device serial number using the hash value, perform timeliness check using the timestamp, then verify the device serial number using a preset device management table, and then perform legitimacy check using the account number and password to complete identity authentication; A user portrait is generated based on the user information, a corresponding mental health scale is matched from a scale database based on the user portrait, and the mental health scale is converted into corresponding scale questions.

10. A generative dialogue system based on a mental health scale as claimed in claim 6, characterized in that: The dynamic optimization module is specifically used for: Perform sentiment analysis on the conversation content through natural language processing technology to generate a mental health assessment result, display the mental health assessment result, obtain assessment feedback for the mental health assessment result, dynamically adjust the mental health scale based on the assessment feedback, and optimize the generative dialogue model based on the adjusted mental health scale to adjust the output dialogue questions and the output order of each dialogue question.

Citation Information

Cited By

  • Localized scale generation system and method based on general scale

    CN120544760A