Interrogation reply verbal skill recommendation method and device, computer equipment and storage medium

By introducing the recommended method of consultation and reply speech of embedding layer, entity extraction layer and coding sub-model in the artificial intelligence consultation system, the problems of long response time and low accuracy are solved, and efficient and accurate reply text generation is achieved. Improve the efficiency and quality of intelligent consultation.

CN119296817AActive Publication Date: 2025-01-10PING AN TECH (SHENZHEN) CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202411244408.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-05
Publication Date
2025-01-10
Estimated Expiration
2044-09-05

AI Technical Summary

Technical Problem

In the prior art, the artificial intelligence consultation system has problems such as long response time, high cost, poor quality and low accuracy of the consultation reply text.

Method used

Using the recommended method of consultation and reply speech including an embedded layer, a solid extraction layer, a first coding submodel and a second coding submodel, the reply speech is generated through entity extraction and context understanding, and semantic feature extraction is performed in combination with a pre-constructed term corpus. and calculate, optimize the reply text recommendation.

Benefits of technology

The reasoning response time is shortened, the accuracy and efficiency of the reply text is improved, and the generated reply is more accurate and professional. Combined with the current consultation text and medical entity expression, the efficiency and accuracy of intelligent consultation is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119296817A_ABST
    Figure CN119296817A_ABST
Patent Text Reader

Abstract

The invention belongs to the field of artificial intelligence, and relates to an inquiry reply verbal skill recommendation method, comprising: inputting an inquiry text into a reply verbal skill recommendation model, the reply verbal skill recommendation model comprising an embedded layer, an entity extraction layer, a first coding sub-model, a second coding sub-model and an output layer; carrying out vector coding on the inquiry text through the embedded layer; performing entity extraction on the text embedding vector through an entity extraction layer; processing the entity relationship triad and the inquiry text through a first coding sub-model; querying a verbal skill corpus to obtain candidate reply texts; performing semantic feature extraction on the candidate reply text through a second coding sub-model; and calculating the text enhancement word vector and the text semantic vector to obtain reply verbal skill recommendation. The invention further provides an inquiry reply verbal skill recommendation device, computer equipment and a storage medium. In addition, the invention also relates to a block chain technology, and reply verbal skill recommendation can be stored in a block chain. According to the invention, the efficiency and accuracy of intelligent inquiry can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence and digital medical technology, and in particular to a method, device, computer equipment and storage medium for recommending consultation reply scripts. Background Art

[0002] Medical treatment is an important application area of ​​artificial intelligence, and outpatient consultation is an important area of ​​medical scenarios. During the consultation stage, artificial intelligence technology can provide doctors with speech recommendations, play an auxiliary role in the doctor's consultation, locating the condition, and making treatment recommendations. It can improve the efficiency of communication between doctors and patients, speed up the consultation process, improve service quality, and enhance patient satisfaction.

[0003] The current mainstream solution is to directly input historical conversations into a large model, and use the reasoning and generation capabilities of the large model to generate the responses that doctors may need. However, this type of solution has the following problems: the reasoning response of the large model is long; the large model needs to support high online concurrency, and the machine cost required for reasoning is very high; the large model does not have sufficient agility, and it is difficult to achieve functions such as doctor personalization and department personalization; the large model has certain "hallucination" problems, and it is easy to generate logical or factual errors, but grammatically correct responses, resulting in misdiagnosis. Summary of the invention

[0004] The purpose of the embodiments of the present application is to propose a method, device, computer equipment and storage medium for recommending consultation reply scripts, so as to solve the technical problems of long response time, high cost, poor consultation reply text quality and low accuracy in the related art of artificial intelligence consultation.

[0005] In order to solve the above technical problems, the present application embodiment provides a method for recommending a reply script for a medical consultation, which adopts the following technical solution:

[0006] Receiving a medical inquiry text, and inputting the medical inquiry text into a trained reply speech recommendation model, wherein the reply speech recommendation model includes an embedding layer, an entity extraction layer, a first encoding sub-model, a second encoding sub-model, and an output layer;

[0007] Performing vector encoding on the medical consultation text through the embedding layer to obtain a text embedding vector, and inputting the text embedding vector into the entity extraction layer;

[0008] Perform entity extraction on the text embedding vector through the entity extraction layer to obtain entity relationship triples, and input the entity relationship triples and the medical consultation text into the first encoding sub-model;

[0009] Performing context understanding on the entity relationship triples and the medical consultation text through the first encoding sub-model to obtain a text-enhanced word vector containing context information, and inputting the text-enhanced word vector into the output layer;

[0010] Querying a pre-built discourse corpus according to the entity relationship triples to obtain candidate reply texts, and inputting the candidate reply texts into the second encoding sub-model;

[0011] Extracting semantic features from the candidate reply text by using the second encoding sub-model to obtain a text semantic vector, and inputting the text semantic vector into the output layer;

[0012] The text enhancement word vector and the text semantic vector are calculated through the output layer to obtain a response speech recommendation.

[0013] In order to solve the above technical problems, the embodiment of the present application further provides a device for recommending medical consultation replying words, which adopts the following technical solution:

[0014] An acquisition module is used to receive a medical inquiry text and input the medical inquiry text into a trained reply speech recommendation model, wherein the reply speech recommendation model includes an embedding layer, an entity extraction layer, a first encoding sub-model, a second encoding sub-model and an output layer;

[0015] An embedding module, used for performing vector encoding on the medical consultation text through the embedding layer to obtain a text embedding vector, and inputting the text embedding vector into the entity extraction layer;

[0016] An entity extraction module, configured to perform entity extraction on the text embedding vector through the entity extraction layer to obtain entity relationship triples, and input the entity relationship triples and the medical consultation text into the first encoding sub-model;

[0017] A first encoding module, configured to perform context understanding on the entity relationship triples and the medical consultation text through the first encoding sub-model, obtain a text enhanced word vector containing context information, and input the text enhanced word vector into the output layer;

[0018] A query module, configured to query a pre-built discourse corpus according to the entity relationship triples to obtain candidate reply texts, and input the candidate reply texts into the second encoding sub-model;

[0019] A second encoding module, configured to extract semantic features from the candidate reply text through the second encoding sub-model to obtain a text semantic vector, and input the text semantic vector into the output layer;

