Medical dialogue data generation method and device, electronic equipment and storage medium

By obtaining the target corpus and target question sets, using the document search model and large language model to calculate the similarity, and generating high-quality medical conversation data, the problem of low quality of existing medical conversation data sets is solved, and data acquisition efficiency and professionalism of answers are improved.

CN119849620APending Publication Date: 2025-04-18SHENZHEN RAISOUND TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411752963.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

The existing medical conversation data set is not of high quality, which leads to the inefficient efficiency of the model to obtain medical data, and the generated answers cannot meet the needs of users in medical consultation.

Method used

By obtaining the target corpus and the target question set, using the preset document search model and large language model, the similarity between the question information and the corpus text blocks is calculated, and high-quality medical conversation data is generated.

Benefits of technology

It improves the quality of medical conversation data sets and the efficiency of model acquisition of medical data, ensuring that the generated answers can meet users' needs in medical consultation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119849620A_ABST
    Figure CN119849620A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, in particular to a medical dialogue data generation method and device, electronic equipment and a storage medium. By obtaining a target corpus and a target question set, first similarity and second similarity between target question information and each corpus text block in the target corpus are determined; screening similar text blocks in the plurality of corpus text blocks based on the first similarity and the second similarity, and inputting the target question information and the similar text blocks corresponding to the target question information into a first large language model to obtain target reply information, and generating multiple pieces of target dialogue data based on each piece of target question information and target reply information corresponding to the target question information. The diversity and accuracy of the medical dialogue data are improved, the generation cost is reduced, the generation efficiency is improved, and the actual demand of a user is met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a method, device, electronic device and storage medium for generating medical conversation data. Background Art

[0002] At present, the Large Language Model (LLM) in general fields can generate fluent text according to instruction requirements, meet the needs of different downstream tasks, and have achieved significant performance improvements.

[0003] However, in medical consultation systems, LLM can usually be fine-tuned through high-quality medical dialogue datasets to obtain relevant knowledge in the medical field and improve the relevance and professionalism of answers. However, existing medical dialogue datasets usually come from open source data on the consultation platform and dialogue data generated by LLM. The open source data on the consultation platform usually has problems such as incomplete questions and answers and low relevance, and the dialogue data generated by LLM has the problem of low professionalism, which reduces the efficiency of the model in obtaining medical data corresponding to patients' questions, resulting in the model being unable to generate answers that meet user needs. Summary of the invention

[0004] In order to overcome the shortcomings of the prior art, the present invention provides a method, device, electronic device and storage medium for generating medical conversation data, which can reduce the generation cost, improve the generation efficiency and meet the actual needs of users through the diversity and accuracy of medical conversation data.

[0005] A first aspect of the present application provides a method for generating medical conversation data, the method comprising: Obtain a target corpus and a target question set; the target corpus contains a plurality of target corpus texts; one target corpus text contains a plurality of corpus text blocks; the target question set contains a plurality of target question information; Obtaining a preset target document retrieval model, and inputting the target question information into the target document retrieval model, so as to determine a first similarity between the target question information and each of the corpus text blocks through the target document retrieval model; Perform keyword matching on the target question information and each of the corpus text blocks to determine a second similarity between the target question information and each of the corpus text blocks; Based on the first similarity and the second similarity, determining a similar text block corresponding to the target question information from all the corpus text blocks; Inputting the target question information and a similar text block corresponding to the target question information into a preset first language model to obtain target answer information; A plurality of target dialogue data are generated based on each of the target question information and the target answer information corresponding to the target question information.

[0006] A second aspect of the present application provides a medical conversation data generating device, the device comprising: The acquisition module is used to acquire a target corpus and a target question set; the target corpus contains a plurality of target corpus texts; one target corpus text contains a plurality of corpus text blocks; the target question set contains a plurality of target question information; A first retrieval module, used for obtaining a preset target document retrieval model, and inputting the target question information into the target document retrieval model, so as to determine a first similarity between the target question information and each of the corpus text blocks through the target document retrieval model; A second retrieval module is used to perform keyword matching on the target question information and each of the corpus text blocks, and determine a second similarity between the target question information and each of the corpus text blocks; A determination module, configured to determine a similar text block corresponding to the target question information from all the corpus text blocks based on the first similarity and the second similarity; A processing module, used for inputting the target question information and the similar text block corresponding to the target question information into a preset first language model to obtain target answer information; A generating module is used to generate a plurality of target dialogue data based on each target question information and the target answer information corresponding to the target question information.

[0007] A third aspect of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the medical conversation data generating method when executing the computer program.

[0008] The fourth aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, and the computer program, when executed by a processor, implements the steps of the above-mentioned medical dialogue data generation method. In summary, the medical dialogue data generation method, device, electronic device and storage medium provided by the present application, by acquiring a target corpus and a target question set, divide the target corpus into multiple corpus text blocks, and calculate the first similarity and the second similarity between the target question information and each corpus text block, and based on the first similarity and the second similarity, it is possible to more accurately determine the similar text block that is most similar to the target question information. Subsequently, the target question information and the similar text block are input into a preset large language model to generate target answer information that is highly related to the target question information, and finally combined to form high-quality medical dialogue data, which not only improves the quality of the medical dialogue data set and the efficiency of the model in acquiring medical data, but also ensures that the generated answers can meet the user's needs in medical consultation. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] Figure 1 is a flow chart of a method for generating medical conversation data shown in an embodiment of the present application; Figure 2 It is a schematic diagram of a training process of a target document retrieval model shown in an embodiment of the present application; Figure 3 It is a functional module diagram of a medical conversation data generating device shown in an embodiment of the present application; Figure 4 It is a structural schematic diagram of an electronic device shown in an embodiment of the present application. DETAILED DESCRIPTION

[0010] The present invention is further described below in conjunction with the accompanying drawings and embodiments.

[0011] The following will clearly and completely describe the concept, specific structure and technical effects of the present invention in combination with the embodiments and drawings, so as to fully understand the purpose, characteristics and effects of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, other embodiments obtained by technicians in this field without creative work are all within the scope of protection of the present invention. In addition, all the connection / connection relationships involved in the patent do not refer to the direct connection of components, but refer to the formation of a better connection structure by adding or reducing connection accessories according to the specific implementation situation. The various technical features in the invention can be combined interchangeably without conflicting with each other.

