Pain question and answer method and device, medium and electronic equipment
Through pre-trained pain models and large emotional models, combined with emotional analysis, emotionally colored responses are generated, which solves the problems of inaccurate pain management answers and lack of humanistic care in the existing technology, and improves the intelligence of pain management.
Patent Information
- Application Number
- CN202410760373.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2024-10-01
AI Technical Summary
The existing medical question and answer system based on large language models is not accurate enough in pain management, lacks humanistic care, cannot meet the emotional needs of users, and reduces the intelligence of pain management.
Using pre-trained pain models and large emotional models, we identify the user's emotional type through emotional analysis, generate optimal dialogue templates, optimize disease analysis results to provide emotionally colored responses, and improve the humanistic care and emotional support of interactions.
It improves the intelligence of pain management and enhances users' treatment confidence and hope for the future through accurate pain field responses and emotional support.
Smart Images

Figure CN118734964A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a pain question-answering method, device, medium and electronic device. Background Art
[0002] With the development of medical technology and the improvement of people's awareness of personal health management, pain management has become an important research direction in the medical field.
[0003] In related technologies, pain management mainly relies on traditional evaluation methods, such as medical question-and-answer systems based on large language models. Although they cover a wide range of knowledge, data in the field of pain may be relatively scarce, resulting in inaccurate answers from the model in this field. At the same time, large language models lack understanding of humanistic care and cannot meet the emotional needs of users well, resulting in answers that may appear indifferent or lack empathy, thereby reducing the intelligence level of pain management. Summary of the invention
[0004] The embodiments of the present application provide a pain question-answering method, device, medium, and electronic device. In order to have a basic understanding of some aspects of the disclosed embodiments, a simple summary is given below. This summary is not a general review, nor is it intended to identify key / important components or describe the scope of protection of these embodiments. Its only purpose is to present some concepts in a simple form as a preface to the detailed description that follows.
[0005] In a first aspect, an embodiment of the present application provides a pain question-answering method, the method comprising:
[0006] Receive a question-and-answer request, which carries a user's question description text;
[0007] According to the preset sentiment analysis model and the question description text, the user's emotion type is identified. The preset sentiment analysis model is used to identify the user's emotion type according to the question description text;
[0008] When the user's emotion type is positive or negative, the problem description text is input into the pre-trained pain model, the user's disease analysis result is output, and the user's optimal dialogue template is obtained based on the pre-trained emotion model; the pre-trained pain model is trained based on the pain data set, and the pre-trained emotion model is used to analyze the user's emotions;
[0009] Based on the optimal dialogue template, the disease analysis results are expressed and optimized to generate response results corresponding to the question description text.
[0010] Optionally, identify the user's emotion type based on a preset sentiment analysis model and the question description text, including:
[0011] Convert the problem description text into a word sequence;
[0012] Input the word sequence into the preset sentiment analysis model for forward propagation, so as to process each word backward one by one starting from the first word in the word sequence, and obtain the first hidden state sequence of each word in the forward context;
[0013] Input the word sequence into the preset sentiment analysis model for back propagation, so as to process each word one by one from the last word in the word sequence, and obtain the second hidden state sequence of each word in the reverse context;
[0014] Fusing the first hidden state sequence with the second hidden state sequence to obtain a fused hidden state;
[0015] Emotion prediction is performed based on the output layer and fusion hidden state of the preset sentiment analysis model to obtain the user's emotion score;
[0016] From the preset correspondence between the emotion value interval and the emotion type, a target emotion type corresponding to the target emotion value interval containing the emotion score is determined as the emotion type of the user.
[0017] Optionally, the expression for the user's sentiment score is:
[0018] s=f(W out h+b out );
[0019] Where s is the user’s sentiment score, W out is the weight matrix of the output layer, b out is the bias term and f is the activation function.
[0020] Optionally, based on the pre-trained emotion model, obtain the user's dialogue template, including:
[0021] Input the question description text into the pre-trained emotional model and output the probability distribution of the user under multiple preset emotional types;
[0022] Connecting to a preset dialogue template library, which stores the mapping relationship between emotion types and dialogue templates;
[0023] From the mapping relationship, the dialogue template corresponding to the emotion type with the largest probability value in the probability distribution is obtained as the dialogue template of the user.
[0024] Optionally, generate a pre-trained sentiment model by following these steps, including:
[0025] Collect doctor-patient dialogue corpus in the medical field;
[0026] The basic model is obtained by performing machine learning on the neural network through the doctor-patient dialogue corpus;
[0027] Create a target output layer and a target cross entropy loss function. The target output layer is used to output the probability distribution of the user under multiple preset emotion types. The target cross entropy loss function is used to determine the difference between the predicted result and the actual emotion type label.
[0028] Replace the output layer and cross entropy loss function in the basic model with the target output layer and target cross entropy loss function to obtain the large emotion model;
[0029] Collect emotion datasets and emotion fine-tuning datasets. The emotion datasets and emotion fine-tuning datasets are used to train the emotion model so that it has the ability to understand and simulate the comforting skills of medical staff;
[0030] Input the emotion dataset and emotion fine-tuning dataset into the emotion model and output the model loss value;
[0031] When the loss value reaches the minimum, a pre-trained sentiment model is generated.
[0032] Optionally, the target cross entropy loss function is:
[0033]
[0034] Among them, L CE is the loss value, N is the number of samples, C is the number of emotion types, y i,c is the one-hot encoding of the true emotion type of sample i, is the probability predicted by the model that sample i belongs to emotion type c.
[0035] Optionally, generate a pre-trained pain model by following these steps, including:
[0036] Collect pain data sets, which include historical medical records of patients from multiple hospitals and preset publicly available pain data;
[0037] Preprocess the pain data set to obtain a model training set;
[0038] Create a pain model;
[0039] Input the model training set into the pain model and output the error value;
[0040] When the error value reaches the minimum, the pre-trained pain model is generated.
[0041] In a second aspect, an embodiment of the present application provides a pain question-answering device, the device comprising:
[0042] A receiving module is used to receive a question and answer request, which carries a user's question description text;
[0043] The recognition module is used to recognize the user's emotion type according to the preset emotion analysis model and the question description text. The preset emotion analysis model is used to recognize the user's emotion type according to the question description text;
[0044] The output module is used to input the problem description text into the pre-trained pain model when the user's emotion type is positive or negative, output the user's disease analysis result, and obtain the user's optimal dialogue template based on the pre-trained emotion model; the pre-trained pain model is trained based on the pain data set, and the pre-trained emotion model is used to analyze the user's emotions;
[0045] The generation module is used to optimize the expression of disease analysis results based on the optimal dialogue template and generate response results corresponding to the question description text.
[0046] In a third aspect, an embodiment of the present application provides a computer storage medium, which stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the above-mentioned method steps.
[0047] In a fourth aspect, an embodiment of the present application provides an electronic device, which may include: a processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the above-mentioned method steps.
[0048] The technical solution provided by the embodiments of the present application may have the following beneficial effects:
[0049] In the embodiments of the present application, on the one hand, the pre-trained pain model is trained based on a pain data set, which can supplement the existing medical training data so that the model can accurately output responses in the field of pain; on the other hand, the pre-trained emotional model is used to analyze the user's emotions, and based on the results of the analysis, the user's optimal dialogue template can be obtained. The optimal dialogue template can make the final response result have emotional color, so that the model can reflect humanistic care and emotional support in the interaction with the user, thereby improving the intelligence of pain management.
[0050] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0052] Figure 1 It is a flowchart of a pain question-and-answer method provided in an embodiment of the present application;
[0053] Figure 2is a schematic diagram of a pain question-and-answer process provided by the present application;
[0054] Figure 3 It is a structural schematic diagram of a pain question-and-answer device provided by the present application;
[0055] Figure 4 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0056] The following description and the accompanying drawings sufficiently illustrate specific embodiments of the present application to enable those skilled in the art to practice them.
[0057] It should be clear that the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0058] When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.
[0059] In the description of the present application, it should be understood that the terms "first", "second", etc. are used for descriptive purposes only and should not be understood as indicating or implying relative importance. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to the specific circumstances. In addition, in the description of the present application, unless otherwise specified, "multiple" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship.
[0060] The present application provides a pain question-and-answer method, device, medium and electronic device to solve the problems existing in the above-mentioned related technical issues. In the embodiments of the present application, on the one hand, the pre-trained pain model is trained based on a pain data set, and the pain data set can supplement the existing medical field training data so that the model can accurately output responses in the field of pain; on the other hand, the pre-trained emotional model is used to analyze the user's emotions, and based on the results of the analysis, the user's optimal dialogue template can be obtained. The optimal dialogue template can make the final response result have emotional color, so that the model can reflect humanistic care and emotional support in the interaction with the user, thereby improving the intelligence of pain management. The following uses an exemplary embodiment for detailed description.
[0061] The following will be combined with the attached Figure 1 -Attached Figure 2 , the pain question-answering method provided in the embodiment of the present application is introduced in detail. The method can be implemented by a computer program and can be run on a pain question-answering device based on the von Neumann system. The computer program can be integrated into an application or run as an independent tool application.
[0062] See also Figure 1 , which is a flowchart of a pain question-answering method provided in an embodiment of the present application. Figure 1 As shown, the method of the embodiment of the present application may include the following steps:
[0063] S101, receiving a question and answer request, the question and answer request carrying a user's question description text;
[0064] The question-and-answer request may be triggered by the user through the client or on the user terminal, and is used to request the server or the processor of the user terminal to respond to the user's question description text. The question description text is the symptom text described by the user regarding the pain perception of his or her body.
[0065] In some embodiments, the user inputs a question description text to the client. After the client detects that the user has triggered a submission component, the client encapsulates the question description text into a question and answer request and sends it to the server. The server receives the question and answer request and can parse the user's question description text from the request.
[0066] In other embodiments, the processor of the user terminal deploys a pain question and answer processing process, and the user can input a question description text into the user terminal. After the processor in the user terminal detects that the user triggers the submission component, it can receive a question and answer request carrying the question description text in real time.
[0067] S102, identifying the user's emotion type according to a preset emotion analysis model and the question description text, wherein the preset emotion analysis model is used to identify the user's emotion type according to the question description text;
[0068] Among them, the preset sentiment analysis model is used to identify the user's emotion type based on the question description text. The preset sentiment analysis model is designed using a bidirectional long short-term memory network (Bi-LSTM).
[0069] In an embodiment of the present application, according to a preset sentiment analysis model and a question description text, a specific process of identifying a user's emotion type includes: converting the question description text into a word sequence; inputting the word sequence into a preset sentiment analysis model for forward propagation, so as to process each word backward one by one starting from the first word in the word sequence, and obtain a first hidden state sequence of each word in a forward context; inputting the word sequence into a preset sentiment analysis model for backward propagation, so as to process each word forward one by one starting from the last word in the word sequence, and obtain a second hidden state sequence of each word in a reverse context; fusing the first hidden state sequence with the second hidden state sequence to obtain a fused hidden state; performing sentiment prediction based on the output layer and the fused hidden state of the preset sentiment analysis model to obtain the user's emotion score; and determining, from the correspondence between the preset emotion value interval and the emotion type, a target emotion type corresponding to the target emotion value interval containing the emotion score as the user's emotion type.
[0070] Among them, the preprocessing is to represent the problem description text as a real number vector of fixed length through word embedding. At this time, Bi-LSTM will process each word in the problem description text in positive and negative order, and calculate the final sentiment result based on the context information.
[0071] For example, for the input word sequence X = {x1, x2, ..., x T}, forward propagation calculates the hidden state sequence of each word in the forward context Back propagation calculates the hidden state sequence of each word in the reverse context The results of forward propagation and back propagation are fused, and the hidden state after fusion is Taking into account the importance and influence of each word in its context, the hidden states obtained by forward propagation and back propagation are fused and input into Bi-LSTM for sentiment prediction, and the sentiment score is obtained through regression.
[0072] Specifically, the emotion type includes parameters such as positive, negative or neutral and different degrees of emotion intensity, such as mild, moderate and severe levels.
[0073] Specifically, the expression of the user's emotion score is: s = f(W outh+b out ), where s is the user’s sentiment score, W out is the weight matrix of the output layer, b out is the bias term and f is the activation function.
[0074] The preset sentiment analysis model of this application can keenly capture the emotional color in the user's questions and understand the patient's emotional type. When the system recognizes that the patient's emotions fluctuate greatly or the level of anxiety is high, the pre-trained emotional model can be called to generate corresponding emotional support responses, such as encouraging language and suggestions for emotional relief, to enhance their confidence in pain treatment and hope for the future.
[0075] S103, when the user's emotion type is positive or negative, input the problem description text into the pre-trained pain model, output the user's disease analysis result, and obtain the user's optimal dialogue template based on the pre-trained emotion big model; the pre-trained pain model is trained based on the pain data set, and the pre-trained emotion big model is used to analyze the user's emotions;
[0076] Among them, the pre-trained pain model is used to give accurate disease analysis results based on the user's problem description text.
[0077] In an embodiment of the present application, the specific process of obtaining a user's dialogue template based on a pre-trained emotion model includes: inputting a question description text into the pre-trained emotion model, and outputting a probability distribution of the user under multiple preset emotion types; connecting a preset dialogue template library, which stores a mapping relationship between emotion types and dialogue templates; and from the mapping relationship, obtaining a dialogue template corresponding to the emotion type with the largest probability value in the probability distribution as the user's dialogue template.
[0078] In an embodiment of the present application, a pre-trained emotion model can be generated according to the following steps, including: collecting a doctor-patient dialogue corpus in the medical field; performing machine learning on the neural network through the doctor-patient dialogue corpus to obtain a basic model; creating a target output layer and a target cross-entropy loss function, the target output layer is used to output the probability distribution of the user under multiple preset emotion types, and the target cross-entropy loss function is used to determine the difference between the predicted result and the real emotion type label; replacing the output layer and the cross-entropy loss function in the basic model with the target output layer and the target cross-entropy loss function to obtain the emotion model; collecting emotion data sets and emotion fine-tuning data sets, the emotion data sets and the emotion fine-tuning data sets are used to train the emotion model to enable it to have the ability to understand and simulate the comfort skills of medical staff; inputting the emotion data sets and the emotion fine-tuning data sets into the emotion model, and outputting the model loss value; when the loss value reaches the minimum, generating a pre-trained emotion model.
[0079] Among them, the emotional dataset and the emotional fine-tuning dataset contain conversations between medical staff and patients. These conversations cover the medical staff's understanding of the patient's condition, the expression of emotional support and encouragement, and comforting words for different conditions and emotional states. The conversations in the dataset come from different scenarios, such as outpatient visits, inpatient treatment, rehabilitation training, etc. Using these data to train the model can understand and simulate the comfort skills of medical staff and provide more humane and personalized comfort services. These data are used to train the model so that it has the ability to understand and simulate the comfort skills of medical staff and provide more humane and personalized comfort services.
[0080] Among them, the target cross entropy loss function is:
[0081]
[0082] Among them, L CE is the loss value, N is the number of samples, C is the number of emotion types, y i,c is the one-hot encoding of the true emotion type of sample i, is the probability predicted by the model that sample i belongs to emotion type c.
[0083] In an embodiment of the present application, a pre-trained pain model can be generated according to the following steps, including: collecting a pain data set, the pain data set includes historical medical records of patients from multiple hospitals and preset publicly available pain data; pre-processing the pain data set to obtain a model training set; creating a pain model; inputting the model training set into the pain model and outputting an error value; when the error value reaches the minimum, generating a pre-trained pain model.
[0084] The pain dataset includes text data such as pain descriptions, pain reports, pain papers, pain professional knowledge questions and answers, etc. The preprocessing process of the pain dataset includes data format conversion, division into training sets, validation sets and test sets, etc.
[0085] It should be noted that the pain dataset only contains information such as the patient's physical condition, pain-related symptoms, diagnosis results, and doctor's advice, and does not contain the patient's personal identity information (name, ID number, etc.) to ensure the patient's privacy and security.
[0086] In a possible implementation, after obtaining a pre-trained pain model, the problem description text can be input into the pre-trained pain model to output the user's disease analysis result. The following formula can be used to represent the diagnosis process:
[0087] R = argmax d∈D P(d|q);
[0088] Among them, R represents the disease analysis result, D represents all possible diseases, q represents the description text of the problem raised by the patient, and P(d|q) represents the posterior probability of disease d given the description text q of the problem. The pre-trained pain model is combined with the medical knowledge base to estimate the probability distribution of each disease under a given problem. The pre-trained pain model can be constructed and trained by a large language model.
[0089] S104, based on the optimal dialogue template, the disease analysis results are optimized and a response result corresponding to the question description text is generated.
[0090] Among them, the response results corresponding to the question description text include information such as pain type, diagnosis results, medical advice, etc. The medical advice includes information such as medical department recommendations to help patients choose appropriate medical treatment options.
[0091] In some embodiments, after obtaining the optimal dialogue template, the disease analysis results that do not have emotional color can be optimized. The optimization method includes using the optimal dialogue template to fill in the disease analysis results and transform the sentences, and finally obtaining the reply result corresponding to the question description text.
[0092] Furthermore, after obtaining the reply result corresponding to the question description text, the reply result can be sent to the client for display, or displayed on the user terminal.
[0093] For example Figure 2 As shown, Figure 2 This is a schematic diagram of a pain question-and-answer process provided by the present application. First, the user logs in to the pain question-and-answer system on the client and enters relevant information such as personal information, pain conditions, historical diagnosis records, and emotional preferences; after logging in, the system starts the question-and-answer process and allows the patient to enter questions; then, the user outputs a question description text, and the system can identify the user's emotion type based on a preset sentiment analysis model and the question description text; when the system detects that the user's emotion is positive or negative, the question description text is input into a pre-trained pain model, the user's disease analysis results are output, and the user's optimal dialogue template is obtained based on the pre-trained sentiment model, and based on the optimal dialogue template, the disease analysis results are optimized and expressed to generate a reply result corresponding to the question description text.
[0094] In the embodiments of the present application, on the one hand, the pre-trained pain model is trained based on a pain data set, which can supplement the existing medical training data so that the model can accurately output responses in the field of pain; on the other hand, the pre-trained emotional model is used to analyze the user's emotions, and based on the results of the analysis, the user's optimal dialogue template can be obtained. The optimal dialogue template can make the final response result have emotional color, so that the model can reflect humanistic care and emotional support in the interaction with the user, thereby improving the intelligence of pain management.
[0095] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0096] See also Figure 3 , which shows a schematic diagram of the structure of a pain question-answering device provided by an exemplary embodiment of the present application. The pain question-answering device can be implemented as all or part of an electronic device through software, hardware, or a combination of both. The device 1 includes a receiving module 10, an identification module 20, an output module 30, and a generation module 40.
[0097] A receiving module 10 is used to receive a question and answer request, which carries a user's question description text;
[0098] The recognition module 20 is used to recognize the emotion type of the user according to the preset emotion analysis model and the question description text, and the preset emotion analysis model is used to recognize the emotion type of the user according to the question description text;
[0099] The output module 30 is used to input the problem description text into the pre-trained pain model when the user's emotion type is positive or negative, output the user's disease analysis result, and obtain the user's optimal dialogue template according to the pre-trained emotion model; the pre-trained pain model is trained based on the pain data set, and the pre-trained emotion model is used to analyze the user's emotions;
[0100] The generation module 40 is used to optimize the expression of the disease analysis results based on the optimal dialogue template and generate a response result corresponding to the question description text.
[0101] It should be noted that the pain question-and-answer device provided in the above embodiment only uses the division of the above functional modules as an example when executing the pain question-and-answer method. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the pain question-and-answer device provided in the above embodiment and the pain question-and-answer method embodiment belong to the same concept, and the implementation process thereof is detailed in the method embodiment, which will not be repeated here.
[0102] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0103] In the embodiments of the present application, on the one hand, the pre-trained pain model is trained based on a pain data set, which can supplement the existing medical training data so that the model can accurately output responses in the field of pain; on the other hand, the pre-trained emotional model is used to analyze the user's emotions, and based on the results of the analysis, the user's optimal dialogue template can be obtained. The optimal dialogue template can make the final response result have emotional color, so that the model can reflect humanistic care and emotional support in the interaction with the user, thereby improving the intelligence of pain management.
[0104] The present application also provides a computer-readable medium having program instructions stored thereon, which, when executed by a processor, implement the pain question-answering method provided by the above-mentioned various method embodiments.
[0105] The present application also provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the pain question-answering method of each of the above method embodiments.
[0106] See also Figure 4 , is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 4 As shown, the electronic device 1000 may include: at least one processor 1001 , at least one network interface 1004 , a user interface 1003 , a memory 1005 , and at least one communication bus 1002 .
[0107] The communication bus 1002 is used to realize the connection and communication between these components.
[0108] The user interface 1003 may include a display screen (Display) and a camera (Camera), and the optional user interface 1003 may also include a standard wired interface and a wireless interface.
[0109] The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).
[0110] Among them, the processor 1001 may include one or more processing cores. The processor 1001 uses various interfaces and lines to connect various parts within the entire electronic device 1000, and executes various functions and processes data of the electronic device 1000 by running or executing instructions, programs, code sets or instruction sets stored in the memory 1005, and calling data stored in the memory 1005. Optionally, the processor 1001 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 1001 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes operating devices, user interfaces and applications, etc.; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 1001, and it can be implemented separately through a chip.
[0111] Among them, the memory 1005 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory). Optionally, the memory 1005 includes a non-transitory computer-readable storage medium. The memory 1005 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 1005 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing the operating device, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 1005 may also be optionally at least one storage device located away from the aforementioned processor 1001. As Figure 4 As shown, the memory 1005 as a computer storage medium may include an operating device, a network communication module, a user interface module, and a pain question and answer application.
[0112] exist Figure 4In the electronic device 1000 shown, the user interface 1003 is mainly used to provide an input interface for the user and obtain data input by the user; and the processor 1001 can be used to call the pain question and answer application stored in the memory 1005, and specifically perform the following operations:
[0113] Receive a question-and-answer request, which carries a user's question description text;
[0114] According to the preset sentiment analysis model and the question description text, the user's emotion type is identified. The preset sentiment analysis model is used to identify the user's emotion type according to the question description text;
[0115] When the user's emotion type is positive or negative, the problem description text is input into the pre-trained pain model, the user's disease analysis result is output, and the user's optimal dialogue template is obtained based on the pre-trained emotion model; the pre-trained pain model is trained based on the pain data set, and the pre-trained emotion model is used to analyze the user's emotions;
[0116] Based on the optimal dialogue template, the disease analysis results are expressed and optimized to generate response results corresponding to the question description text.
[0117] In one embodiment, when the processor 1001 identifies the user's emotion type according to the preset sentiment analysis model and the question description text, the processor 1001 specifically performs the following operations:
[0118] Convert the problem description text into a word sequence;
[0119] Input the word sequence into the preset sentiment analysis model for forward propagation, so as to process each word backward one by one starting from the first word in the word sequence, and obtain the first hidden state sequence of each word in the forward context;
[0120] Input the word sequence into the preset sentiment analysis model for back propagation, so as to process each word one by one from the last word in the word sequence, and obtain the second hidden state sequence of each word in the reverse context;
[0121] Fusing the first hidden state sequence with the second hidden state sequence to obtain a fused hidden state;
[0122] Emotion prediction is performed based on the output layer and fusion hidden state of the preset sentiment analysis model to obtain the user's emotion score;
[0123] From the preset correspondence between the emotion value interval and the emotion type, a target emotion type corresponding to the target emotion value interval containing the emotion score is determined as the emotion type of the user.
[0124] In one embodiment, when the processor 1001 obtains the user's dialogue template according to the pre-trained emotion model, the processor 1001 specifically performs the following operations:
[0125] Input the question description text into the pre-trained emotional model and output the probability distribution of the user under multiple preset emotional types;
[0126] Connecting to a preset dialogue template library, which stores the mapping relationship between emotion types and dialogue templates;
[0127] From the mapping relationship, the dialogue template corresponding to the emotion type with the largest probability value in the probability distribution is obtained as the dialogue template of the user.
[0128] In one embodiment, the processor 1001 further performs the following operations:
[0129] Collect doctor-patient dialogue corpus in the medical field;
[0130] The basic model is obtained by performing machine learning on the neural network through the doctor-patient dialogue corpus;
[0131] Create a target output layer and a target cross entropy loss function. The target output layer is used to output the probability distribution of the user under multiple preset emotion types. The target cross entropy loss function is used to determine the difference between the predicted result and the actual emotion type label.
[0132] Replace the output layer and cross entropy loss function in the basic model with the target output layer and target cross entropy loss function to obtain the large emotion model;
[0133] Collect emotion datasets and emotion fine-tuning datasets. The emotion datasets and emotion fine-tuning datasets are used to train the emotion model so that it has the ability to understand and simulate the comforting skills of medical staff;
[0134] Input the emotion dataset and emotion fine-tuning dataset into the emotion model and output the model loss value;
[0135] When the loss value reaches the minimum, a pre-trained sentiment model is generated.
[0136] In one embodiment, the processor 1001 further performs the following operations:
[0137] Collect pain data sets, which include historical medical records of patients from multiple hospitals and preset publicly available pain data;
[0138] Preprocess the pain data set to obtain a model training set;
[0139] Create a pain model;
[0140] Input the model training set into the pain model and output the error value;
[0141] When the error value reaches the minimum, the pre-trained pain model is generated.
[0142] In the embodiments of the present application, on the one hand, the pre-trained pain model is trained based on a pain data set, which can supplement the existing medical training data so that the model can accurately output responses in the field of pain; on the other hand, the pre-trained emotional model is used to analyze the user's emotions, and based on the results of the analysis, the user's optimal dialogue template can be obtained. The optimal dialogue template can make the final response result have emotional color, so that the model can reflect humanistic care and emotional support in the interaction with the user, thereby improving the intelligence of pain management.
[0143] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the pain question-answering program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium of the pain question-answering program can be a disk, an optical disk, a read-only storage memory, or a random access memory, etc.
[0144] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A pain question-answering method, characterized in that: The method comprises: Receive a question-and-answer request, the question-and-answer request carrying a user's question description text; According to a preset sentiment analysis model and the question description text, identifying the emotion type of the user, the preset sentiment analysis model is used to identify the emotion type of the user according to the question description text; In the case where the user's emotion type is positive or negative, the problem description text is input into a pre-trained pain model, the disease analysis result of the user is output, and the optimal dialogue template of the user is obtained according to the pre-trained emotion big model; the pre-trained pain model is trained based on the pain data set, and the pre-trained emotion big model is used to analyze the user's emotions; Based on the optimal dialogue template, the disease analysis result is expressed and optimized to generate a response result corresponding to the question description text.
2. The method according to claim 1, characterized in that The step of identifying the user's emotion type according to a preset sentiment analysis model and the question description text includes: Convert the problem description text into a word sequence; Inputting the word sequence into a preset sentiment analysis model for forward propagation, so as to process each word backward one by one starting from the first word in the word sequence, and obtain a first hidden state sequence of each word in a forward context; Inputting the word sequence into a preset sentiment analysis model for back propagation, so as to process each word one by one from the last word in the word sequence forward, and obtain a second hidden state sequence of each word in a reverse context; Fusing the first hidden state sequence with the second hidden state sequence to obtain a fused hidden state; Performing emotion prediction based on the output layer of a preset emotion analysis model and the fused hidden state to obtain an emotion score of the user; From the preset correspondence between the emotion value interval and the emotion type, a target emotion type corresponding to the target emotion value interval containing the emotion score is determined as the emotion type of the user.
3. The method according to claim 2, characterized in that The expression of the user's emotion score is: s=f(W out h+b out ); Where s is the user’s sentiment score, W out is the weight matrix of the output layer, b out is the bias term and f is the activation function.
4. The method according to claim 1, characterized in that: The step of obtaining the user's dialogue template according to the pre-trained emotion model includes: Input the question description text into a pre-trained emotion model, and output the probability distribution of the user under multiple preset emotion types; Connecting to a preset dialogue template library, wherein the preset dialogue template library stores a mapping relationship between emotion types and dialogue templates; From the mapping relationship, a dialogue template corresponding to the emotion type with the largest probability value in the probability distribution is obtained as the dialogue template of the user.
5. The method according to claim 1, characterized in that Follow these steps to generate a pre-trained sentiment model, including: Collect doctor-patient dialogue corpus in the medical field; Performing machine learning on the neural network through the doctor-patient dialogue corpus to obtain a basic model; Creating a target output layer and a target cross entropy loss function, wherein the target output layer is used to output the probability distribution of the user under a plurality of preset emotion types, and the target cross entropy loss function is used to determine the difference between the prediction result and the true emotion type label; The output layer and the cross entropy loss function in the basic model are replaced by the target output layer and the target cross entropy loss function to obtain a large emotion model; Collecting emotion data sets and emotion fine-tuning data sets, wherein the emotion data sets and emotion fine-tuning data sets are used to train the emotion big model so that it has the ability to understand and simulate the comforting skills of medical staff; Input the emotion class dataset and the emotion fine-tuning dataset into the emotion big model, and output the model loss value; When the loss value reaches the minimum, a pre-trained sentiment model is generated.
6. The method according to claim 5, characterized in that The target cross entropy loss function is: Among them, L CE is the loss value, N is the number of samples, C is the number of emotion types, y i,c is the one-hot encoding of the true emotion type of sample i, is the probability predicted by the model that sample i belongs to emotion type c.
7. The method according to claim 1, characterized in that The pre-trained pain model is generated according to the following steps, including: Collecting a pain data set, wherein the pain data set includes historical medical records of patients from multiple hospitals and preset publicly available pain data; Preprocessing the pain data set to obtain a model training set; Create a pain model; Inputting the model training set into the pain model and outputting an error value; When the error value reaches the minimum, a pre-trained pain model is generated.
8. A pain question-answering device, characterized in that: The device comprises: A receiving module, configured to receive a question-and-answer request, wherein the question-and-answer request carries a user's question description text; An identification module, used to identify the emotion type of the user according to a preset emotion analysis model and the question description text, wherein the preset emotion analysis model is used to identify the emotion type of the user according to the question description text; An output module, used for inputting the problem description text into a pre-trained pain model, outputting the disease analysis result of the user, and obtaining the optimal dialogue template of the user according to the pre-trained emotion big model, when the emotion type of the user is positive or negative; the pre-trained pain model is trained based on the pain data set, and the pre-trained emotion big model is used to analyze the emotion of the user; A generation module is used to optimize the expression of the disease analysis results based on the optimal dialogue template and generate a response result corresponding to the problem description text.
9. A computer storage medium, characterized in that The computer storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the method according to any one of claims 1 to 7.
10. An electronic device, characterized in that: include: A processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Aspect-level emotion classification model based on multi-memory attention network
CN112256876A
Online medical question and answer method
CN113764112A
Artificial intelligence questionnaire generation method
CN115375463A
Medical question-answering system and method based on pain perception and active interaction
CN115714030A
Personalized meta-cognition enhanced heuristic emotion support dialogue method
CN116702794A