[0020] The output module is used to calculate the text enhancement word vector and the text semantic vector through the output layer to obtain reply speech recommendations.

[0021] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:

[0022] The computer device includes a memory and a processor, wherein the memory stores computer-readable instructions, and when the processor executes the computer-readable instructions, the steps of the method for recommending consultation response speech as described above are implemented.

[0023] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:

[0024] The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps of the method for recommending consultation response speech as described above are implemented.

[0025] Compared with the prior art, the embodiments of the present application have the following beneficial effects:

[0026] The present application provides a method for recommending reply words for medical consultation. Reply words recommendations are generated by a trained reply word recommendation model, which can shorten the reasoning response time and improve the response efficiency. Entity extraction is performed through the entity extraction layer, which can enhance the model's semantic understanding and intention understanding of the medical consultation text. The first encoding sub-model performs contextual understanding on entity relationship triples and medical consultation text to obtain text enhanced word vectors containing contextual information, further enhancing the model's semantic understanding of the text. The second encoding sub-model processes the obtained candidate reply text, which can combine the obtained reply word recommendations with the current medical consultation text and related medical entity expressions, thereby obtaining more accurate and effective replies containing professional terms, thereby improving the efficiency and accuracy of intelligent medical consultation. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. 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.

[0028] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;

[0029] Figure 2 It is a flowchart of an embodiment of a method for recommending a reply to a medical consultation according to the present application;

[0030] Figure 3 It is a structural schematic diagram of an embodiment of a device for recommending medical consultation replying words according to the present application;

[0031] Figure 4 It is a structural diagram of an embodiment of a computer device according to the present application. DETAILED DESCRIPTION

[0032] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.

[0033] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0034] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.

[0035] like Figure 1 As shown, the system architecture 100 may include a terminal device 101, a network 102 and a server 103. The terminal device 101 may be a laptop 1011, a tablet computer 1012 or a mobile phone 1013. The network 102 is used to provide a medium for a communication link between the terminal device 101 and the server 103. The network 102 may include various connection types, such as wired, wireless communication links or optical fiber cables.

[0036] The user can use the terminal device 101 to interact with the server 103 through the network 102 to receive or send messages, etc. Various communication client applications can be installed on the terminal device 101, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0037] The terminal device 101 can be any electronic device with a display screen and supporting web browsing. In addition to a laptop computer 1011, a tablet computer 1012 or a mobile phone 1013, the terminal device 101 can also be an e-book reader, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 (Moving Picture Experts Group Audio Layer IV), a laptop computer, a desktop computer, etc.

[0038] The server 103 may be a server that provides various services, such as a background server that provides support for a web page displayed on the terminal device 101 .

[0039] It should be noted that the method for recommending medical consultation reply words provided in the embodiment of the present application is generally executed by a server / terminal device, and accordingly, the device for recommending medical consultation reply words is generally arranged in a server / terminal device.

[0040] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0041] Continue to refer Figure 2 , shows a flow chart of an embodiment of a method for recommending a reply to a medical consultation according to the present application, comprising the following steps:

[0042] Step S201, receiving a medical inquiry text, and inputting the medical inquiry text into a trained reply speech recommendation model, wherein the reply speech recommendation model includes an embedding layer, an entity extraction layer, a first encoding sub-model, a second encoding sub-model and an output layer.

[0043] Among them, the consultation text is the conversation content of the patient during the medical diagnosis process, which may include the patient's basic information, reason for consultation, symptoms, medical history, etc.