[0012] Reference Figure 1 As shown, it is a flowchart of a method for generating medical conversation data shown in an embodiment of the present application, and the method for generating medical conversation data includes the following steps.

[0013] S11, obtaining a target corpus and a target question set.

[0014] Among them, the target corpus contains multiple target corpus texts, one target corpus text contains multiple corpus text blocks, and the target question set contains multiple target question information, which refers to the specific questions that the user needs to query at the current moment, usually expressed in the form of natural language text, which can be sentences, paragraphs or documents, etc. For example, "What should I do if my child has a fever of 37.5 degrees and it doesn't go away?", "How to treat the dull pain one inch right in the middle of the heart?", "What eye drops are used for eye inflammation?", etc. In some embodiments, the electronic device can receive the natural language text input by the user as the target question information through the user interface provided by the client (for example, a web page, an application, a chat window, etc.). At the same time, the electronic device can also use front-end technology (such as HTML forms, JavaScript event listeners, etc.) to capture the natural language text input by the user as the target question information. In addition, the target question information can also be obtained by other means, which are not specifically limited, as long as the target question set can be obtained.

[0015] When receiving the target question set input by the user, the electronic device can synchronously obtain the corresponding target corpus, so that the answer information corresponding to each target question information in the target question set can be queried from the target corpus later. Wherein, the target corpus refers to a series of text data sets related to the medical field, which may include medical literature, medical records, drug instructions, diagnosis and treatment process data. In some embodiments, when the target corpus is obtained, the electronic device can use the open source tool spacy to segment the target corpus into text blocks to obtain multiple corpus text blocks. Wherein, the corpus text block is used as the basic unit for subsequent similarity calculation, which can further improve the efficiency and accuracy of similarity calculation.

[0016] It should be noted that if the corpus text block is too small, it is easy to cause loss of contextual semantics. Therefore, the corpus text block size can be initially set to 512 tokens. The subsequent electronic device can adjust the corpus text block size according to the actual text retrieval effect and generation effect.

[0017] In some embodiments, before the target corpus is segmented into text blocks, the electronic device may also preprocess the target corpus and the target question set, including data cleaning, data segmentation, and data format conversion. When preprocessing, the electronic device first performs data cleaning on the target corpus and the target question set to clean up irrelevant or useless information, such as HTML tags, special characters, formatting symbols, etc., to ensure that the text content is clean and the structure is clear, and then performs data segmentation (i.e., text segmentation) on the target corpus and the target question set after data cleaning, including sentence segmentation, paragraph segmentation, chart and formula segmentation, etc. When performing text segmentation, the electronic device may first use natural language processing tools (e.g., SpaCy, NLTK, etc.) to segment the long documents or paragraphs in the target corpus and the target question set according to the sentence format, that is, to correctly divide the sentences based on punctuation and large language models (e.g., GPT series models, Bidirectional Encoder Representations from Transformers (BERT), Enhanced Semantic Representation through kNowledge IntEgration (ERNIE) DENG). At the same time, the electronic device can also segment the target corpus and the target question set according to the structure of the document (such as blank lines, line breaks, etc.) in paragraph format, especially when processing medical literature or instructions, the contextual coherence can be maintained. At the same time, when processing PDF files or other files in complex formats, the electronic device can also use regular expressions or APIs provided by PDF parsing tools to locate, extract and mark charts and formulas for subsequent separate processing or ignoring. Finally, the electronic device can also use specific tools (for example, PDF parsing tools) to convert files with special formats (for example, PDF, DOCX, etc.) in the target corpus and target question set after text segmentation into a processable text format (for example, TXT) to ensure that the data can be further processed later. In addition, when performing data format conversion, the electronic device can also retain useful information (for example, tables, titles, etc.) and remove useless format elements (for example, font style, color, headers and footers, borders, backgrounds, etc.).

[0018] S12, obtaining a preset target document retrieval model, and inputting the target question information into the target document retrieval model, so as to determine a first similarity between the target question information and each of the corpus text blocks through the target document retrieval model.

[0019] In some embodiments, the electronic device can also retrieve the corpus text block corresponding to the target question information in the target corpus based on vector retrieval, and output the similarity between the target question information and each corpus text block, which is called the first similarity. Specifically, the electronic device can use an existing deep learning model (such as BERT, RoBERTa, Sentence-BERT, etc.) as the initial document retrieval model, and train the initial document retrieval model based on the training sample set to obtain a target document retrieval model to convert both the target question information and the corpus text block into comparable vector representations, that is, the target document retrieval model can be used to map each text fragment of the target question information and the corpus text block into a multidimensional vector space, in which semantically similar texts are represented as vectors that are close to each other. For ease of understanding, the following is combined with Figure 2 The specific training process of the preset target document retrieval model is explained. Figure 2 A schematic diagram of the training process of a target document retrieval model shown in an embodiment of the present application.

[0020] S21, obtaining an initial sample data set.

[0021] The initial sample data set includes at least one initial sample data. The initial sample data is used to train and test the target document retrieval model, including a known question set and its corresponding corpus.

[0022] S22, preprocessing the initial sample data, and selecting a first preset ratio of the preprocessed initial sample data as training sample data.

[0023] The electronic device may preprocess the initial sample data according to the same preprocessing embodiment as the above step S11. The initial sample data includes a first preset ratio of training sample data and a second preset ratio of test sample data, and the sum of the first preset ratio and the second preset ratio is 1. When the preprocessing of the initial sample data set is completed, the electronic device may select a first preset ratio of initial sample data from the preprocessed initial sample data set as training sample data. For example, the first preset ratio may be set to 50%, and the remaining 50% of the initial sample data is used as test sample data.

[0024] S23, constructing multiple sample reference groups based on the training sample data.

