Psychological consultation result generation method and device, equipment and storage medium
By obtaining and integrating the consultation dialogue text and searching text, and using the preset psychological counseling model to generate consultation results, the problem of inaccurate psychological symptoms recognition in the existing technology is solved, and more accurate psychological symptoms recognition and the formulation of personalized treatment plans are achieved.
Patent Information
- Application Number
- CN202411731854.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-03-11
AI Technical Summary
The prior art is difficult to accurately identify and capture the patient's psychological symptoms information, resulting in misdiagnosis or missed diagnosis of psychological diagnosis, and lack of personalized treatment plans.
By obtaining the consultation dialogue text and search text, combining the preset psychological counseling model, the two are spliced and fused to generate consultation results, thereby improving the accuracy of psychological symptoms recognition.
It achieves a more accurate capture of patients' psychological symptoms information, improves the accuracy of psychological symptoms recognition, and provides valuable decision-making support to medical staff.
Smart Images

Figure CN119601219A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of medical health technology, and in particular to a method, device, equipment and storage medium for generating psychological counseling results. Background Art
[0002] As living standards improve, more and more people begin to pay attention to their health status. People gradually realize that health is not only about physical strength, but also includes mental and emotional balance. The identification of psychological symptoms is very important in the psychological diagnosis process because it is the basis for accurate assessment and treatment of mental illness. First, accurate symptom identification can help doctors quickly understand the patient's mental state and clarify the diagnostic direction to avoid misdiagnosis or missed diagnosis. Secondly, the detailed classification and understanding of symptoms can help develop personalized treatment plans to ensure that patients receive the most suitable psychological intervention.
[0003] As society pays more attention to mental health, there is an urgent need to provide a method for generating psychological counseling results to more accurately capture patients' psychological symptom information and provide valuable decision-making support for medical staff. Summary of the invention
[0004] The main purpose of this application is to provide a method, device, equipment and storage medium for generating psychological counseling results, inputting the counseling dialogue text and the search text into a preset psychological counseling model together to splice and fuse the counseling dialogue text and the search text to generate corresponding counseling results; adding additional psychological symptom-related information from the counseling dialogue text so that the psychological counseling model can more accurately capture the patient's psychological symptom information, thereby improving the accuracy of psychological symptom identification.
[0005] In a first aspect, the present application provides a method for generating psychological consultation results, comprising:
[0006] Get the consultation dialogue text;
[0007] Acquire a search text corresponding to the consultation dialogue text from a preset knowledge base, wherein the search text includes information related to psychological symptoms;
[0008] Based on a preset psychological counseling model, the counseling dialogue text and the search text are spliced and fused to generate corresponding counseling results.
[0009] In a second aspect, the present application also provides a device for generating psychological consultation results, including:
[0010] The first acquisition module is used to acquire the consultation dialogue text;
[0011] A second acquisition module is used to acquire a search text corresponding to the consultation dialogue text from a preset knowledge base, wherein the search text includes information related to psychological symptoms;
[0012] The result generation module is used to splice and fuse the consultation dialogue text with the search text based on a preset psychological consultation model to generate corresponding consultation results.
[0013] In a third aspect, the present application further provides a computer device, the computer device comprising a memory and a processor;
[0014] The memory is used to store computer programs;
[0015] The processor is used to execute the computer program and implement the method for generating psychological consultation results as described above when executing the computer program.
[0016] In a fourth aspect, the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for generating psychological counseling results as described above are implemented.
[0017] The present application provides a method, device, equipment and storage medium for generating psychological counseling results, wherein the method includes: obtaining a counseling conversation text; obtaining a search text corresponding to the counseling conversation text from a preset knowledge base, wherein the search text includes information related to psychological symptoms; based on a preset psychological counseling model, the counseling conversation text and the search text are spliced and merged to generate a corresponding counseling result. The present application first obtains a counseling conversation text between a patient and a psychologist; then, based on the counseling conversation text, a search is performed in a preset knowledge base to obtain a search text including information related to psychological symptoms, so as to provide professional knowledge related to psychological symptoms; finally, the counseling conversation text and the search text are input into a preset psychological counseling model together to splice and merge the counseling conversation text and the search text to generate a corresponding counseling result; additional information related to psychological symptoms is added from the counseling conversation text, so that the psychological counseling model can more accurately capture the information of the patient's psychological symptoms, thereby improving the accuracy of psychological symptom recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0019] Figure 1A flowchart of a method for generating psychological consultation results provided in an embodiment of the present application;
[0020] Figure 2 A schematic diagram of the connection between the server and the terminal device provided in the embodiment of the present application;
[0021] Figure 3 A schematic diagram of the structure of the psychological counseling model provided in the embodiment of the present application;
[0022] Figure 4 A schematic diagram of a framework for generating consultation results provided in an embodiment of the present application;
[0023] Figure 5 A schematic block diagram of a device for generating psychological consultation results provided in an embodiment of the present application;
[0024] Figure 6 A schematic block diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0026] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0027] The embodiments of the present application provide a method, device, equipment and storage medium for generating psychological counseling results. Among them, the method for generating psychological counseling results can be applied to a terminal device, which can be a mobile phone, a tablet computer, a laptop computer, a desktop computer and other devices. It can also be applied to a server, which can be a separate server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0028] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0029] See also Figure 1 , Figure 1 This is a flow chart of a method for generating a psychological consultation result provided in an embodiment of the present application. It should be noted that the method for generating a psychological consultation result provided in an embodiment of the present application can be used in a terminal device, and of course can also be used in a server.
[0030] like Figure 2 As shown, the method for generating the psychological consultation result is applied to a server, the server and the terminal device are connected in communication, and the consultation result obtained by the method for generating the psychological consultation result can be sent to the terminal device through the server. Of course, it is not limited to this and is not limited here.
[0031] In specific implementation, the terminal device includes but is not limited to: any one of a mobile phone, a tablet computer, a laptop computer, and a desktop computer; the server can be a single server or a server cluster, or a cloud server that provides cloud computing services.
[0032] like Figure 1 As shown, the method for generating the psychological consultation result includes steps S101 to S103.
[0033] Step S101, obtaining the consultation dialogue text.
[0034] Taking the medical field as an example, the consultation dialogue text may refer to the dialogue text in the process of a patient asking a doctor for a consultation. The consultation dialogue text in the embodiment of the present application may include a first dialogue text and a second dialogue text, wherein the first dialogue text may be the content of the questions asked by the psychologist to the patient, and the second dialogue text may be the content corresponding to the patient's response to the psychologist's questions. It is understandable that the first dialogue text and the second dialogue text may both be chat contents related to the patient's consultation with the psychologist on psychological symptoms.
[0035] Specifically, the first dialogue text of the psychologist's question to the patient can be, "Tell me about your recent situation first." The second dialogue text corresponding to the patient's response to the psychologist's question can be, "I feel very bad recently, very depressed and uncomfortable."
[0036] Step S102: Acquire a search text corresponding to the consultation dialogue text from a preset knowledge base, wherein the search text includes information related to psychological symptoms.
[0037] For example, the knowledge base in the embodiment of the present application may include professional psychological symptom information related to mental illness, that is, document information. For example, the document information in the knowledge base may include academic articles or cases of various psychological knowledge. The embodiment of the present application can obtain retrieval text including psychological symptom related information from the knowledge base, for example, psychological symptom related information such as low mood, anxiety, depression, inattention, slow thinking, and memory loss. After obtaining the consultation dialogue text, the embodiment of the present application can search in the knowledge base according to the consultation dialogue text to obtain more professional psychological symptom related information, that is, the retrieval text.
[0038] Exemplarily, the present application searches the knowledge base according to the consultation dialogue text, and may obtain multiple search texts. For example, the consultation dialogue text is "Tell me about your recent situation first?" and "I have been feeling very bad recently, very depressed and uncomfortable." The search texts obtained may include: Search text 1: bad mood, very depressed, possible corresponding symptoms include fatigue, lack of motivation, lack of interest in things..., Search text 2: bad mood is usually a common manifestation of low mood..., Search text 3: bad mood is also one of the manifestations of anxiety...etc.
[0039] In an exemplary implementation, step S102 may include step S201 and step S202.
[0040] Step S201: In a preset knowledge base, target document information is retrieved based on the consultation dialogue text; the matching degree between the target document information and the consultation dialogue text is greater than the matching degree between the remaining document information in the knowledge base and the consultation dialogue text.
[0041] Step S202: Generate a search text corresponding to the consultation dialogue text according to the target document information and the consultation dialogue text.
[0042] The knowledge base in the embodiment of the present application may include professional psychological symptom information related to mental illness, that is, document information. For example, the document information in the knowledge base may include academic articles or cases of various psychological knowledge. The embodiment of the present application may retrieve target document information matching the consultation dialogue text in a preset knowledge base based on the consultation dialogue text, and then generate a retrieval text corresponding to the consultation dialogue text based on the target text information and the consultation dialogue text.
[0043] Specifically, after obtaining the first dialogue text and the second dialogue text, first retrieve target document information that matches the content describing the psychological symptoms in the first dialogue text and the second dialogue text from the knowledge base to provide useful context information and knowledge support; then fuse the target document information with the consultation dialogue text to generate a retrieval text corresponding to the consultation dialogue text; and by fusing the retrieved retrieval text with the psychological symptom information in the external knowledge base, the retrieved retrieval text is made more accurate.
[0044] For example, the embodiment of the present application may use RAG (Retrieval-Augmented Generation) technology to search for a retrieval text corresponding to the consultation dialogue text in the knowledge base.
[0045] It should be noted that RAG is a natural language processing technology that combines information retrieval, text enhancement and text generation. It generates text content by retrieving relevant document information from an external knowledge base and inputting it as a prompt to the language model. RAG has the advantages of wide knowledge coverage, generated content accuracy and enhanced context relevance.
[0046] In an exemplary implementation, step S201 may include steps S2011 to S2015.
[0047] Step S2011: Obtain a vector set corresponding to a preset knowledge base, where the vector set includes vector data corresponding to each of a plurality of document information in the knowledge base.
[0048] Step S2012: vector encode the consultation dialogue text to obtain a query vector.
[0049] Step S2013: Determine the similarity between the query vector and the vector data in the vector set.
[0050] Step S2014: determine a target vector in the vector set according to the similarity corresponding to the vector data, wherein the similarity between the target vector and the query vector is greater than the similarity between the remaining vector data in the vector set and the query vector.
[0051] Step S2015: Determine that the document information corresponding to the target vector is the target document information.
[0052] For example, the embodiment of the present application can retrieve the target document information corresponding to the consultation dialogue text through the retrieval module in RAG. Specifically, first obtain the vector set corresponding to the knowledge base, that is, the vector data corresponding to each of the multiple document information in the knowledge base; then use the pre-trained text embedding model to vector encode the consultation dialogue text to convert the consultation dialogue text into a query vector; then use the double tower model to map the query vector and the vector data in the vector set to the same vector space for similarity calculation to determine the similarity between the query vector and each vector data, thereby selecting the target vector with the greatest similarity from the similarities corresponding to the multiple vector data, and using the document information corresponding to the target vector as the target document information to provide useful context information and knowledge support for the subsequent generation of the retrieval text.
[0053] In an exemplary embodiment, the present application can fuse the target document information with the consultation dialogue text based on the generation module of RAG to generate a retrieval text corresponding to the consultation dialogue text. The generation module of RAG can be a large language model. The retrieved target document information and the consultation dialogue text are fused together to form a new input sequence. This input sequence includes both the original intention for retrieval (consultation dialogue text) and the information retrieved from the knowledge base (target document information). Such an input sequence can provide a more comprehensive and accurate information basis for the large language model, which helps to generate more accurate and relevant retrieval texts.
[0054] Step S103: Based on the preset psychological consultation model, the consultation dialogue text and the search text are spliced and merged to generate corresponding consultation results.
[0055] The psychological counseling results in the embodiments of the present application may include psychological symptoms and affirmative or negative expressions. For example, the counseling results output by the preset psychological counseling model may be expressed as: anxiety (affirmative), depression (negative), etc.
[0056] Specifically, the preset psychological counseling model can first perform text conversion on the consultation dialogue text and the retrieval text to obtain a vector format that is convenient for model processing, and preprocess the converted vector, for example, removing stop words, punctuation marks, stem extraction, and word form restoration; then extract the conversation information between the doctor and the patient in the consultation dialogue text, as well as relevant information of the retrieval text; then, splice and fuse the extracted conversation information and related information to generate the corresponding consultation results.
[0057] In an exemplary embodiment, the psychological consultation model includes an embedding layer, at least two semantic learning layers, and an output layer. Step S103 may include steps S301 to S303.
[0058] Step S301: Based on the embedding layer, the consultation dialogue text and the search text are converted into text vectors.
[0059] Step S302: based on at least two semantic learning layers, capturing semantic information of text vectors at different levels;
[0060] Step S303: Based on the output layer, the corresponding consultation results are output according to the semantic information of the text vector at different levels.
[0061] For example, the psychological counseling model can be a GPT (Generative Pre-Trained Transformer) model. The GPT model is a generative model that can generate coherent and natural text output based on input text or prompts.
[0062] like Figure 3 As shown, the psychological counseling model in the embodiment of the present application may include an embedding layer, multiple semantic learning layers stacked together, and an output layer. Among them, the embedding layer is a part of the input layer, which is used to convert text data such as words and sentences into a continuous vector form that the model can understand and process. These vectors are usually represented in a high-dimensional space and can capture the complex features and semantic relationships of text data. The semantic learning layer in the embodiment of the present application can be used to integrate input information, that is, to integrate the text vectors corresponding to the consultation dialogue text and the retrieval text. As the number of layers of the semantic learning layer increases, the information in the retrieval text and the consultation dialogue text is gradually combined, so that semantic information at different levels can be extracted. The output layer may include a fully connected layer and a probability distribution calculation layer. In addition, the psychological counseling model may include multiple root mean square normalizations. Root mean square normalization refers to performing root mean square calculation on the input data and then performing normalization processing using the value obtained by the root mean square calculation. Specifically, the root mean square value of the input data is first calculated, and then the input data is normalized using this root mean square value so that the output of each layer maintains a similar scale. Finally, the normalized data is linearly transformed to restore its original features or perform further adjustments.
[0063] It is understandable that the embodiment of the present application can first convert the consultation dialogue text and the search text into a Token sequence, and then pass each Token through the embedding layer to convert it into a text vector to capture its semantic and position information, thereby splicing the retrieved search text and the token sequence of the consultation dialogue content into a complete input sequence to form a unified context. The input sequence enters the first layer of multiple semantic learning layers. The semantic learning layer of the first layer can capture the semantic information of the text vector in the input sequence, and then use the semantic information as the input data of the next semantic learning layer until the last semantic learning layer outputs the final semantic information. The semantic information processed from the semantic learning layer is root mean square normalized; the vector after the root mean square normalization is then input into the fully connected layer in the output layer for linear transformation; then, the output of the fully connected layer is converted into a probability distribution through the probability distribution layer (Softmax layer) to obtain the probability value of each text vector, and the text vector with the highest probability value is taken as the output to obtain the consultation result.
[0064] like Figure 4 As shown, the embodiment of the present application inputs the consultation dialogue text, such as the first dialogue text and the second dialogue text, into the knowledge base, retrieves the corresponding search text from the knowledge base, and then inputs the first dialogue text, the second dialogue text and the search text into the psychological consultation model to splice and fuse the first dialogue text, the second dialogue text and the search text to obtain the consultation result. Specifically, the psychological consultation model can identify the corresponding psychological symptoms and affirmative or negative expressions.
[0065] The embodiment of the present application realizes in-depth information mining in the process of psychological illness consultation by combining the first dialogue text of the psychologist's questions to the patient and the second dialogue text of the patient's targeted responses, and can more accurately capture the patient's psychological symptom information; furthermore, the retrieval enhancement technology is introduced to retrieve the retrieval text corresponding to the consultation dialogue text in the knowledge base, which effectively integrates rich psychological symptom-related information and improves the knowledge coverage and comprehension ability of the psychological consultation model; thereby, it can provide valuable decision-making support for psychologists and help them make more correct diagnoses in complex psychological consultation scenarios.
[0066] In an exemplary embodiment, the semantic learning layer includes a self-attention mechanism and a feed-forward network. Step S302 may include step S3021 and step S3022.
[0067] Step S3021: Based on the self-attention mechanism, the dependency between each text vector and other text vectors is captured to obtain the contextual representation of each text vector.
[0068] Step S3022: Based on the feedforward network, the context representation is integrated to obtain semantic information.
[0069] Exemplarily, the semantic learning layer in the embodiment of the present application may include a self-attention mechanism and a feed-forward network. Based on the self-attention mechanism, the dependency between each text vector and other text vectors can be captured to obtain the contextual representation of each text vector.
[0070] Specifically, the correlation (or attention score) between each text vector and other text vectors is first calculated through the self-attention mechanism to capture the dependency between them. The attention score can then be converted into attention weights through the softmax function. These attention weights represent the degree of attention of each text vector to other text vectors. Then, the contextual representation of each text vector is obtained by weighted summing the text vector with the corresponding attention weight. Since each text vector incorporates information from other text vectors, a richer contextual representation is formed. Feedforward networks are generally used to further process and integrate the contextual representation generated by the self-attention mechanism to obtain semantic information.
[0071] In an exemplary implementation, step S104 and step S105 may be included before step S103.
[0072] Step S104, obtaining a training sample set, the training sample set including a consultation dialogue training text, a retrieval training text, and consultation result labels corresponding to the consultation dialogue training text and the retrieval training text; wherein the retrieval training text is retrieved based on the consultation dialogue training text.
[0073] Step S105: training the psychological counseling model to be trained according to the training sample set to obtain a preset psychological counseling model.
[0074] For example, a large amount of conversation data between psychologists and patients during consultations can be collected through various channels such as offline hospitals and online consultations, and the collected conversation data can be processed (such as cleaning, denoising, etc.) to screen out high-quality conversation data, so that these conversation data can be used as consultation conversation training texts for training the psychological counseling model to be trained.
[0075] Exemplarily, the embodiment of the present application may search in a knowledge base including information related to psychological symptoms based on the consultation dialogue training text to obtain a retrieval training text corresponding to the consultation dialogue training text.
[0076] The embodiment of the present application can manually annotate the consultation dialogue training text and the consultation result label corresponding to the retrieval training text. Specifically, the name of the psychological symptom and the positive or negative expression of the symptom are annotated to obtain the corresponding consultation result label. The consultation result label in the embodiment of the present application can be expressed as low mood (positive).
[0077] The psychological counseling model to be trained is trained based on the consultation dialogue training text, retrieval training text and consultation result labels, and the rich psychological symptom-related information in the knowledge base is integrated, so that the preset psychological counseling model obtained by training can learn professional knowledge about psychology, thereby improving the model's knowledge coverage and comprehension ability.
[0078] For example, in the embodiment of the present application, the LORA (Low-Rank Adaptation) technology can also be used to fine-tune the psychological counseling model to be trained during the training of the psychological counseling model to be trained. Among them, LORA is a technology for adjusting the training language model, which first freezes most of the weights of the base model and fine-tunes on a relatively small number of trainable low-rank matrices. By introducing a low-rank matrix to efficiently fine-tune the model, it can adapt to different downstream tasks or personalized needs, while keeping the original capabilities of the model not greatly affected.
[0079] In an exemplary implementation, step S105 may include step S501 and step S502.
[0080] Step S501: Based on the psychological consultation model to be trained, the consultation dialogue training text and the retrieval training text are spliced and merged to generate the corresponding current consultation result.
[0081] Step S502: According to the deviation between the current consultation result and the consultation result label, the model parameters of the psychological consultation model to be trained are adjusted to obtain a preset psychological consultation model.
[0082] It is understandable that the model parameters refer to the evaluation ability of the psychological counseling model to be trained, and the model parameters of the psychological counseling model to be trained are very important for the accuracy of the counseling results obtained by its evaluation. In the process of training the psychological counseling model to be trained according to the training sample set, it is generally necessary to continuously adjust the model parameters so that the current counseling result and the counseling result label obtained by the evaluation of the psychological counseling model to be trained are the same, and finally the preset psychological counseling model is trained. Therefore, if the current counseling result obtained by training is very close to the counseling result label corresponding to the training sample set, it means that the current evaluation accuracy of the psychological counseling model to be trained is relatively high, and therefore, it can be used as a preset psychological counseling model; if the current counseling result obtained by training is significantly different from the counseling result label corresponding to the training sample set, it is necessary to adjust the model parameters of the psychological counseling model to be trained again, and then repeat the training until the current counseling result is close to the counseling result label or the current counseling result is the same as the counseling result label, so as to train the preset psychological counseling model.
[0083] The method for generating psychological counseling results provided in the above-mentioned embodiment includes: obtaining a counseling conversation text; obtaining a search text corresponding to the counseling conversation text, the search text including information related to psychological symptoms; based on a preset psychological counseling model, splicing and fusing the counseling conversation text and the search text to generate a corresponding counseling result. The embodiment of the present application first obtains the counseling conversation text between the patient and the psychologist; then, based on the counseling conversation text, a search is performed in a preset knowledge base to obtain a search text including information related to psychological symptoms to provide professional knowledge related to psychological symptoms; finally, the counseling conversation text and the search text are input into a preset psychological counseling model together to splice and fuse the counseling conversation text and the search text to generate a corresponding counseling result; additional information related to psychological symptoms is added from the counseling conversation text, so that the psychological counseling model can more accurately capture the information on the patient's psychological symptoms, thereby improving the accuracy of psychological symptom recognition.
[0084] See also Figure 5 , Figure 5 A schematic block diagram of a device for generating a psychological consultation result provided in an embodiment of the present application. The device for generating a psychological consultation result can be configured in a server or a terminal device to execute the aforementioned method for generating a psychological consultation result.
[0085] like Figure 5 As shown, the device for generating the psychological consultation result includes: a first acquisition module 110, a second acquisition module 120 and a result generation module 130.
[0086] The first acquisition module 110 is used to acquire the consultation dialogue text.
[0087] The second acquisition module 120 is used to acquire a search text corresponding to the consultation dialogue text from a preset knowledge base, where the search text includes information related to psychological symptoms.
[0088] The result generation module 130 is used to splice and fuse the consultation dialogue text and the search text based on a preset psychological consultation model to generate corresponding consultation results.
[0089] In an exemplary implementation, the second acquisition module 120 may include a retrieval submodule and a generation submodule.
[0090] The retrieval submodule is used to retrieve target document information from a preset knowledge base based on the consultation dialogue text; the matching degree between the target document information and the consultation dialogue text is greater than the matching degree between the remaining document information in the knowledge base and the consultation dialogue text.
[0091] The first generating submodule is used to generate a search text corresponding to the consultation dialogue text according to the target document information and the consultation dialogue text.
[0092] In an exemplary embodiment, the retrieval submodule may include a collection acquisition submodule, a vector encoding submodule, a similarity determination submodule, a target vector determination submodule, and a target document determination submodule.
[0093] The set acquisition submodule is used to acquire a vector set corresponding to a preset knowledge base, and the vector set includes vector data corresponding to each of a plurality of document information in the knowledge base.
[0094] The vector encoding submodule is used to perform vector encoding on the consultation dialogue text to obtain a query vector.
[0095] The similarity determination submodule is used to determine the similarity between the query vector and the vector data in the vector set.
[0096] The target vector determination submodule is used to determine the target vector in the vector set according to the similarity corresponding to the vector data, and the similarity between the target vector and the query vector is greater than the similarity between the remaining vector data in the vector set and the query vector.
[0097] The target document determination submodule is used to determine that the document information corresponding to the target vector is the target document information.
[0098] In an exemplary embodiment, the psychological consultation model includes an embedding layer, at least two semantic learning layers, and an output layer. The result generation module 130 may include a conversion submodule, a semantic learning submodule, and an output submodule.
[0099] The conversion submodule is used to convert the consultation dialogue text and the retrieval text into text vectors based on the embedding layer.
[0100] The semantic learning submodule is used to capture the semantic information of the text vector at different levels based on at least two semantic learning layers.
[0101] The output submodule is used to output the corresponding consulting results based on the output layer and the semantic information of the text vector at different levels.
[0102] In an exemplary embodiment, the semantic learning layer includes a self-attention mechanism and a feed-forward network. The semantic learning submodule may include a relationship capture submodule and an integration submodule.
[0103] The relationship capture submodule is used to capture the dependency between each text vector and other text vectors based on the self-attention mechanism to obtain the contextual representation of each text vector.
[0104] The integration submodule is used to integrate the context representation based on the feedforward network to obtain semantic information.
[0105] In an exemplary embodiment, the apparatus may further include a third acquisition module and a training module.
[0106] The third acquisition module is used to obtain a training sample set, which includes a consultation dialogue training text, a retrieval training text, and consultation result labels corresponding to the consultation dialogue training text and the retrieval training text; wherein the retrieval training text is retrieved based on the consultation dialogue training text.
[0107] The training module is used to train the psychological counseling model to be trained according to the training sample set to obtain a preset psychological counseling model.
[0108] In an exemplary embodiment, the training module may include a second generating submodule and an adjusting submodule.
[0109] The second generation submodule is used to splice and fuse the consultation dialogue training text and the retrieval training text based on the psychological consultation model to be trained, so as to generate the corresponding current consultation result.
[0110] The adjustment submodule is used to adjust the model parameters of the psychological counseling model to be trained according to the deviation between the current counseling result and the counseling result label to obtain the preset psychological counseling model.
[0111] It should be noted that technicians in the relevant field can clearly understand that for the convenience and simplicity of description, the specific working processes of the above-described devices and modules and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0112] The method of the present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0113] Exemplarily, the above method and apparatus may be implemented in the form of a computer program, which may be run on a computer device.
[0114] See also Figure 6 , Figure 6A schematic block diagram of the structure of a computer device provided in an embodiment of the present application. The computer device may be a server or a terminal device.
[0115] like Figure 6 As shown, the computer device includes a processor, a memory, and a network interface connected via a system bus, wherein the memory may include a storage medium and an internal memory.
[0116] The storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute the steps of any method for generating a psychological consultation result.
[0117] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.
[0118] The internal memory provides an environment for the operation of the computer program in the storage medium. When the computer program is executed by the processor, the processor can execute the steps of any method for generating psychological counseling results.
[0119] The network interface is used for network communication, such as sending assigned tasks.
[0120] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0121] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0122] In one embodiment, the processor is used to execute a computer program and implement the following steps when executing the computer program:
[0123] Get the consultation dialogue text;
[0124] Obtaining a search text corresponding to the consultation dialogue text from a preset knowledge base, wherein the search text includes information related to psychological symptoms;
[0125] Based on the preset psychological counseling model, the counseling dialogue text and the search text are spliced and fused to generate the corresponding counseling results.
[0126] In an exemplary embodiment, obtaining a search text corresponding to the consultation dialogue text from a preset knowledge base includes:
[0127] In a preset knowledge base, target document information is retrieved based on the consultation dialogue text; the matching degree between the target document information and the consultation dialogue text is greater than the matching degree between the remaining document information in the knowledge base and the consultation dialogue text;
[0128] According to the target document information and the consultation dialogue text, a search text corresponding to the consultation dialogue text is generated.
[0129] In an exemplary embodiment, in a preset knowledge base, target document information is retrieved based on the consultation dialogue text, including:
[0130] Obtaining a vector set corresponding to a preset knowledge base, the vector set including vector data corresponding to each of a plurality of document information in the knowledge base;
[0131] Vector encoding is performed on the consultation dialogue text to obtain a query vector;
[0132] Determine the similarity between the query vector and the vector data in the vector set;
[0133] According to the similarity corresponding to the vector data, a target vector is determined in the vector set, and the similarity between the target vector and the query vector is greater than the similarity between the remaining vector data in the vector set and the query vector;
[0134] The document information corresponding to the target vector is determined as the target document information.
[0135] In an exemplary embodiment, the psychological consultation model includes an embedding layer, at least two semantic learning layers, and an output layer; based on the preset psychological consultation model, the consultation dialogue text and the search text are spliced and fused to generate corresponding consultation results, including:
[0136] Based on the embedding layer, the consultation dialogue text and the search text are converted into text vectors;
[0137] Based on at least two semantic learning layers, it captures the semantic information of text vectors at different levels;
[0138] Based on the output layer, the corresponding consulting results are output according to the semantic information of the text vector at different levels.
[0139] In an exemplary embodiment, the semantic learning layer includes a self-attention mechanism and a feed-forward network; based on at least two semantic learning layers, the semantic information of the text vector at different levels is captured, including:
[0140] Based on the self-attention mechanism, the dependency between each text vector and other text vectors is captured to obtain the contextual representation of each text vector;
[0141] Based on the feedforward network, the context representation is integrated and processed to obtain semantic information.
[0142] In an exemplary embodiment, before splicing and fusing the consultation dialogue text and the search text based on the preset psychological consultation model to generate the corresponding consultation result, it also includes:
[0143] Obtaining a training sample set, the training sample set includes a consultation dialogue training text, a retrieval training text, and consultation result labels corresponding to the consultation dialogue training text and the retrieval training text; wherein the retrieval training text is retrieved according to the consultation dialogue training text;
[0144] The psychological counseling model to be trained is trained according to the training sample set to obtain a preset psychological counseling model.
[0145] In an exemplary embodiment, the psychological counseling model to be trained is trained according to the training sample set to obtain a preset psychological counseling model, including:
[0146] Based on the psychological consultation model to be trained, the consultation dialogue training text and the retrieval training text are spliced and fused to generate the corresponding current consultation results;
[0147] According to the deviation between the current consultation result and the consultation result label, the model parameters of the psychological consultation model to be trained are adjusted to obtain the preset psychological consultation model.
[0148] It should be noted that technical personnel in the relevant field can clearly understand that, for the convenience and brevity of description, the specific working process of generating psychological counseling results described above can refer to the corresponding process in the embodiment of the aforementioned method for generating psychological counseling results, and will not be repeated here.
[0149] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. The method implemented when the computer program is executed by a processor can refer to the various embodiments of the method for generating psychological counseling results of the present application.
[0150] The computer-readable storage medium may be an internal storage unit of the computer device of the aforementioned embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device.
[0151] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0152] It should also be understood that the term "and / or" used in the specification of this application and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations. It should be noted that, in this article, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "including a..." does not exclude the presence of other identical elements in the process, method, article or system including the element.
[0153] The serial numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments. The above description is only a specific implementation mode of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A method for generating psychological consultation results, characterized in that: include: Get the consultation dialogue text; Acquire a search text corresponding to the consultation dialogue text from a preset knowledge base, wherein the search text includes information related to psychological symptoms; Based on a preset psychological counseling model, the counseling dialogue text and the search text are spliced and fused to generate corresponding counseling results.
2. The method for generating psychological consultation results according to claim 1, characterized in that: The step of acquiring a search text corresponding to the consultation dialogue text from a preset knowledge base includes: In a preset knowledge base, target document information is retrieved according to the consultation dialogue text; the matching degree between the target document information and the consultation dialogue text is greater than the matching degree between the remaining document information in the knowledge base and the consultation dialogue text; A search text corresponding to the consultation dialogue text is generated according to the target document information and the consultation dialogue text.
3. The method for generating psychological consultation results according to claim 2, characterized in that: The step of retrieving target document information from the preset knowledge base according to the consultation dialogue text includes: Obtaining a vector set corresponding to a preset knowledge base, the vector set including vector data corresponding to each of a plurality of document information in the knowledge base; Performing vector encoding on the consultation dialogue text to obtain a query vector; Determining the similarity between the query vector and the vector data in the vector set; Determine a target vector in the vector set according to the similarity corresponding to the vector data, wherein the similarity between the target vector and the query vector is greater than the similarity between the remaining vector data in the vector set and the query vector; The document information corresponding to the target vector is determined as the target document information.
4. The method for generating psychological consultation results according to claim 1, characterized in that: The psychological consultation model includes an embedding layer, at least two semantic learning layers and an output layer; the preset psychological consultation model is based on which the consultation dialogue text and the search text are spliced and merged to generate corresponding consultation results, including: Based on the embedding layer, converting the consultation dialogue text and the search text into text vectors; Based on the at least two semantic learning layers, capturing semantic information of the text vector at different levels; Based on the output layer, the corresponding consulting results are output according to the semantic information of the text vector at different levels.
5. The method for generating psychological consultation results according to claim 4, characterized in that: The semantic learning layer includes a self-attention mechanism and a feedforward network; the capturing of semantic information of the text vector at different levels based on the at least two semantic learning layers includes: Based on the self-attention mechanism, the dependency between each of the text vectors and other text vectors is captured to obtain a contextual representation of each of the text vectors; Based on the feedforward network, the context representation is integrated to obtain semantic information.
6. The method for generating psychological consultation results according to any one of claims 1 to 5, characterized in that: Before the consultation dialogue text and the search text are spliced and merged based on the preset psychological consultation model to generate corresponding consultation results, the method further includes: Acquire a training sample set, the training sample set comprising a consultation dialogue training text, a retrieval training text, and consultation result labels corresponding to the consultation dialogue training text and the retrieval training text; wherein the retrieval training text is retrieved according to the consultation dialogue training text; The psychological counseling model to be trained is trained according to the training sample set to obtain a preset psychological counseling model.
7. The method for generating psychological consultation results according to claim 6, characterized in that: The psychological counseling model to be trained is trained according to the training sample set to obtain a preset psychological counseling model, including: Based on the psychological consultation model to be trained, the consultation dialogue training text and the retrieval training text are spliced and merged to generate the corresponding current consultation result; According to the deviation between the current consultation result and the consultation result label, the model parameters of the psychological consultation model to be trained are adjusted to obtain a preset psychological consultation model.
8. A device for generating psychological consultation results, characterized in that: include: The first acquisition module is used to acquire the consultation dialogue text; A second acquisition module is used to acquire a search text corresponding to the consultation dialogue text from a preset knowledge base, wherein the search text includes information related to psychological symptoms; The result generation module is used to splice and fuse the consultation dialogue text with the search text based on a preset psychological consultation model to generate corresponding consultation results.
9. A computer device, characterized in that: The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is used to execute the computer program and implement the method for generating psychological consultation results as described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for generating psychological consultation results as described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Conversation information generation method and device, server and storage medium
CN116821303A
Medical question and answer text generation method and equipment based on retrieval enhancement generation
CN117763114A
Dialogue processing method and system, electronic equipment and computer readable storage medium
CN118296126A
Medical literature intelligent question answering system and method based on RAG and LLM technologies
CN118364088A
Psychological counseling dialogue generation method and device, equipment and storage medium
CN118553412A