[0044] In this embodiment, the electronic device (eg Figure 1 The server / terminal device shown in the figure can receive the medical consultation text through a wired connection or a wireless connection. It should be noted that the above wireless connection method may include but is not limited to 3G / 4G / 5G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other wireless connection methods currently known or to be developed in the future.

[0045] In this embodiment, a medical inquiry text input by a user is received and input into a trained reply speech recommendation model. The reply speech recommendation model includes an embedding layer, an entity extraction layer, a first encoding sub-model, a second encoding sub-model and an output layer. After the medical inquiry text is processed by the embedding layer, the entity extraction layer, the first encoding sub-model, the second encoding sub-model and the output layer, a reply speech recommendation matching the medical inquiry text is output.

[0046] In some optional implementations, before the medical inquiry text is input into the reply script recommendation model, the medical inquiry text is cleaned to remove irrelevant characters in the medical inquiry text, such as special punctuation marks, blank characters, line breaks, spaces, etc.

[0047] Step S202, vector encoding is performed on the medical consultation text through the embedding layer to obtain a text embedding vector, and the text embedding vector is input into the entity extraction layer.

[0048] In this embodiment, the embedding layer is used to convert the consultation text into a vector, including position embedding, word embedding and character embedding of the consultation text, wherein position embedding provides information about the position of a word in a sentence, which helps to understand the grammatical structure and contextual relationship of a sentence; word embedding captures the semantic information of a word, enabling the model to understand the meaning of the word in context; character embedding captures character-level information, which helps the model process unknown words or spelling variants, and by incorporating character-level information into the model, the model's ability to process complex data is improved.

[0049] In this embodiment, the text embedding vector includes a position embedding vector, a word embedding vector and a character embedding vector.

[0050] Step S203, performing entity extraction on the text embedding vector through the entity extraction layer to obtain entity relationship triples, and inputting the entity relationship triples and the medical consultation text into the first encoding sub-model.

[0051] In the medical field, entities refer to specific pieces of information in text that have clear meanings, such as disease names, symptoms, drug names, dosages, medical procedures, body parts, etc. These entities are crucial for understanding and processing medical consultation texts, and also play an important role in identifying the intent of medical consultation texts.

[0052] In this embodiment, the entity extraction layer uses the CasRel algorithm to identify and extract causal relationships in the medical consultation text, including causal relationships between entities such as symptoms, diseases, treatments, and drugs. For example, the relationship between the use of a certain drug and specific side effects, or the relationship between a certain lifestyle and the occurrence of a disease.

[0053] The entity extraction layer includes a head entity recognition sublayer and a relation and tail entity joint recognition sublayer.

[0054] In some optional implementations of this embodiment, the step of extracting entities from the text embedding vector through the entity extraction layer to obtain entity relationship triples includes:

[0055] Input the text embedding vector into the head entity recognition sublayer for recognition, and output all head entities;

[0056] The head entity input relations and tail entity joint recognition sublayer are recognized to obtain all specific relations and tail entities corresponding to each head entity;

[0057] Combine the head entity, specific relation and tail entity to obtain entity-relation triples.

[0058] In this embodiment, the text embedding vector h is n Decode and then get the entity's start position (starting position) and end position (ending position) to identify all possible head entities. The head entity recognition layer uses the following calculation formula:

[0059]

[0060] in, and Respectively represent the input sequence h n The probability of the start position and end position of the i-th entity in the text. If the probability exceeds the preset threshold, the label value of the multi-level text feature is recorded as 1, otherwise it is 0; σ is the sigmoid activation function, ω start With ω end is the trainable weight, b start With b end represents the bias value; and x i =h n [i] represents the encoding of the i-th token in the input sequence. When there are multiple head entity recognitions in the text, the matching principle of the closest start and end position tokens is adopted to determine the scope of the entity, and this matching method ensures the integrity of the entity.

[0061] The closest matching principle is: get all and The nearest neighbor The start and The end of 1 is regarded as a complete head entity. This matching method ensures the integrity of the entity and improves the accuracy of head entity recognition.

[0062] After identifying the head entity, the joint identification of the relation and tail entity is performed. The structure of each layer of the joint identification of the relation and tail entity is the same as that of the head entity identification layer. The decoding of the obj entity (tail entity) is similar to the decoding of the sub entity (head entity). The difference between the joint identification sublayer of the relation and tail entity and the head entity identification sublayer is that the text embedding vector containing contextual semantic information is added to the input, and the feature information of the head entity extracted by the head entity identification sublayer is also considered. The relationship modeling is a function that maps the head entity to the tail entity.

[0063] The head entity and text embedding vectors are input into the relation and tail entity joint recognition sublayer for recognition, and all specific relations and tail entities of each head entity are obtained.

[0064] In this embodiment, the relationship and tail entity joint identification sublayer is calculated using the following formula:

[0065]

[0066] in, and Respectively represent the input sequence h n The probability of the i-th entity being recognized as the start position and the end position of the tail entity. If the probability exceeds the preset threshold, the tag value of the entity is recorded as 1, otherwise it is 0; r represents a specific relationship; Represents the mean vector between the start and end positions of the k-th entity.

[0067] It should be noted that when start_o and end_o are both judged as 0 after binary division, it means that there is no corresponding obj entity under this specific relationship, that is, when sub is the head entity, there is no triple of this relationship.

[0068] After the head entity and its corresponding specific relation and tail entity are identified, the generated entity-relationship triples are combined and expressed as (head entity, specific relation, tail entity).

[0069] Through entity extraction, we can more accurately understand the intention of the medical consultation and provide important contextual information, which helps to deeply understand the semantic content of the text and improve the accuracy of subsequent reply texts.

[0070] Step S204, contextual understanding is performed on the entity relationship triples and the medical consultation text through the first encoding sub-model to obtain a text enhanced word vector containing context information, and the text enhanced word vector is input into the output layer.

[0071] The first encoding sub-model uses RoBERTa as the skeleton network. In this embodiment, the first encoding sub-model includes a first vector embedding layer and a plurality of encoders connected in a stacked manner.

[0072] The step of performing context understanding on the entity relationship triples and the medical consultation text by the first encoding sub-model to obtain a text enhanced word vector containing context information includes:

[0073] Vector encoding is performed on the entity relationship triples and the medical inquiry text through the first vector embedding layer to obtain entity text vectors, and the entity text vectors are input into multiple encoders;

[0074] Perform attention calculation on the entity text vector through the first multi-head attention layer to obtain the text attention distribution feature containing context information, and input the text attention distribution feature into the first feedforward neural network layer;

[0075] The text attention distribution features and entity text vectors are enhanced and calculated through the first feedforward neural network layer to obtain the text enhanced word vector.

[0076] The number of encoders may be set according to actual conditions. For example, a 12-layer stacked encoder may be used.

[0077] The first vector embedding layer is the BERT embedding layer, which performs position embedding, word embedding, and character embedding on the entity relationship triples and the medical consultation text respectively to obtain an embedding vector, namely the entity text vector.

[0078] The entity text vector is input into multiple stacked encoders for feature extraction. The input of the first encoder is the entity text vector, and the input of subsequent encoders is the entity text vector and the output of the previous encoder.

[0079] In this embodiment, multiple encoders can be divided into feature extraction layers of different scales to perform feature extraction of different scales. Each encoder includes a first multi-head attention layer and a first feedforward neural network layer. Each first multi-head attention layer can implement the same-scale attention mechanism or a multi-scale attention mechanism. Each head can focus on contextual information of different scales. For example, if the multi-head attention sublayer has 8 heads, that is, 8 self-attentions, 4 heads focus on small scales, 2 heads focus on medium scales, and 2 heads focus on large scales. The self-attention of texts of different scales is calculated by different heads, and then the self-attention is merged to obtain the text attention distribution feature.

[0080] Specifically, the process of multi-scale attention calculation in each first multi-head attention layer is as follows:

[0081]

[0082] Among them, Q i =H i-1 W q ; K i =Hi-1 W k ; V i =H i-1 W v ;Q i represents the query vector of the i-th head, K i represents the key vector of the i-th head, V i H represents the value vector of the i-th head; i represents the mask-self-attention output of the i-th head; d k Indicates the dimension of the key vector.

[0083] Merging the self-attention, the calculation formula for multi-head attention is as follows:

[0084] MultiHead=Concat(head1,head2,…,head A )W0;

[0085] Among them, Concat represents the matrix concatenation function; W0 represents the parameter matrix when compressing each self-attention.

[0086] The text attention distribution features and the entity text vector are input into the first feedforward neural network layer, and the text attention distribution features and the entity text vector are connected and enhanced through the first feedforward neural network layer to prevent insufficient fitting.

[0087] In some optional implementations, residual connections and layer normalization are performed after each first multi-head attention layer and the first feedforward neural network layer, which can help gradient flow and reduce degradation problems during training.

[0088] By implementing multi-head attention through the first encoding sub-model and transferring this attention information between encoders, it is possible to capture deep features in text sentences, enrich the representation capability of features, improve the generalization ability of the model, and enable the model to understand the input text more comprehensively, thereby enhancing the model's ability to understand and process complex data structures.

[0089] Step S205 , query the pre-built discourse corpus according to the entity relationship triples to obtain candidate reply texts, and input the candidate reply texts into the second encoding sub-model.

[0090] The speech corpus includes common speech summarized by business personnel, high-frequency speech in the text input by doctors, and common quick reply speech set by doctors, which are used to more effectively obtain information, provide consultation, or persuade patients to take certain treatment measures in doctor-patient communication. The speech prediction library can include medical question and answer data, doctor-patient question and answer dialogue data, medical knowledge graphs, etc., such as opening remarks, question-asking methods, responses to patients' concerns, emphasizing the harm of the disease, introducing the advantages of treatment plans, appointment tips, and other dialogue examples in various scenarios.

[0091] In this embodiment, the discourse corpus can be constructed by the following steps:

[0092] 1) Data collection: Obtain the original data of medical consultations, including historical consultation dialogue information and the role information corresponding to each sentence.