[0025] Among them, one of the sample reference groups includes a positive sample pair and multiple negative sample pairs. During the training process of the target document retrieval model, the positive sample pairs and the negative sample pairs help the document retrieval model to continuously learn effective feature representations by providing semantically similar and dissimilar text pairs respectively, so that similar texts are close in the vector space, while dissimilar texts are far away in the vector space, thereby optimizing the distinguishing ability and retrieval accuracy of the document retrieval model, while enhancing the generalization ability of the document retrieval model and improving the adaptability of the document retrieval model to data in specific fields. Therefore, in some embodiments, the electronic device can splice the training sample data into a preset template to obtain the positive sample pairs corresponding to the training sample data.

[0026] In the present application example, the electronic device can obtain positive sample pairs based on templates. Specifically, the electronic device first constructs two similar but different templates, called preset templates, which are the first preset template and the second preset template. For example, the first preset template can be set to :[sentence], the meaning of this sentence is [MASK]; the second preset template can be set to :[sentence], the meaning of this sentence is [MASK]. Wherein, [sentence] is the sentence text of the target training sample, and [MASK] is a special marker. By splicing each training sample data into the first preset template and the second preset template respectively, that is, filling the training sample data into the first preset template to obtain the first sentence sample P1, and filling the training sample data into the second preset template to obtain the second sentence sample P2, the first sentence sample P1 and the second sentence sample P2 are called the positive sample sentence pair of the training sample data. Exemplarily, assuming that the target training sample is "the patient suffers from diabetes", the first sentence sample P1 is "the patient suffers from diabetes, the meaning of this sentence is [MASK], and the second sentence sample P2 is "the patient suffers from diabetes, the meaning of this sentence is [MASK]. Assuming that the target training sample is "the patient said that he is allergic to penicillin", the first sentence sample P1 is "the patient said that he is allergic to penicillin, the meaning of this sentence is [MASK], and the second sentence sample P2 is "the patient said that he is allergic to penicillin, the meaning of this sentence is [MASK].

[0027] It should be noted that the first preset template and the second preset template have the same meaning at the semantic level, that is, they can guide the document retrieval model to focus on the same semantic content. However, at the character level, the first preset template and the second preset template are different to ensure that the positive sample sentence pairs generated by splicing are different in form. The format of the first preset template and the second preset template needs to be selected according to the actual training results. and This is for illustrative purposes only and is not intended to be limiting.

[0028] At the same time, the electronic device can select other training samples in the same batch, that is, in the target document retrieval model trained based on the training sample data, the training sample data includes training sample subsets from multiple batches, and the number of training samples contained in the training sample subset is determined according to the character length of the input of the target document retrieval model, which can be set to 10, that is, each batch of training sample subsets includes 10 training samples. Exemplarily, when training is performed based on a subset of training samples in a certain batch, when a positive sample pair needs to be constructed based on training sample 1 at the current moment, training sample 1 is input into the first preset template and the second preset template respectively, and the first sentence sample P1 and the second sentence sample P2 corresponding to training sample 1 are obtained. The first sentence sample P1 and the second sentence sample P2 are called the positive sample sentence pair of training sample 1. At the same time, negative sample sentence pairs can be constructed based on the other 9 training samples, namely training sample 2, training sample 3, ..., training sample 10. Specifically, the other 9 training samples are input into the second preset template respectively, and 9 third sentence samples P3 are obtained correspondingly. The first sentence sample P1 and each third sentence sample P3 are respectively constructed into a negative sample sentence pair of training sample 1. Assuming that training sample 1 is "the patient suffers from diabetes", the first sentence sample P1 is "the patient suffers from diabetes, and the meaning of this sentence is [MASK], and the third sentence sample P3 is "the patient said he is allergic to penicillin, and the meaning of this sentence is [MASK]. Assume that training sample 1 is "The patient said he was allergic to penicillin", then the first sentence sample P1 is "The patient said he was allergic to penicillin, the meaning of this sentence is [MASK], and the third sentence sample P3 is "The patient suffers from diabetes, the meaning of this sentence is [MASK].

[0029] After constructing a positive sample sentence pair and multiple sample sentence pairs for each training sample data, the electronic device can input the positive sample sentence pairs and negative sample sentence pairs into an existing deep learning model (such as BERT, RoBERTa, Sentence-BERT, etc.), and output the corresponding vector representations respectively. For the first sample sentence and the second sample sentence in the positive sample sentence pair, the first sample sentence and the second sample sentence can be input into the initial document retrieval model to obtain the vector representation corresponding to the first sample sentence (called the first vector representation) and the vector representation corresponding to the second sample sentence (called the second vector representation), and the positive sample vector representation pair constructed by the first vector representation and the second vector representation Specifically, we first input the positive sample sentence pair into the existing deep learning model to obtain the word unit sequence, where It refers to the token sequence. nis the MASK tag. Then the existing deep learning model can convert the word into Sequences are mapped to corresponding hidden vectors , take the position corresponding to MASK n As the vector representation of the positive sample sentence pair, that is, the positive sample pair. At the same time, according to the same embodiment as above, the existing deep learning model can output the negative sample vector representation corresponding to each negative sample sentence pair, that is, the negative sample pair.

[0030] Therefore, the electronic device can use a positive sample pair and multiple negative sample pairs of the same training sample data as a sample reference group, and then multiple sample reference groups can be obtained corresponding to multiple training sample data.

[0031] The methods for constructing positive sample pairs in the existing technology usually include: 1) manual annotation, where a team of experts annotates the data to ensure semantic similarity; 2) rule-based methods, where synonymous sentences are extracted through rule or pattern matching techniques; 3) based on the existing knowledge base, relevant question-answer pairs are extracted from medical literature or question-answer databases; 4) text clustering, where texts in the same cluster are extracted as positive samples using cluster analysis; 5) data enhancement, where variants are generated through techniques such as synonym replacement and random insertion. Although the existing methods for constructing positive samples have their own advantages, manual annotation requires a lot of manpower and time, especially when dealing with large-scale data sets, the cost will increase significantly; once the rules are determined, the rule-based methods are difficult to adapt to new semantic changes or updates to domain knowledge; based on the existing knowledge base, which depends on the update speed of the knowledge base, when the update is not timely, the extracted positive samples will be outdated or inaccurate; text clustering is mainly based on the surface features of the text, and may not accurately understand the deep semantic information of the text; and data enhancement may lead to overfitting if overused. Compared with the prior art, this application generates positive sample pairs by constructing two similar but different preset templates. By using the flexibility of the template, it can easily adapt to different semantic changes and domain knowledge updates. By inputting the positive sample pairs into the initial vector model, the positive sample vector representation is obtained, providing high-quality data support for subsequent model training.