[0093] 2) Data preprocessing: Clean and format the collected data, including word segmentation, to adapt to subsequent processing procedures.

[0094] 3) Feature extraction: Analyze medical consultation data, extract key features such as word frequency, co-occurrence probability, etc., and construct a word-symptom association index, which helps to characterize the characteristics of disease categories.

[0095] 4) Classification and labeling: Use deep learning algorithms, such as the BERT neural network model, to classify medical consultation data and label disease types.

[0096] 5) Construct association matrix: Construct the disease weight co-occurrence matrix and disease type association co-occurrence matrix, which helps to classify text data more finely.

[0097] 6) Calculate the correction index: Calculate the corrected sentence-syndrome relevance index sequence based on the sentence-syndrome relevance index and the bigram correction index to improve the accuracy of classification.

[0098] 7) Corpus construction: Use a suitable data format (such as JSON) to store annotated consultation data, and build a discourse corpus by combining common and personalized discourse.

[0099] 8) Continuous updating: Regularly update the corpus, add new case data, and continuously optimize the speech prediction library based on feedback and evaluation results.

[0100] According to the entity relationship triples, the conversation corpus is searched to obtain candidate reply texts, which are used to combine with the consultation text to generate more accurate reply texts that are more suitable for the consultation scenario.

[0101] Step S206, extracting semantic features from the candidate reply text through the second encoding sub-model to obtain a text semantic vector, and inputting the text semantic vector into the output layer.

[0102] In this embodiment, the second encoding sub-model is used to extract features from the candidate reply text, capture the contextual information of the words in the context, and obtain the text semantic vector containing semantic information.

[0103] In some optional implementations, the second encoding sub-model uses the SimCSE model of contrastive learning as its skeleton, and the second encoding sub-model includes a second vector embedding layer and multiple encoder layers, each encoder layer includes a second multi-head attention layer and a second feedforward neural network layer.

[0104] The step of extracting semantic features from the candidate reply text by the second encoding sub-model to obtain a text semantic vector includes:

[0105] Encode the candidate reply text through the second vector embedding layer to obtain a text sentence vector, and input the text sentence vector into multiple encoder layers;

[0106] The second multi-head attention layer performs contextual understanding on the text sentence vector to obtain the text attention representation, and the text attention representation and the text sentence vector are input into the second feedforward neural network layer;

[0107] The text attention representation and text sentence vector are calculated through the second feedforward neural network layer to obtain the text semantic vector.

[0108] The number of encoder layers may be set according to actual conditions. For example, an encoder layer consisting of 12 stacked layers may be used.

[0109] The second vector embedding layer is used to perform position embedding, word embedding, and character embedding on the candidate reply text to obtain the text sentence vector.

[0110] The text sentence vector is input into multiple stacked encoder layers for attention calculation, where the input of the first encoder layer is the text sentence vector, and the input of the subsequent encoder layer is the text sentence vector and the output of the previous encoder layer.

[0111] In this embodiment, the calculation process of the second multi-head attention layer is the same as the calculation process of the first multi-head attention layer, which will not be repeated here.

[0112] The text attention representation and the text sentence vector are input into the second feed-forward neural network layer, and the text attention representation and the text sentence vector are connected and enhanced through the second feed-forward neural network layer to prevent insufficient fitting.

[0113] In some optional implementations, residual connections and layer normalization are performed after each second multi-head attention layer and second feedforward neural network layer, which can help gradient flow and reduce degradation problems in training.

[0114] By extracting features from candidate reply texts through the second encoding sub-model, it is possible to capture the contextual information of the text in the context, enrich the representation capability of the features, improve the quality of text vector representation, effectively shorten the distance between similar sentences, and at the same time increase the distance between dissimilar sentences, so as to more accurately match relevant semantic information and improve retrieval accuracy.

[0115] Step S207, calculating the text enhancement word vector and the text semantic vector through the output layer to obtain the response speech recommendation.

[0116] Specifically, the cosine similarity between the text enhancement word vector and the text semantic vector is calculated through the output layer; based on the cosine similarity, a preset number of candidate reply texts are screened out and output as reply speech recommendations.

[0117] Calculate the cosine similarity between the text enhancement word vector and the text semantic vector, sort them from high to low according to the cosine similarity, and recommend the candidate reply texts corresponding to the top N text semantic vectors as reply words, where N is a positive integer.

[0118] In this embodiment, combining the dialogue information with the reply text can improve the matching of the reply script recommendation with the consultation text, and at the same time, improve the professionalism and accuracy of the reply script recommendation.

[0119] It should be emphasized that in order to further ensure the privacy and security of the reply script recommendations, the above reply script recommendations can also be stored in a blockchain node.

[0120] The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.

[0121] In some optional implementations, the output layer may also include a fully connected layer and a softmax layer, which extracts high-level features from the text enhancement word vector and the text semantic vector through the fully connected layer, and converts these features into a potential representation of the reply text space, which is converted into a probability distribution through the softmax layer, so that each possible reply text has a probability score. Combining the cosine similarity and the probability score, the reply script recommendation is obtained.