[0032] S24, based on the positive sample pairs and the negative sample pairs in the same sample reference group, training the preset initial document retrieval model to obtain the target document retrieval model.

[0033] Among them, the positive sample pair may include an anchor vector and a positive sample vector, and the negative sample pair may include an anchor vector and a negative sample vector. In the embodiment of the present application, the electronic device uses the same vector in the positive sample pair and all negative sample pairs as the anchor vector, uses another vector in the positive sample pair as the positive sample vector corresponding to the anchor vector, and uses another vector in the negative sample pair as the negative sample vector corresponding to the anchor vector. For example, assuming that the positive sample pair is , the negative sample pair is , then As the anchor vector, As a positive sample vector, as negative sample vector.

[0034] In an optional implementation, the training of a preset initial document retrieval model based on positive sample pairs and negative sample pairs in the same sample reference group to obtain the target document retrieval model includes: Determining a third similarity of the positive sample pair and a fourth similarity of each of the negative sample pairs; Determining a model loss value of the initial document retrieval model based on the third similarity and all the fourth similarities by using a preset loss function; When the model loss value is less than a preset loss threshold, the model parameters of the initial document retrieval model are iteratively updated until the model loss value is greater than or equal to the preset loss threshold, and the initial document retrieval model is determined as the target document retrieval model.

[0035] The electronic device may calculate the similarity between the anchor vector in the positive sample pair and the positive sample vector as the third similarity of the positive sample pair, and calculate the similarity between the anchor vector in the negative sample pair and the negative sample vector as the fourth similarity of the negative sample pair, and then construct a preset loss function of the target document retrieval model based on the third similarity, the fourth similarity and the cross entropy loss function. Specifically, the electronic device may calculate the third similarity and the fourth similarity using cosine similarity or dot product.

[0036] The third similarity is determined by the following formula: ; in, is the third similarity, is the anchor vector, is a positive sample vector, s is a similarity function, and scale is a scaling factor used to adjust the numerical range of similarity.

[0037] The fourth similarity is determined by the following formula: ; in, is the third similarity, is the anchor vector, is a negative sample vector.

[0038] Furthermore, the sentence expresses The batches are composed of, m is the batch size, is a positive sample pair is a negative sample pair. For each anchor vector , there is a positive sample vector and m-1 negative sample vectors In order to ensure that the similarity between it and the corresponding positive sample vector is the largest, and the similarity with the m-1 negative sample vectors is as small as possible, the electronic device can use the cross entropy loss to achieve this, where the cross entropy loss function Loss can be determined by the following formula: ; After determining the similarity between the anchor vector and the positive sample vector, and the cross entropy loss function, the electronic device can construct a target loss function L based on the two, which is determined by the following formula: .

[0039] After the loss function is constructed, the electronic device can determine the model loss value of the initial document retrieval model based on the third similarity and all fourth similarities, and compare the model loss value with the preset loss threshold. When the model loss value is less than the preset loss threshold, that is, when the loss function has not converged, the electronic device can use an optimization algorithm (such as gradient descent, Adam, etc.) to iteratively update the parameters of the model to minimize the loss function. Among them, the model training process is iteratively performed, so each iteration updates the model parameters according to the current gradient until the model loss value meets the preset loss threshold. The model parameters may include learning rate, batch size, number of training rounds, weight decay value, etc. In some embodiments, the initial learning rate can be set to 5e-5 to ensure that the model can learn data features quickly in the early stage of training, and the Adam optimizer is used to continuously adjust the learning rate during the training process to avoid overfitting. Adam is an adaptive learning rate optimization algorithm based on first-order moment estimation and second-order moment estimation. It combines the advantages of AdaGrad and RMSProp optimization algorithms and can adaptively adjust the learning rate according to different parameters, thereby achieving faster convergence and better performance during the training process. Batch size refers to the number of training samples processed simultaneously in each model training iteration. It can be set to 32 to balance the training speed and model stability when computing resources allow. The number of training rounds refers to the number of times the entire training sample data set is traversed. It can be set to 10 times, that is, the model will be fully trained 10 times, and each time it will traverse the entire training sample data set from the beginning. After each round of training, the performance of the model on the test set will be evaluated to monitor the training progress of the model and avoid overfitting. Weight decay is a regularization technique used to prevent model overfitting. Electronic devices encourage the model to learn smaller weight values ​​by adding a penalty term proportional to the size of the model weight to the loss function, thereby improving the generalization ability of the model. Therefore, the weight decay value can be set to 0.01, which indicates the penalty for the weight size. At the same time, an early stopping mechanism can also be set. The early stopping mechanism is a strategy to terminate the training early during the training process to avoid the performance degradation of the model on the validation set (i.e. overfitting). For example, if the model's loss on the test set does not decrease for 3 consecutive training epochs, the training process will be terminated early, helping to preserve the model's parameters at the best performance state.

[0040] In other embodiments, the electronic device may determine whether the number of iterations of the current iterative update reaches the number of training rounds. If so, the iterative update training is stopped and the current initial document retrieval model is determined as the target document retrieval model. In actual applications, the electronic device may also set other conditions as the iteration termination conditions, which are not specifically limited here.

[0041] S13, performing keyword matching on the target question information and each of the corpus text blocks, and determining a second similarity between the target question information and each of the corpus text blocks.

[0042] In some embodiments, the electronic device can use an information retrieval algorithm (e.g., Best Matching 25, BM25) to calculate the relevance between the target question information and each corpus text block, that is, the second similarity. Among them, BM25 calculates the relevance of each document to the query data by evaluating factors such as the frequency of occurrence of keywords in the document, document length, and inverse document frequency. That is, by considering the term frequency (TF) and inverse document frequency (IDF), as well as the normalization of the document length, a comprehensive score is generated. And each keyword that appears in a document can be given a weight. The more frequently the keyword appears, the higher the score. At the same time, long documents will be penalized to avoid overly long documents from getting too high a score.

[0043] In the embodiment of the present application, the electronic device first determines the keywords in the target question information, that is, the words that need to be queried and matched in each corpus text block, and inputs them into the BM25 algorithm for calculation to obtain the frequency and number of words corresponding to each keyword in the target question information in each corpus text block. The calculation method of BM25 is as follows:

[0044] in, For each word of the target question information in the query, for The frequency of any document D in the corpus text block, |D| is the total number of words in document D, avgdl represents the average length of all documents, , To include The number of documents for the word. and b are adjustment parameters, The value of is 1.2, the value of b is 0.75, is an additional smoothing parameter used to prevent the score from being zero when the frequency is zero, and z is the number of text blocks in the multiple corpus text blocks.

[0045] After calculating the frequency and number of each keyword in the target question information and each document in each corpus text block, the relevance of the target question information and each document can be determined, that is, the second similarity between the target question information and each expected text block can be determined.

[0046] Through the above optional implementation, text blocks in the medical field corpus that are highly relevant to the user's target question information can be effectively identified, and documents containing multiple keywords are returned preferentially, thereby ensuring the accuracy and relevance of search results and helping users quickly find the information they need.

[0047] It should be noted that step S12 and step S13 may be executed simultaneously, or step S12 may be executed first and then step S13, or step S13 may be executed first and then step S12.

[0048] S14: Determine a similar text block corresponding to the target question information from all the corpus text blocks based on the first similarity and the second similarity.

[0049] In some embodiments, the electronic device can sort all corpus text blocks from large to small based on the first similarity, and put the ones with high first similarity values ​​in front and the ones with low first similarity values ​​in the back to determine the sorting position of each corpus text block (referred to as the first sorting position). At the same time, based on the same sorting embodiment described above, all corpus text blocks can be sorted from large to small based on the second similarity to determine the sorting position of each corpus text block (referred to as the second sorting position). Then, the electronic device can use reciprocal rank fusion (RRF) to determine the similarity value of each corpus text block based on the first sorting position and the second sorting position.

[0050] For a corpus text block i , assuming the first sort position is , the second sort position is , determine the corpus text block through the following RRF calculation formula i Similarity value:

[0051] Among them, the higher the similarity value, the closer the corpus text block is. i The stronger the correlation, the more likely the corpus text block i The higher the relevance to the target question information.

[0052] Furthermore, the electronic device may select a corpus text block with a higher similarity value from multiple corpus text blocks as a similar text block. For example, the electronic device may select K corpus text blocks with a higher similarity value as similar text blocks, and the value of K is determined according to the input length of the preset first largest language model.

[0053] Through the above optional implementation, the similarity-based sorting can intuitively reflect the degree of association between the target question information and each corpus text block, making it easy to quickly find the corpus text block that best matches the target question information, improving the efficiency of data acquisition while also improving the efficiency of subsequent medical conversation data generation. Secondly, the similarity value between each corpus text block and the target question information is evaluated through RRF, and the corpus text block with the highest similarity value is selected as the similar text block, which effectively improves the accuracy and efficiency of information retrieval and optimizes the user experience.

[0054] S15, inputting the target question information and the similar text block corresponding to the target question information into a preset first language model to obtain target answer information.

[0055] In some embodiments, when determining similar text blocks, the similar text blocks may include multiple documents related to the target question information (referred to as target answer documents), and the electronic device needs to further search from the target answer document to determine the target answer content corresponding to the target question information in the target answer document. Specifically, the electronic device may splice the target question information and the target answer document, that is, splice the target question information and the target answer document into a preset template (referred to as the third preset template), and use the splicing result as a preset large language model (referred to as the first large language model, such as chatGPT4o), so that the first large language model outputs the target answer information corresponding to the target question information based on the target answer document.

[0056] Wherein, the third preset template can be set as: { You are a professional and knowledgeable clinical physician who can accurately answer various medical questions for patients based on the retrieved information.

[0057] Answer the questions based on the information retrieved below.

[0058] {content} Question: {query} } Among them, query is the target question information, and content is the target answer document.

[0059] Through the above optional implementation method, a structured input data is formed by splicing the target question information and the target answer document, which helps the first language model to more accurately understand the context and specific needs of the question, thereby improving the accuracy of information retrieval; in addition, the spliced ​​data is input into the first language model to achieve efficient and accurate information retrieval and answer generation, which significantly improves the satisfaction and efficiency of user queries.

[0060] S16, generating a plurality of target dialogue data based on each target question information and the target answer information corresponding to the target question information.

[0061] In some embodiments, when the first language model outputs the target answer information corresponding to each target question information, the electronic device can match the generated target answer information with the target question information asked by the user to form a complete target dialogue data, that is, medical dialogue data. For example, assuming that the target question information is "What eye drops should I use for eye inflammation?" and the corresponding target answer information is "Anti-infection eye drops.", the generated medical dialogue data is: { -What eye drops should I use for eye inflammation? -Anti-infectious eye drops.

[0062] } Compared with the problems faced by the medical consultation system in the prior art, such as low quality of dialogue data sets, low efficiency of model acquisition of medical data, and answers that cannot meet user needs, the present application can generate more relevant and professional dialogue data when receiving the user's target question information by accurately matching the target question information with each corpus text block in the medical field corpus. In addition, by calculating the similarity between the target question information and each corpus text block and sorting the similarity, it is possible to quickly find corpus text blocks similar to the target question information, retrieve the target answer information corresponding to the target question information from the similar corpus text blocks, and generate medical dialogue data based on the two. The generated medical dialogue data is not only highly relevant, but also integrates professional knowledge in the medical field, which can meet the user's needs for medical consultation.

[0063] In an optional embodiment, after training a preset initial document retrieval model based on positive sample pairs and negative sample pairs in the same sample reference group to obtain the target document retrieval model, the method further includes: Selecting the preprocessed initial sample data of a second preset ratio as the test sample data; the sum of the second preset ratio and the first preset ratio is 1; Obtaining a preset test prompt template, and splicing the test sample data with the preset test prompt template to obtain a test sample template; Inputting the test sample template into a preset second largest language model, so as to output a model generation result based on the test sample template through the preset second largest language model; Detecting whether the model generation result meets the preset model output condition; When the model generation result does not meet the preset model output condition, the model parameters of the target document retrieval model are updated based on the model generation result.