[0122] The present application generates reply script recommendations through a trained reply script recommendation model, which can shorten the reasoning response time and improve the response efficiency; entity extraction is performed through the entity extraction layer, which can enhance the model's semantic understanding and intent understanding of the consultation text; the first encoding sub-model performs contextual understanding of entity relationship triples and consultation texts to obtain text-enhanced word vectors containing contextual information, further enhancing the model's semantic understanding of the text; the second encoding sub-model processes the obtained candidate reply texts, which can combine the obtained reply script recommendations with the current consultation text and related medical entity expressions, thereby obtaining more accurate and effective replies that contain professional terms, thereby improving the efficiency and accuracy of intelligent consultation.

[0123] In some optional implementations, before the step of inputting the medical inquiry text into the trained response speech recommendation model, the method further includes:

[0124] Obtain a medical consultation dialogue dataset, which includes medical consultation text samples and corresponding reply speech samples;

[0125] Inputting the medical consultation text sample into a pre-built neural network model, the pre-built neural network model includes an initial embedding layer, an initial entity extraction layer, an initial first encoding sub-model, an initial second encoding sub-model and an initial output layer;

[0126] Vector encoding is performed on the medical consultation text sample through the initial embedding layer to obtain the sample embedding vector;

[0127] Perform entity extraction on the sample embedding vector through the entity extraction layer to obtain a sample entity triple, and input the sample entity triple and the medical consultation text sample into the initial first encoding sub-model;

[0128] The initial first encoding sub-model is used to understand the context of the sample entity triples and the medical consultation text samples, and obtain the sample enhanced word vector containing context information;

[0129] Inputting the reply speech sample into the initial second encoding sub-model, encoding the reply speech sample through the initial second encoding sub-model to obtain a sample semantic vector;

[0130] The sample enhanced word vector and sample semantic vector are calculated through the output layer, and the predicted reply words are output;

[0131] Calculate the loss value between the predicted reply words and the reply words sample according to the preset loss function;

[0132] The model parameters of the neural network model are adjusted based on the loss value. When the iteration end condition is met, the final model parameters are obtained, and a reply script recommendation model is generated based on the final model parameters.

[0133] The medical consultation dialogue dataset can be obtained in the following ways:

[0134] 1) Chinese Medical Question and Answer Dataset: Contains question and answer pairs of different medical departments, such as andrology, internal medicine, obstetrics and gynecology, oncology, pediatrics, and surgery, with a total of 792,099 data in the form of CSV files.

[0135] 2) MedDialog (Chinese) doctor-patient dialogue dataset: contains 1.1 million dialogues between doctors and patients and 4 million utterances.

[0136] 3) Medical Conversation Analysis Dataset: This dataset collects real online doctor-patient conversations and performs multi-level manual annotation, including named entities, conversation intent, symptom labels, medical reports and other information.

[0137] The consultation dialogue dataset is input into the pre-built neural network model for training to obtain the predicted reply words, and the loss value between the predicted reply words and the reply words sample is calculated, wherein the preset loss function may adopt the cross entropy loss function, the sequence generation loss function, etc. The model parameters are adjusted according to the loss value, and the iterative training is continued until the model converges. The convergence condition can be that the loss value does not change significantly, or the number of iterations reaches the preset number, and a trained reply words recommendation model is obtained.

[0138] In this embodiment, the reply speech recommendation model has two branches, one branch is the first coding sub-model, and the other branch is the second coding sub-model. The first coding sub-model is used to characterize the conversation information, and the second coding sub-model is used to characterize the reply speech. Combining the two can improve the efficiency and accuracy of reply speech generation.

[0139] In this embodiment, the use of historical medical consultation dialogue data sets can easily construct training samples, reducing the cost and risk of training sample processing. The reply words are highly dependent on the collected historical data, and have stronger controllability and emergency repair capabilities. Moreover, because the reply words are derived from actual conversations, they are more in line with the doctor-patient conversation scenario, effectively reducing the risk of "hallucinations" and improving the quality and accuracy of the reply words.

[0140] In some optional implementations, in order to achieve doctor personalization, doctor-related features for personalized characterization of doctors can be added during the model training process, so that the doctor's reply script recommendations generated by the system are highly consistent with the doctor's personal habits and actual scenarios, thereby improving the doctor's usage experience and the doctor's adoption rate.

[0141] In some optional implementations of this embodiment, before the step of inputting the reply speech sample into the initial second encoding sub-model, the method further includes:

[0142] Construct positive and negative samples of the reply speech samples, and input the positive and negative samples into the second encoding sub-model.

[0143] The second encoding sub-model uses the SimCSE model. SimCSE is a simple and efficient contrastive learning algorithm. For an input data received, it will predict the input data itself in the contrast target. Its core idea is that Dropout is used as noise. Dropout will randomly open or close a parameter in the network structure, which will cause a vector to find local changes. By contrasting the vectors before and after the change, a large number of vectors that are similar but different from the original vector are generated.

[0144] During the training process, the SimCSE model randomly selects two sentences, and uses dropout to obtain an enhanced version of one of the sentences, and then inputs the enhanced version and the original sentence into the model as positive sample pairs for training. At the same time, the model also inputs the other enhanced version and the original sentence into the model as negative sample pairs for training.

[0145] Specifically, the reply speech sample is encoded through the BERT model, and a dropout operation is performed during the encoding process to obtain a dropout mask sample, and the dropout mask sample and the reply speech sample are used as a pair of positive samples. It should be understood that each dropout will randomly generate a different dropout mask, so although the two samples have the same content, the representation vectors obtained after encoding will be different.

[0146] In a batch, except for the positive sample pair of the current reply speech sample, all other samples in the batch are considered negative samples. This is because in a randomly sampled batch, different samples are usually unrelated, or at least not closely related semantically. Therefore, they can be used as negative samples for contrastive learning to help the model learn the ability to distinguish different text representations. Among them, batch refers to a collection of text samples that are simultaneously input to the model during training.

[0147] In this way, the SimCSE model can effectively learn how to distinguish different sentences and make similar sentences closer in the embedding space and dissimilar sentences farther away in the embedding space.