[0064] In some embodiments, when the target document retrieval model is obtained through training, the electronic device can verify the target document retrieval model based on the test sample data to ensure the model performance of the target document retrieval model. That is, the electronic device can select a second preset proportion of initial sample data from the initial sample data set as the test sample data, and verify the model performance of the target document retrieval model based on the test sample data, such as generalization ability, similarity calculation, and semantic understanding in the medical field. Specifically, the electronic device can pre-define the test prompt standard to build a test prompt template based on the test prompt standard, and splice the test sample data into the test prompt template so that the test sample data is described according to the test prompt template to obtain the test sample template. Among them, the test sample data uses the form of sentence pairs with similarity scores: sentence 1, sentence 2, similarity score. Among them, the requirements for the similarity score are as follows: the score range is 0-5 points, 0 points are the lowest, and 5 points are the highest. For ease of understanding, this application illustrates the test prompt standard in conjunction with the following examples: { 1) 5 points, the two sentences are completely equivalent and have the same meaning: Sentence 1: The patient suffers from diabetes. Sentence 2: The patient was diagnosed with diabetes.

[0065] 2) 4 points: The two sentences are mostly equivalent, but there are some unimportant differences in the content details: Sentence 1: In March this year, the patient started chemotherapy. Sentence 2: In early March this year, the patient started chemotherapy.

[0066] 3) 3 points: The two sentences are roughly equivalent, but some important information is different or missing: Sentence 1: The doctor recommended that the patient take 100 mg of aspirin every day. Sentence 2: The doctor recommended that the patient take aspirin every day.

[0067] 4) 2 points: The two sentences are not equivalent, but there are some similarities in the content details.

[0068] Sentence 1: The patient said he was allergic to penicillin. Sentence 2: The patient mentioned that he was allergic to certain antibiotics, including penicillin.

[0069] 5) 1 point: The two sentences are not equivalent, but have the same topic.

[0070] Sentence 1: The doctor is measuring the patient's blood pressure. Sentence 2: The nurse is drawing blood from the patient.

[0071] 6) 0 points. The two sentences are neither equivalent nor have different topics.

[0072] Sentence 1: The patient takes a walk every morning to keep healthy. Sentence 2: The hospital parking lot is crowded every morning.

[0073] } Next, the electronic device constructs a test prompt template based on the above test prompt standard. For ease of understanding, this application constructs the corresponding test prompt template in combination with the above example as follows: { #Role You are a sentence generator that can generate similar sentences based on the given similarity score.

[0074] ##Set Skills Skill 1: Generate similar sentences 1. Generate corresponding similar sentences based on the similarity scores, generate 5 results each time, and use “|” to separate the results.

[0075] 2. Make sure the generated sentences meet the similarity score requirements.

[0076] ###Set scoring criteria The score range is 0-5, with 0 being the lowest and 5 being the highest.

[0077] 5 points, the two sentences are completely equivalent and have the same meaning: Sentence 1: The patient suffers from diabetes. Sentence 2: The patient was diagnosed with diabetes.

[0078] 4 points: The two sentences are mostly equivalent, but differ in some unimportant details: Sentence 1: In March this year, the patient started chemotherapy. Sentence 2: In early March this year, the patient started chemotherapy.

[0079] 3 points: The two sentences are roughly equivalent, but some important information is different or missing: Sentence 1: The doctor recommended that the patient take 100 mg of aspirin every day. Sentence 2: The doctor recommended that the patient take aspirin every day.

[0080] 2 points: The two sentences are not equivalent, but they have some details in common.

[0081] Sentence 1: The patient said he was allergic to penicillin. Sentence 2: The patient mentioned that he was allergic to certain antibiotics, including penicillin.

[0082] 1 point: The two sentences are not equivalent, but they have the same topic.

[0083] Sentence 1: The doctor is measuring the patient's blood pressure. Sentence 2: The nurse is drawing blood from the patient.

[0084] 0 points, the two sentences have different topics.

[0085] Sentence 1: The patient takes a walk every morning to keep healthy. Sentence 2: The hospital parking lot is crowded every morning.

[0086] ##Setting limits Only similar sentences are generated without any other explanation or description.

[0087] The generated sentences must meet the given similarity score requirements.

[0088] ##Input: sentence I; ##Similarity score: N; ##Output: X.

[0089] } After the test prompt template is constructed, the electronic device can splice each test sample data into the test prompt template so that each test sample data generates 5 candidate sentences with scores of 0-5 respectively, and the output result after splicing is called the test sample template. Further, the electronic device can input the test sample template into a preset large language model (referred to as the second largest language model, such as chatgpt-4o api) to output the model generation result corresponding to each test sample data. Then, the electronic device can compare each model generation result with the preset model output condition to determine whether the model generation result meets the preset model output condition, wherein the model output condition can be set to whether the model generation result meets the standard generation result of the test sample data. Specifically, the electronic device can calculate the Pearson correlation coefficient between the model generation result and the standard generation result, wherein the Pearson correlation coefficient measures the degree of linear correlation between the model generation result and the standard generation result, and its value is between -1 and 1. The closer the value is to 1, the stronger the linear relationship between the model generation result and the standard generation result, and the better the performance of the target document retrieval model.

[0090] Specifically, the Pearson correlation coefficient is determined by the following formula:

[0091] in, r is the Pearson correlation coefficient, For the k The model generation results of the test sample data are For the k The standard generation result of the test sample data is is the mean of the model’s generated results, is the mean of the standard generation results, l is the number of samples for the test sample data.

[0092] After determining the Pearson correlation coefficient of each model generation result, the Pearson correlation coefficient can be compared with a preset similarity threshold (for example, set to 0.8). When the Pearson correlation coefficient is less than the preset similarity threshold, it is determined that the model generation result does not meet the preset model output condition. The electronic device can update the model parameters of the target document retrieval model based on the model generation result.

[0093] It should be noted that the first large language model and the second large language model may represent the same large prediction model or different large language models.

[0094] Through the above optional implementation method, by introducing test sample data and preset test prompt templates, the target document retrieval model is verified and optimized in combination with the second largest language model, which significantly improves the model performance. Specifically, the Pearson correlation coefficient is used to evaluate the linear correlation between the model generation results and the standard generation results to ensure the accuracy and reliability of the model output. When the model performance does not meet the standards, the model parameters of the target document retrieval model are updated based on the model generation results, thereby achieving continuous improvement and optimization of the model, which not only improves the accuracy and efficiency of document retrieval, but also provides a strong guarantee for the stability and reliability of the model in practical applications.

[0095] Reference Figure 3 , which is a functional module diagram of a medical conversation data generating device shown in an embodiment of the present application.

[0096] In some embodiments, the medical conversation data generating device 30 may include a plurality of functional modules composed of computer program segments. The computer programs of the various program segments of the medical conversation data generating device 30 may be stored in a memory of an electronic device and executed by at least one processor to perform (see Figure 1 Description) Functionality for medical conversation data generation.

[0097] According to the functions performed, it can be divided into multiple functional modules. The functional modules may include: an acquisition module 301, a first retrieval module 302, a second retrieval module 303, a determination module 304, a processing module 305, a generation module 306, a training module 307 and a test module 308. The module referred to in this application refers to a series of computer program segments that can be executed by at least one processor and can complete fixed functions, which are stored in a memory. In this embodiment, the functions of each module will be described in detail in subsequent embodiments.

[0098] The acquisition module 301 is used to acquire a target corpus and a target question set; the target corpus contains multiple target corpus texts; one target corpus text contains multiple corpus text blocks; the target question set contains multiple target question information.

[0099] The first retrieval module 302 is used to obtain a preset target document retrieval model and input the target question information into the target document retrieval model to determine a first similarity between the target question information and each of the corpus text blocks through the target document retrieval model.

[0100] The second search module 303 is used to perform keyword matching on the target question information and each of the corpus text blocks, and determine a second similarity between the target question information and each of the corpus text blocks.

[0101] The determination module 304 is configured to determine a similar text block corresponding to the target question information from all the corpus text blocks based on the first similarity and the second similarity.

[0102] The processing module 305 is used to input the target question information and the similar text block corresponding to the target question information into a preset first language model to obtain target answer information.

[0103] The generating module 306 is used to generate a plurality of target dialogue data based on each target question information and the target answer information corresponding to the target question information.

[0104] The determination module 304 is further specifically used to: sort all the corpus text blocks based on the first similarity to determine a first sorting position of each of the corpus text blocks; sort all the corpus text blocks based on the second similarity to determine a second sorting position of each of the corpus text blocks; determine a similarity value between the corpus text block and the target question information based on the first sorting position and the second sorting position of the same corpus text block; and determine the similar text block corresponding to the target question information from all the corpus text blocks based on the similarity value.

[0105] The training module 307 is used to: obtain an initial sample data set; the initial sample data set includes at least one initial sample data; preprocess the initial sample data and select a first preset proportion of the preprocessed initial sample data as training sample data; construct multiple sample reference groups based on the training sample data; one of the sample reference groups includes a positive sample pair and multiple negative sample pairs; based on the positive sample pairs and negative sample pairs in the same sample reference group, train a preset initial document retrieval model to obtain the target document retrieval model.

[0106] The training module 307 is further specifically used to: determine the third similarity of the positive sample pair and the fourth similarity of each of the negative sample pairs; determine the model loss value of the initial document retrieval model based on the third similarity and all the fourth similarities through a preset loss function; when the model loss value is less than a preset loss threshold, iteratively update the model parameters of the initial document retrieval model until the model loss value is greater than or equal to the preset loss threshold, and then determine the initial document retrieval model as the target document retrieval model.

[0107] The training module 307 is further specifically used to: use the same vector in the positive sample pair and all the negative sample pairs as the anchor vector, use another vector in the positive sample pair as the positive sample vector corresponding to the anchor vector, and use another vector in the negative sample pair as the negative sample vector corresponding to the anchor vector; calculate the similarity between the anchor vector and the positive sample vector to obtain the third similarity, and calculate the similarity between the anchor vector and the negative sample vector to obtain the fourth similarity.

[0108] The training module 307 is also specifically used to: construct a first preset template and a second preset template; splice the same training sample data into the first preset template to obtain a first sample sentence, and splice the same training sample data into the second preset template to obtain a second sample sentence; determine a first vector representation of the first sample sentence and a second vector representation of the second sample sentence; and construct the positive sample pair based on the first vector representation and the second vector representation.

[0109] The testing module 308 is used to: select the preprocessed initial sample data of a second preset ratio as the test sample data; the sum of the second preset ratio and the first preset ratio is 1; obtain a preset test prompt template, and splice the test sample data with the preset test prompt template to obtain a test sample template; input the test sample template into a preset second largest language model to output a model generation result based on the test sample template through the preset second largest language model; detect whether the model generation result meets the preset model output condition; when the model generation result does not meet the preset model output condition, update the model parameters of the target document retrieval model based on the model generation result.

[0110] It should be understood that the various variations and specific embodiments of the medical conversation data generating method provided in the above embodiments are also applicable to the medical conversation data generating device of the present embodiment. Through the above detailed description of the medical conversation data generating method, those skilled in the art can clearly know the implementation method of the medical conversation data generating device in the present embodiment. For the sake of brevity of the specification, it will not be described in detail here.

[0111] See also Figure 4 FIG. 1 is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. In a preferred embodiment of the present application, the electronic device 4 includes a memory 41 , at least one processor 42 and at least one communication bus 43 .

[0112] Those skilled in the art should understand that Figure 4 The structure of the electronic device 4 shown does not constitute a limitation of the embodiments of the present application, and may be either a bus structure or a star structure. The electronic device 4 may also include more or less other hardware or software than shown in the figure, or a different component arrangement.

[0113] In some embodiments, the electronic device 4 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, programmable gate arrays, digital processors, and embedded devices. The electronic device 4 may also include user equipment, which includes but is not limited to any electronic product that can interact with a user through a keyboard, mouse, remote control, touchpad, or voice control device, such as a personal computer, tablet computer, smart phone, digital camera, etc.