[0148] This application constructs positive and negative samples so that the model can capture complex features and patterns in text data, improve feature expression capabilities, and better generalize to unseen text data, thereby improving complex semantic understanding of the text.

[0149] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0150] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0151] Those 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 computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0152] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0153] Further references Figure 3 , as a response to the above Figure 2 The present application provides an embodiment of a device for recommending a reply to a medical consultation. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0154] like Figure 3As shown, the device 300 for recommending medical consultation replying words in this embodiment includes: an acquisition module 301, an embedding module 302, an entity extraction module 303, a first encoding module 304, a query module 305, a second encoding module 306 and an output module 307. Among them:

[0155] The acquisition module 301 is used to receive the medical inquiry text, and input the medical inquiry text into the trained reply speech recommendation model, wherein the reply speech recommendation model includes an embedding layer, an entity extraction layer, a first encoding sub-model, a second encoding sub-model and an output layer;

[0156] The embedding module 302 is used to perform vector encoding on the medical consultation text through the embedding layer to obtain a text embedding vector, and input the text embedding vector into the entity extraction layer;

[0157] The entity extraction module 303 is used to perform entity extraction on the text embedding vector through the entity extraction layer to obtain entity relationship triples, and input the entity relationship triples and the medical consultation text into the first encoding sub-model;

[0158] The first encoding module 304 is used to perform context understanding on the entity relationship triples and the medical consultation text through the first encoding sub-model, obtain a text enhanced word vector containing context information, and input the text enhanced word vector into the output layer;

[0159] The query module 305 is used to query the pre-built discourse corpus according to the entity relationship triples to obtain candidate reply texts, and input the candidate reply texts into the second encoding sub-model;

[0160] The second encoding module 306 is used to extract semantic features from the candidate reply text through the second encoding sub-model to obtain a text semantic vector, and input the text semantic vector into the output layer;

[0161] The output module 307 is used to calculate the text enhancement word vector and the text semantic vector through the output layer to obtain reply speech recommendations.

[0162] It should be emphasized that in order to further ensure the privacy and security of the reply script recommendations, the above reply script recommendations can also be stored in a blockchain node.

[0163] Based on the above-mentioned medical consultation reply script recommendation device 300, reply script recommendations are generated through a trained reply script recommendation model, which can shorten the reasoning response time and improve the response efficiency; entity extraction is performed through the entity extraction layer, which can enhance the model's semantic understanding and intention understanding of the medical consultation text; the first encoding sub-model performs contextual understanding of entity relationship triples and medical consultation texts to obtain text enhanced word vectors containing contextual information, further enhancing the model's semantic understanding of the text; the second encoding sub-model processes the obtained candidate reply texts, which can combine the obtained reply script recommendations with the current medical consultation text and related medical entity expressions, thereby obtaining more accurate and effective replies containing professional terms, thereby improving the efficiency and accuracy of intelligent medical consultation.

[0164] In some optional implementations, the entity extraction layer includes a head entity recognition sublayer and a relationship and tail entity joint recognition sublayer, and the entity extraction module 303 includes:

[0165] A head entity recognition submodule, used for inputting the text embedding vector into the head entity recognition sublayer for recognition, and outputting all head entities;

[0166] A relation and tail entity recognition submodule, used for inputting the head entity and the text embedding vector into the relation and tail entity joint recognition sublayer for recognition, so as to obtain all specific relations and tail entities corresponding to each head entity;

[0167] The combination submodule is used to combine the head entity, the specific relationship and the tail entity to obtain an entity relationship triple.

[0168] Through entity extraction, we can more accurately understand the intention of the medical consultation and provide important contextual information, which helps to deeply understand the semantic content of the text and improve the accuracy of subsequent reply texts.

[0169] In some optional implementations, the first encoding sub-model includes a first vector embedding layer and a plurality of encoders connected in a stacked manner, each of the encoders includes a first multi-head attention layer and a first feedforward neural network layer, and the first encoding module 304 includes:

[0170] A first vector embedding submodule, configured to perform vector encoding on the entity relationship triples and the medical inquiry text through the first vector embedding layer to obtain entity text vectors, and input the entity text vectors into the plurality of encoders;

[0171] A first attention submodule, configured to perform attention calculation on the entity text vector through the first multi-head attention layer to obtain a text attention distribution feature containing context information, and input the text attention distribution feature into the first feedforward neural network layer;

[0172] The first feedforward neural submodule is used to perform enhanced calculation on the text attention distribution feature and the entity text vector through the first feedforward neural network layer to obtain a text enhanced word vector.

[0173] By implementing multi-head attention through the first encoding sub-model and transferring this attention information between encoders, it is possible to capture deep features in text sentences, enrich the representation capability of features, improve the generalization ability of the model, and enable the model to understand the input text more comprehensively, thereby enhancing the model's ability to understand and process complex data structures.

[0174] In some optional implementations, the second encoding sub-model includes a second vector embedding layer and a plurality of encoder layers, each of the encoder layers includes a second multi-head attention layer and a second feedforward neural network layer, and the second encoding module 306 includes:

[0175] A second vector embedding submodule, configured to encode the candidate reply text through the second vector embedding layer to obtain a text sentence vector, and input the text sentence vector into the multiple encoder layers;

[0176] A second attention submodule is used to perform context understanding on the text sentence vector through the second multi-head attention layer to obtain a text attention representation, and input the text attention representation and the text sentence vector into the second feedforward neural network layer;

[0177] The second feedforward neural submodule is used to calculate the text attention representation and the text sentence vector through the second feedforward neural network layer to obtain a text semantic vector.

[0178] By extracting features from candidate reply texts through the second encoding sub-model, it is possible to capture the contextual information of the text in the context, enrich the representation capability of the features, improve the quality of text vector representation, effectively shorten the distance between similar sentences, and at the same time increase the distance between dissimilar sentences, so as to more accurately match relevant semantic information and improve retrieval accuracy.

[0179] In some optional implementations, the output module 307 includes:

[0180] A calculation submodule, used for calculating the cosine similarity between the text enhancement word vector and the text semantic vector through the output layer;

[0181] The output submodule is used to screen out a preset number of candidate reply texts based on the cosine similarity and output them as reply speech recommendations.

[0182] By combining the conversation information with the reply text, the matching between the reply script recommendation and the consultation text can be improved, while at the same time, the professionalism and accuracy of the reply script recommendation can be improved.

[0183] In some optional implementations, the device 300 for recommending medical consultation replying techniques further includes a training module for:

[0184] Acquire a medical consultation dialogue dataset, wherein the medical consultation dialogue dataset includes medical consultation text samples and corresponding reply speech samples;

[0185] Inputting the medical consultation text sample into the pre-constructed neural network model, wherein the pre-constructed neural network model comprises an initial embedding layer, an initial entity extraction layer, an initial first encoding sub-model, an initial second encoding sub-model and an initial output layer;

[0186] Performing vector encoding on the medical consultation text sample through the initial embedding layer to obtain a sample embedding vector;

[0187] Perform entity extraction on the sample embedding vector through the entity extraction layer to obtain a sample entity triple, and input the sample entity triple and the medical consultation text sample into the initial first encoding sub-model;

[0188] Performing context understanding on the sample entity triples and the medical consultation text sample through the initial first encoding sub-model to obtain a sample enhanced word vector containing context information;

[0189] Inputting the reply speech sample into the initial second encoding sub-model, encoding the reply speech sample through the initial second encoding sub-model to obtain a sample semantic vector;

[0190] The sample enhanced word vector and the sample semantic vector are calculated through the output layer, and the predicted reply words are output;

[0191] Calculate the loss value between the predicted reply speech and the reply speech sample according to a preset loss function;

[0192] The model parameters of the neural network model are adjusted based on the loss value, and when the iteration end condition is met, the final model parameters are obtained, and a reply speech recommendation model is generated based on the final model parameters.

[0193] Using the historical medical consultation dialogue dataset, training samples can be easily constructed, reducing the cost and risk of training sample processing. The reply script is highly dependent on the collected historical data, has stronger controllability and emergency repair capabilities, and because the reply script is derived from actual conversations, it is more in line with the doctor-patient conversation scenario, effectively reducing the risk of "hallucinations" and improving the quality and accuracy of the reply script.

[0194] In some optional implementations of this embodiment, the training module further includes a sample construction submodule for constructing positive samples and negative samples of the reply speech samples, and inputting the positive samples and the negative samples into the second encoding submodel.

[0195] By constructing positive and negative samples, the model can capture the complex features and patterns in the text data, improve the feature expression ability, and better generalize to unseen text data, thereby improving the complex semantic understanding of the text.

[0196] To solve the above technical problems, the present application also provides a computer device. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.

[0197] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are interconnected and communicated through a system bus. It should be noted that the figure only shows a computer device 4 with a memory 41, a processor 42, and a network interface 43, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.

[0198] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.

[0199] The memory 41 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 41 can be an internal storage unit of the computer device 4, such as a hard disk or memory of the computer device 4. In other embodiments, the memory 41 can also be an external storage device of the computer device 4, 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 (FlashCard), etc. equipped on the computer device 4. Of course, the memory 41 can also include both the internal storage unit of the computer device 4 and its external storage device. In this embodiment, the memory 41 is generally used to store the operating system and various application software installed on the computer device 4, such as computer-readable instructions of the method for recommending the consultation reply speech. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or are to be output.

[0200] The processor 42 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip in some embodiments. The processor 42 is generally used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to run computer-readable instructions stored in the memory 41 or process data, such as computer-readable instructions for running the method for recommending the consultation reply speech.

[0201] The network interface 43 may include a wireless network interface or a wired network interface. The network interface 43 is generally used to establish a communication connection between the computer device 4 and other electronic devices.

[0202] Generating reply script recommendations through the trained reply script recommendation model can shorten the reasoning response time and improve response efficiency; extracting entities through the entity extraction layer can enhance the model's semantic understanding and intent understanding of the consultation text; using the first encoding sub-model to understand the context of entity relationship triples and consultation text, and obtain text-enhanced word vectors containing context information, further enhancing the model's understanding of text semantics; processing the obtained candidate reply texts through the second encoding sub-model can enable the obtained reply script recommendations to be combined with the current consultation text and related medical entity expressions, thereby obtaining more accurate and effective replies that contain professional terms, thereby improving the efficiency and accuracy of intelligent consultation.

[0203] The present application also provides another embodiment, namely, providing a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the above-mentioned method for recommending consultation response speech.

[0204] Generating reply script recommendations through the trained reply script recommendation model can shorten the reasoning response time and improve response efficiency; extracting entities through the entity extraction layer can enhance the model's semantic understanding and intent understanding of the consultation text; using the first encoding sub-model to understand the context of entity relationship triples and consultation text, and obtain text-enhanced word vectors containing context information, further enhancing the model's understanding of text semantics; processing the obtained candidate reply texts through the second encoding sub-model can enable the obtained reply script recommendations to be combined with the current consultation text and related medical entity expressions, thereby obtaining more accurate and effective replies that contain professional terms, thereby improving the efficiency and accuracy of intelligent consultation.

[0205] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0206] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.

Claims

1. A method for recommending reply words for medical consultation, characterized in that: The steps include: Receiving a medical inquiry text, and inputting the medical inquiry text into a trained reply speech recommendation model, wherein the reply speech recommendation model includes an embedding layer, an entity extraction layer, a first encoding sub-model, a second encoding sub-model, and an output layer; Performing vector encoding on the medical consultation text through the embedding layer to obtain a text embedding vector, and inputting the text embedding vector into the entity extraction layer; Perform entity extraction on the text embedding vector through the entity extraction layer to obtain entity relationship triples, and input the entity relationship triples and the medical consultation text into the first encoding sub-model; Performing context understanding on the entity relationship triples and the medical consultation text through the first encoding sub-model to obtain a text-enhanced word vector containing context information, and inputting the text-enhanced word vector into the output layer; Querying a pre-built discourse corpus according to the entity relationship triples to obtain candidate reply texts, and inputting the candidate reply texts into the second encoding sub-model; Extracting semantic features from the candidate reply text by using the second encoding sub-model to obtain a text semantic vector, and inputting the text semantic vector into the output layer; The text enhancement word vector and the text semantic vector are calculated through the output layer to obtain a response speech recommendation.