[0114] In the above embodiments provided in the present application, it should be understood that the disclosed methods, devices, computer-readable storage media, and electronic devices can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple components or modules can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or components or modules, which can be electrical, mechanical or other forms.

[0115] The components described as separate components may or may not be physically separated, and the components shown as components may or may not be physical modules, that is, they may be located in one place or distributed on multiple network modules. Some or all of the components may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0116] In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each component may exist physically separately, or two or more modules may be integrated into one module. The above integrated modules may be implemented in the form of hardware or in the form of software functional modules.

[0117] If the integrated module is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0118] It should be noted that, for the convenience of description, the aforementioned method embodiments are all described as a series of action combinations, but those skilled in the art should be aware that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.

[0119] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0120] The above is a specific description of the preferred implementation of the present invention, but the invention is not limited to the embodiments. Those skilled in the art can make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of this application.

Claims

1. A method for generating medical conversation data, characterized in that: The method comprises: Obtain a target corpus and a target question set; the target corpus contains a plurality of target corpus texts; one target corpus text contains a plurality of corpus text blocks; the target question set contains a plurality of target question information; Obtaining a preset target document retrieval model, and inputting the target question information into the target document retrieval model, so as to determine a first similarity between the target question information and each of the corpus text blocks through the target document retrieval model; Perform keyword matching on the target question information and each of the corpus text blocks to determine a second similarity between the target question information and each of the corpus text blocks; Based on the first similarity and the second similarity, determining a similar text block corresponding to the target question information from all the corpus text blocks; Inputting the target question information and a similar text block corresponding to the target question information into a preset first language model to obtain target answer information; A plurality of target dialogue data are generated based on each of the target question information and the target answer information corresponding to the target question information.

2. The method for generating medical conversation data according to claim 1, characterized in that: The determining, based on the first similarity and the second similarity, a similar text block corresponding to the target question information from all the corpus text blocks comprises: Sort all the corpus text blocks based on the first similarity, and determine a first sorting position of each of the corpus text blocks; Sorting all the corpus text blocks based on the second similarity to determine a second sorting position of each corpus text block; Determining a similarity value between the corpus text block and the target question information based on the first sorting position and the second sorting position of the same corpus text block; The similar text block corresponding to the target question information is determined from all the corpus text blocks based on the similarity value.

3. The method for generating medical conversation data according to claim 1, characterized in that: The method further comprises: Acquire an initial sample data set; the initial sample data set includes at least one initial sample data; Preprocessing the initial sample data, and selecting a first preset ratio of the preprocessed initial sample data as training sample data; Constructing multiple sample reference groups based on the training sample data; each of the sample reference groups includes a positive sample pair and multiple negative sample pairs; Based on the positive sample pairs and the negative sample pairs in the same sample reference group, the preset initial document retrieval model is trained to obtain the target document retrieval model.

4. The method for generating medical conversation data according to claim 3, characterized in that: The step of training a preset initial document retrieval model based on positive sample pairs and negative sample pairs in the same sample reference group to obtain the target document retrieval model includes: Determining a third similarity of the positive sample pair and a fourth similarity of each of the negative sample pairs; Determining a model loss value of the initial document retrieval model based on the third similarity and all the fourth similarities by using a preset loss function; When the model loss value is less than a preset loss threshold, the model parameters of the initial document retrieval model are iteratively updated until the model loss value is greater than or equal to the preset loss threshold, and the initial document retrieval model is determined as the target document retrieval model.

5. The method for generating medical conversation data according to claim 4, characterized in that: The determining the third similarity of the positive sample pair and the fourth similarity of each of the negative sample pairs comprises: Taking the same vector in the positive sample pair and all the negative sample pairs as an anchor vector, taking another vector in the positive sample pair as a positive sample vector corresponding to the anchor vector, and taking another vector in the negative sample pair as a negative sample vector corresponding to the anchor vector; The similarity between the anchor point vector and the positive sample vector is calculated to obtain the third similarity, and the similarity between the anchor point vector and the negative sample vector is calculated to obtain the fourth similarity.

6. The method for generating medical conversation data according to claim 3, characterized in that: The constructing positive sample pairs based on the training sample data comprises: Constructing a first preset template and a second preset template; splicing the same training sample data into the first preset template to obtain a first sample sentence, and splicing the same training sample data into the second preset template to obtain a second sample sentence; Determine a first vector representation of the first sample sentence and a second vector representation of the second sample sentence; The positive sample pair is constructed based on the first vector representation and the second vector representation.

7. The method for generating medical conversation data according to claim 3, characterized in that: After training the preset initial document retrieval model based on the positive sample pairs and the negative sample pairs in the same sample reference group to obtain the target document retrieval model, the method further includes: Selecting the preprocessed initial sample data of a second preset ratio as the test sample data; the sum of the second preset ratio and the first preset ratio is 1; Obtaining a preset test prompt template, and splicing the test sample data with the preset test prompt template to obtain a test sample template; Inputting the test sample template into a preset second largest language model, so as to output a model generation result based on the test sample template through the preset second largest language model; Detecting whether the model generation result meets the preset model output condition; When the model generation result does not meet the preset model output condition, the model parameters of the target document retrieval model are updated based on the model generation result.

8. A medical conversation data generating device, characterized in that: The device comprises: The acquisition module is used to acquire a target corpus and a target question set; the target corpus contains a plurality of target corpus texts; one target corpus text contains a plurality of corpus text blocks; the target question set contains a plurality of target question information; A first retrieval module, used for obtaining a preset target document retrieval model, and inputting the target question information into the target document retrieval model, so as to determine a first similarity between the target question information and each of the corpus text blocks through the target document retrieval model; A second retrieval module is used to perform keyword matching on the target question information and each of the corpus text blocks, and determine a second similarity between the target question information and each of the corpus text blocks; A determination module, configured to determine a similar text block corresponding to the target question information from all the corpus text blocks based on the first similarity and the second similarity; A processing module, used for inputting the target question information and the similar text block corresponding to the target question information into a preset first language model to obtain target answer information; A generating module is used to generate a plurality of target dialogue data based on each target question information and the target answer information corresponding to the target question information.

9. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the medical conversation data generating method according to 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 medical conversation data generating method according to any one of claims 1 to 7 are implemented.