2. The method for recommending a reply to a medical consultation according to claim 1, characterized in that: The entity extraction layer includes a head entity recognition sublayer and a relation and tail entity joint recognition sublayer; the step of performing entity extraction on the text embedding vector through the entity extraction layer to obtain entity relation triples includes: Input the text embedding vector into the head entity recognition sublayer for recognition, and output all head entities; Inputting the head entity and the text embedding vector into the relation and tail entity joint recognition sublayer for recognition, and obtaining all specific relations and tail entities corresponding to each head entity; The head entity, the specific relationship and the tail entity are combined to obtain an entity relationship triple.

3. The method for recommending a reply to a medical consultation according to claim 1, characterized in that: The first encoding sub-model includes a first vector embedding layer and a plurality of encoders connected in a stacked manner, each of the encoders including a first multi-head attention layer and a first feedforward neural network layer; The step of performing context understanding on the entity relationship triples and the medical consultation text by using the first encoding sub-model to obtain a text enhanced word vector containing context information comprises: Performing vector encoding on the entity relationship triples and the medical inquiry text through the first vector embedding layer to obtain entity text vectors, and inputting the entity text vectors into the plurality of encoders; Performing attention calculation on the entity text vector through the first multi-head attention layer to obtain a text attention distribution feature containing context information, and inputting the text attention distribution feature into the first feedforward neural network layer; The text attention distribution feature and the entity text vector are enhanced and calculated through the first feedforward neural network layer to obtain a text enhanced word vector.

4. The method for recommending a reply to a medical consultation according to claim 1, characterized in that: The second encoding sub-model includes a second vector embedding layer and a plurality of encoder layers, each of the encoder layers includes a second multi-head attention layer and a second feed-forward neural network layer; The step of extracting semantic features from the candidate reply text by using the second encoding sub-model to obtain a text semantic vector comprises: Encoding the candidate reply text through the second vector embedding layer to obtain a text sentence vector, and inputting the text sentence vector into the multiple encoder layers; Performing context understanding on the text sentence vector through the second multi-head attention layer to obtain a text attention representation, and inputting the text attention representation and the text sentence vector into the second feedforward neural network layer; The text attention representation and the text sentence vector are calculated through the second feedforward neural network layer to obtain a text semantic vector.

5. The method for recommending a reply to a medical consultation according to claim 1, characterized in that: The step of calculating the text enhancement word vector and the text semantic vector through the output layer to obtain a reply speech recommendation includes: Calculate the cosine similarity between the text enhancement word vector and the text semantic vector through the output layer; Based on the cosine similarity, a preset number of candidate reply texts are screened out and output as reply speech recommendations.

6. The method for recommending a reply to a medical consultation according to claim 1, characterized in that: Before the step of inputting the medical inquiry text into the trained response speech recommendation model, the method further includes: Acquire a medical consultation dialogue dataset, wherein the medical consultation dialogue dataset includes medical consultation text samples and corresponding reply speech samples; Inputting the medical consultation text sample into the pre-constructed neural network model, wherein the pre-constructed neural network model comprises an initial embedding layer, an initial entity extraction layer, an initial first encoding sub-model, an initial second encoding sub-model and an initial output layer; Performing vector encoding on the medical consultation text sample through the initial embedding layer to obtain a sample embedding vector; Perform entity extraction on the sample embedding vector through the entity extraction layer to obtain a sample entity triple, and input the sample entity triple and the medical consultation text sample into the initial first encoding sub-model; Performing context understanding on the sample entity triples and the medical consultation text sample through the initial first encoding sub-model to obtain a sample enhanced word vector containing context information; Inputting the reply speech sample into the initial second encoding sub-model, encoding the reply speech sample through the initial second encoding sub-model to obtain a sample semantic vector; The sample enhanced word vector and the sample semantic vector are calculated through the output layer, and the predicted reply words are output; Calculate the loss value between the predicted reply speech and the reply speech sample according to a preset loss function; The model parameters of the neural network model are adjusted based on the loss value, and when the iteration end condition is met, the final model parameters are obtained, and a reply speech recommendation model is generated based on the final model parameters.

7. The method for recommending a reply to a medical consultation according to claim 6, characterized in that: Before the step of inputting the reply speech sample into the second encoding sub-model, the method further includes: Construct positive samples and negative samples of the reply speech samples, and input the positive samples and the negative samples into the second encoding sub-model.

8. A device for recommending replying words to a medical consultation, characterized in that: include: An acquisition module is used to receive a medical inquiry text and input the medical inquiry text into a trained reply speech recommendation model, wherein the reply speech recommendation model includes an embedding layer, an entity extraction layer, a first encoding sub-model, a second encoding sub-model and an output layer; An embedding module, used for performing vector encoding on the medical consultation text through the embedding layer to obtain a text embedding vector, and inputting the text embedding vector into the entity extraction layer; An entity extraction module, configured to perform entity extraction on the text embedding vector through the entity extraction layer to obtain entity relationship triples, and input the entity relationship triples and the medical consultation text into the first encoding sub-model; A first encoding module, configured to perform context understanding on the entity relationship triples and the medical consultation text through the first encoding sub-model, obtain a text enhanced word vector containing context information, and input the text enhanced word vector into the output layer; A query module, configured to query a pre-built discourse corpus according to the entity relationship triples to obtain candidate reply texts, and input the candidate reply texts into the second encoding sub-model; A second encoding module, configured to extract semantic features from the candidate reply text through the second encoding sub-model to obtain a text semantic vector, and input the text semantic vector into the output layer; The output module is used to calculate the text enhancement word vector and the text semantic vector through the output layer to obtain reply speech recommendations.

9. A computer device, characterized in that: It includes a memory and a processor, wherein the memory stores computer-readable instructions, and when the processor executes the computer-readable instructions, it implements the steps of the method for recommending consultation reply speech as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the method for recommending medical consultation response techniques as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Keyword extraction method, verbal skill scoring method and verbal skill recommendation method

    CN111160017A

  • Intelligent inquiry method and device based on semantic comprehension, storage medium and server

    CN111274365A

  • Medical question and answer method based on knowledge graph and related equipment

    CN115470327A

  • Data processing method and device, equipment, storage medium and computer program product

    CN116108164A

  • Entity relationship extraction method and system for Chinese medical text

    CN116775801A