Automatic question answering method and system based on medical document, terminal and storage medium
By using multi-source language model and deep neural network technology to process medical documents in the automatic question-and-answer method in the medical field, the problem of insufficient answer accuracy in the existing technology is solved, and answer generation with higher accuracy is achieved. Ensure the reliability of consultation.
Patent Information
- Application Number
- CN202411315956.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2024-12-31
AI Technical Summary
The existing automatic question-and-answer method based on GPT model cannot achieve sufficient accuracy in the medical field and cannot meet the high accuracy requirements of medical question-and-answer.
By obtaining the question text data, using multiple language models to generate candidate answers, and logical sentence segmentation, deduplication, and fusion processing are performed. The answer text data is generated by combining the pre-trained language model, and keyword extraction and word vector similarity matching are used to match. , Deep neural network coding and BM25 algorithm to verify the correlation of answers to improve the accuracy of answers.
It realizes more accurate answer generation, effectively avoids mistakes that mislead consultants, and improves the accuracy and reliability of medical Q&A.
Smart Images

Figure CN119226470A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of medical consultation, and in particular relates to an automatic question-answering method, system, terminal and storage medium based on medical documents. Background Art
[0002] The GPT model, or Generative Pre-trained Transformer, is a natural language processing model based on deep learning developed by the OpenAI team. The GPT model learns and abstracts large-scale texts through unsupervised learning, and then uses it for various specific natural language processing tasks through fine-tuning. Its core is the Transformer architecture, a neural network structure for sequence modeling. Unlike traditional recurrent neural networks (RNNs), the Transformer uses a self-attention mechanism, which allows the model to better process long sequences while achieving efficient parallel computing, thereby improving the efficiency and performance of the model.
[0003] In the field of automatic question answering, GPT models are often used to generate answer texts. However, the medical field is a field that is professional knowledge-intensive and requires high accuracy of medical knowledge. Therefore, the existing automatic question answering methods based on GPT models cannot meet the accuracy requirements of medical question answering. Summary of the invention
[0004] In view of the above-mentioned deficiencies in the prior art, the present invention provides an automatic question-answering method, system, terminal and storage medium based on medical documents to solve the above-mentioned technical problems.
[0005] In a first aspect, the present invention provides an automatic question answering method based on medical documents, comprising: Acquire question text data, and retrieve target paragraph data matching the question text data from a database, wherein the database is used to store paragraph data divided from medical documents; Use multiple language models to generate multiple candidate answers based on the target paragraph data; The candidate answers are divided into logical sentence sets, and multiple logical sentence sets are deduplicated and merged to obtain the target set; Input the target set into the pre-trained language model to obtain the answer text data.
[0006] In an optional embodiment, obtaining question text data, retrieving target paragraph data matching the question text data from a database, wherein the database is used to store paragraph data divided from medical documents, includes: Extracting a first keyword combination from the question text data using a keyword extraction technique, and converting the first keyword combination into a first word vector; The similarity between the first word vector and the word vector of the paragraph data is calculated, and the paragraph data whose similarity reaches a preset similarity threshold is output as the target paragraph data.
[0007] In an optional implementation, the candidate answers are divided into logical sentence sets, and multiple logical sentence sets are deduplicated and merged to obtain a target set, including: Split candidate answers into sentences based on punctuation marks; All characters in the sentence are converted into sentence vectors through word embedding; Encoding the sentence vector into a vector representation with context information using a deep neural network model; Convert the vector representation into a BIO annotation format to obtain a labeled logical sentence; Save all logical sentences of candidate answers as a logical sentence set of candidate answers; Clustering the logical sentences in the multiple logical sentence sets to obtain multiple logical sentence categories; De-duplicate identical logical sentences in the same logical sentence category, retain one logical sentence among multiple identical logical sentences and mark the number of repetitions for the retained logical sentence, and delete the remaining repeated logical sentences; Conduct conflict analysis on similar logical sentences. For multiple logical sentences with conflicts, count the number of repetitions, adopt the logical sentence with a higher number of repetitions and discard the logical sentence with a lower number of repetitions. The similar logical sentences that have been conflict analyzed are merged to obtain fused logical sentences, and the fused logical sentences are saved to the target set.
[0008] In an optional embodiment, the method further comprises: Use the pre-trained GPT model to complete the question text data based on the target paragraph data according to the context; Calculate the correlation between the answer text data and the completed question text data using the BM25 algorithm; If the relevance reaches a set relevance threshold, the answer text data is adopted; If the relevance does not reach the set relevance threshold, the answer text data is discarded.
[0009] In a second aspect, the present invention provides an automatic question-answering system based on medical documents, comprising: A paragraph matching module, used to obtain question text data, and retrieve target paragraph data matching the question text data from a database, wherein the database is used to store paragraph data divided from medical documents; A multi-source processing module, for generating multiple candidate answers based on target paragraph data using multiple language models; The multi-source fusion module is used to segment candidate answers into logical sentence sets, and perform deduplication and fusion processing on multiple logical sentence sets to obtain the target set; The answer generation module is used to input the target set into the pre-trained language model to obtain the answer text data.
[0010] In an optional implementation, the paragraph matching module includes: A feature extraction unit, configured to extract a first keyword combination from the question text data using a keyword extraction technique, and convert the first keyword combination into a first word vector; The feature comparison unit is used to calculate the similarity between the first word vector and the word vector of the paragraph data, and output the paragraph data whose similarity reaches a preset similarity threshold as the target paragraph data.
[0011] In an optional embodiment, the multi-source fusion module includes: An answer segmentation unit, used to segment candidate answers into sentences according to punctuation marks; The vector conversion unit is used to convert all characters in a sentence into sentence vectors through word embedding; A vector encoding unit, used to encode the sentence vector into a vector representation with context information using a deep neural network model; A label generation unit, used for converting the vector representation into a BIO label format to obtain a logical sentence with a label; A set saving unit, used for saving all logical sentences of candidate answers as a logical sentence set of candidate answers; A clustering processing unit, used for performing clustering processing on the logical sentences in the plurality of logical sentence sets to obtain a plurality of logical sentence categories; A de-duplication processing unit, used for de-duplication of identical logical sentences in the same logical sentence category, retaining one logical sentence among multiple identical logical sentences and marking the number of repetitions for the retained logical sentence, and deleting the remaining repeated logical sentences; A conflict processing unit is used to perform conflict analysis on similar logical sentences, and for multiple logical sentences with conflicts, count the number of repetitions, adopt the logical sentence with a higher number of repetitions and discard the logical sentence with a lower number of repetitions; The merging processing unit is used to merge similar logical sentences that have undergone conflict analysis to obtain fused logical sentences, and save the fused logical sentences to the target set.
[0012] In an optional embodiment, the system further includes: The question completion module is used to use the pre-trained GPT model to complete the question text data according to the context based on the target paragraph data; A correlation calculation module, used to calculate the correlation between the answer text data and the completed question text data using the BM25 algorithm; An answer adopting module, used for adopting the answer text data if the relevance reaches a set relevance threshold; The answer discarding module is used to discard the answer text data if the relevance does not reach a set relevance threshold.
[0013] In a third aspect, a terminal is provided, including: processor, memory, wherein: The memory is used to store computer programs. The processor is used to call and run the computer program from the memory, so that the terminal executes the above-mentioned terminal method.
[0014] According to a fourth aspect, a computer storage medium is provided, wherein the computer-readable storage medium stores instructions, and when the instructions are executed on a computer, the computer executes the methods described in the above aspects.
[0015] The beneficial effect of the present invention lies in that the automatic question-answering method, system, terminal and storage medium based on medical documents provided by the present invention generate multiple candidate answers by utilizing a multi-source model, and then logically comb and merge the candidate answers to obtain more accurate answer text data. At the same time, by completing the question text data and verifying the answer text data based on the completed question text data, the accuracy of the output answer is further improved, and the misleading of the consultant caused by errors in the output answer is effectively avoided.
[0016] In addition, the invention has a reliable design principle, a simple structure and a very broad application prospect. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0018] Figure 1 is a schematic flow chart of a method according to an embodiment of the present invention.
[0019] Figure 2 is a schematic block diagram of a system according to an embodiment of the present invention.
[0020] Figure 3A schematic diagram of the structure of a terminal provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0021] In order to enable those skilled in the art to better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0022] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.
[0023] The automatic question-answering method based on medical documents provided in the embodiment of the present invention is executed by a computer device, and accordingly, the automatic question-answering system based on medical documents runs in the computer device.
[0024] Figure 1 is a schematic flow chart of a method according to an embodiment of the present invention. Figure 1 The execution subject may be an automatic question-answering system based on medical documents. According to different requirements, the order of the steps in the flow chart may be changed, and some may be omitted.
[0025] like Figure 1 As shown, the method includes: Step 110, obtaining question text data, and retrieving target paragraph data matching the question text data from a database, wherein the database is used to store paragraph data divided from medical documents; Step 120, using multiple language models to generate multiple candidate answers based on the target paragraph data; Step 130, dividing the candidate answers into logical sentence sets, and performing deduplication and fusion processing on multiple logical sentence sets to obtain a target set; Step 140, input the target set into the pre-trained language model to obtain answer text data.
[0026] To facilitate understanding of the present invention, the following further describes the automatic question-answering method based on medical documents provided by the present invention based on the principle of the automatic question-answering method based on medical documents of the present invention and the process of generating answer text data based on medical documents in the embodiment.
[0027] Specifically, the automatic question answering method based on medical documents includes: S1. Obtain problem text data, and retrieve target paragraph data that matches the problem text data from a database, where the database is used to store paragraph data divided from medical documents.
[0028] Use keyword extraction technology to extract a first keyword combination from the problem text data, and convert the first keyword combination into a first word vector; calculate the similarity between the first word vector and the word vectors of the paragraph data, and output the paragraph data whose similarity reaches a preset similarity threshold as the target paragraph data.
[0029] Specifically, it includes the following steps: Word segmentation processing: First, perform word segmentation processing on the problem text data, that is, split the sentence into individual words or phrases. This step is the basis of keyword extraction, and word segmentation tools such as jieba (for Chinese) and NLTK (for English) can be used.
[0030] Remove stop words: Remove those words that are meaningless for keyword extraction, such as "de" (of), "le" (particle indicating completion), "zai" (at), etc. These words appear frequently in the sentence but are not very helpful for understanding the core meaning of the sentence.
[0031] Keyword extraction algorithm: Adopt algorithms such as TF-IDF (Term Frequency - Inverse Document Frequency), TextRank, or deep learning-based models (such as variants of BERT) to extract keywords in the problem. These algorithms can evaluate the importance and uniqueness of words in the document.
[0032] Combine keywords: According to the semantic relationship or co-occurrence frequency between keywords, combine multiple keywords into meaningful phrases or word groups as the first keyword combination. This step may need to consider the semantic similarity or context relationship between words.
[0033] Word vector model: Use a pre-trained word vector model (such as Word2Vec, GloVe, FastText, or the Embedding layer of BERT) to convert each word in the first keyword combination into a high-dimensional vector.
[0034] Combine word vectors: For the keyword combination, methods such as average, weighted average, or more complex methods (such as the combination method learned through a neural network) can be used to generate the word vector of the entire keyword combination, that is, the first word vector.
[0035] Word vector representation of paragraph data: For each paragraph data, preprocessing such as word segmentation and removing stop words also needs to be performed, and the words in the paragraph are converted into word vectors. The overall word vector of the paragraph can be obtained through the average, weighted average, or more complex sentence / paragraph embedding techniques (such as the output of the [CLS] token of Doc2Vec, BERT) of all word vectors in the paragraph.
[0036] Similarity calculation: Use cosine similarity, Euclidean distance or other distance measurement methods to calculate the similarity between the first word vector and the paragraph word vector.
[0037] Similarity threshold setting: Set a similarity threshold according to actual needs. Only those paragraph data whose similarity with the first word vector exceeds the threshold will be selected.
[0038] Result output: The paragraph data whose similarity reaches or exceeds the preset threshold is output as the target paragraph data. These paragraph data are considered to have a high relevance to the original question and are helpful for further analysis or answering.
[0039] S2. Use multiple language models to generate multiple candidate answers based on the target paragraph data.
[0040] In this embodiment, the GPT-4 model and the MT-NLG model (MT-NLG, i.e., multi-task natural language generation technology, is an AI technology based on a deep learning framework) are selected as multi-source models, and the target paragraph data is input into the GPT-4 model and the MT-NLG model respectively to obtain two candidate answers.
[0041] S3. Divide the candidate answers into logical sentence sets, and perform deduplication and fusion processing on multiple logical sentence sets to obtain a target set.
[0042] S301. Segment the candidate answers into sentences according to punctuation marks; convert all characters in the sentences into sentence vectors through word embedding; use a deep neural network model to encode the sentence vectors into a vector representation with context information; convert the vector representation into a BIO annotation format to obtain logical sentences with labels; save all logical sentences of the candidate answers as a logical sentence set of the candidate answers.
[0043] The specific steps include: (1) Split candidate answers into sentences according to punctuation marks: Punctuation recognition: First, define a set of punctuation marks used to segment sentences, which usually include periods, question marks, exclamation marks, etc. In some languages, other specific punctuation marks may also need to be considered, such as semicolons.
[0044] Segmentation algorithm: Use regular expressions or natural language processing libraries (such as NLTK, spaCy, etc.) to segment the candidate answer text into separate sentences based on a defined set of punctuation marks.
[0045] (2) All characters in the sentence are converted into sentence vectors through word embedding: Tokenization: Before converting a sentence into a vector, it is often necessary to further decompose the sentence into word or subword units. This can be done with a tokenizer that takes into account word boundaries, abbreviations, proper nouns, etc.
[0046] Word embedding model: Use pre-trained word embedding models (such as Word2Vec, GloVe, BERT, etc.) to convert each word in the sentence into a high-dimensional vector. These vectors capture the semantic relationship between words.
[0047] Sentence vector construction: Sentence vectors can be constructed in many ways, such as taking the average or weighted average of all word vectors in a sentence, using a sequence model such as RNN / LSTM / Transformer to process the representation of the entire sentence, or using more advanced techniques such as Sentence-BERT to obtain sentence-level embeddings.
[0048] (3) Using a deep neural network model to encode the sentence vector into a vector representation with contextual information: Inputting the sentence vector into a deep neural network model that can capture more contextual information can produce a vector representation that contains more contextual information.
[0049] Contextual information enhancement: Use models such as RNN / LSTM, Transformer (such as BERT, GPT series), which can capture the dependencies and contextual information between words when processing sequence data.
[0050] (4) Convert the vector representation into BIO annotation format to obtain a logical sentence with a label: BIO annotation: BIO annotation is a format used for sequence annotation tasks, where B represents the beginning of an entity, I represents a word inside an entity, and O represents a non-entity word. This format is often used in tasks such as named entity recognition (NER).
[0051] Conversion process: The vector representation obtained in step (3) is input into a classifier (such as another neural network layer or CRF layer), which assigns a BIO label to each word in the sentence. This process is usually completed through supervised learning during the training phase, and the training data contains sentences that have been annotated with BIO labels.
[0052] The tags include: The labels obj, sobj and prop are used to represent the elements to be checked in the medical data, where the label obj is the only element with multiple child nodes in the rule check tree, otherwise, the label obj is the element in the second-to-last layer; the label sobj is an element with a higher level than the label obj in the rule check tree; the label prop is an element with a lower level than the label obj in the rule check tree; The label Rprop is the requirement condition connected to the label prop. If the comparison result is true, the rule check is passed; Label aRprop is the precondition connected to label prop. If the comparison result is true, the rule check is executed; The tag Robj is the parent element or reference element of the tag Rprop; The label cmp is used to indicate the relationship between the selected label prop and Rprop / aRprop, and contains its obligation type; Tag aRobj is the parent element or reference element of tag aRprop.
[0053] (5) Save all logical sentences of candidate answers as the logical sentence set of candidate answers: Set construction: Collect the BIO annotation results of all sentences in the candidate answers to form a logical sentence set. Each element in this set is a sentence with a BIO label, which reflects the position and type of entities (such as names of people, places, and institutions) in the sentence.
[0054] S303, deduplicate the identical logical sentences in the same logical sentence category, retain one logical sentence from multiple identical logical sentences and mark the number of repetitions for the retained logical sentence, and delete the remaining repeated logical sentences; perform conflict analysis on similar logical sentences, count the number of repetitions for multiple conflicting logical sentences, adopt the logical sentence with a higher number of repetitions and discard the logical sentence with a lower number of repetitions; merge similar logical sentences that have undergone conflict analysis to obtain a fused logical sentence, and save the fused logical sentence to the target set.
[0055] The specific steps include: (1) Remove duplicate logical sentences in the same logical sentence category: Clustering: First, the medical dictionary is used to extract the feature word vectors in the logic sentence, where the feature words are words belonging to medical terms. The clustering algorithm is used to cluster the logic sentences based on the feature word vectors of the logic sentences and the labels corresponding to the feature word vectors, and the number of clusters is set so that the similarity of the same type of logic sentences can reach 90%.
[0056] De-duplication: Within each category, traverse all logical sentences and use hash tables or sets to detect and remove duplicates. Specifically, each logical sentence is converted into a unique identifier (such as a hash value). If the identifier already exists in the hash table or set, it means that the logical sentence is a duplicate.
[0057] Marking the number of repetitions: For each logical sentence detected as repeated, count and record the number of times it is repeated while keeping a copy of it. This can be achieved by maintaining a counter in a hash table or set, which is associated with each unique identifier.
[0058] Remove duplicates: Remove all duplicate logical sentences from the original set except for the one copy that is retained.
[0059] (2) Conflict analysis of similar logical sentences: Define conflicts: Clarify what situations are considered conflicts between logical sentences. This usually depends on the specific application scenario. For example, two named entity recognition results may conflict due to different boundary divisions, or two relationship extraction results may conflict due to different connected entity pairs or relationship types. For example, "A and B belong to the same category" and "A and B belong to different categories" conflict.
[0060] Conflict detection: In similar logical sentences, the content or structure of each sentence is compared with other sentences to detect whether there is a conflict. Specifically, a pre-trained LSTM model is used for conflict detection. During the detection, the keyword vector is used as the feature value, the context relationship is generated based on the label of the keyword vector, and the keyword vector is sorted based on the context relationship to obtain a feature sequence. The two sets of feature sequences are input into the LSTM model to obtain the conflict detection result.
[0061] Counting the number of repetitions: For the detected conflict groups (i.e., a set of multiple conflicting logical sentences), compare the number of repetitions of the marks of each logical sentence. Select a logical sentence from each conflict group as a representative based on the number of repetitions. In this embodiment, the logical sentence with the highest number of repetitions is selected as the representative because it may reflect more extensive or more consistent information. All other sentences except the selected logical sentence are deleted from the conflict group.
[0062] (3) Merge similar logical sentences that have undergone conflict analysis to obtain fused logical sentences: Further merging or integrating logical sentences of the same type to form a more complete or consistent representation. This may require defining rules or strategies for merging, for example, merging sentences with the same entity but different attributes, or merging sentences that describe the same event but with slightly different details.
[0063] Generate fused logical sentences: According to the merging logic, the selected logical sentences are combined into one or more fused logical sentences. These fused sentences should be able to more accurately reflect the information in the original data.
[0064] Save to target collection: Save the fused logical sentences to a new target collection for subsequent use or analysis.
[0065] S4. Input the target set into the pre-trained language model to obtain the answer text data.
[0066] The target set is input into the ChatGPT model, which is a natural language processing tool driven by artificial intelligence technology. It uses the Transformer neural network architecture, especially the GPT-3.5 architecture, and has powerful language understanding and text generation capabilities.
[0067] Get the answer text data output by the ChatGPT model.
[0068] S5. Verify answer text data.
[0069] The pre-trained GPT model is used to complete the question text data based on the target paragraph data according to the context; the BM25 algorithm is used to calculate the correlation between the answer text data and the completed question text data; if the correlation reaches the set correlation threshold, the answer text data is adopted; if the correlation does not reach the set correlation threshold, the answer text data is discarded.
[0070] The specific steps include: (1) Use the pre-trained GPT model to complete the question text data: Input processing: The target paragraph data and the existing question text fragments are taken as input, and some preprocessing operations are required, such as text cleaning, word segmentation, encoding conversion, etc., to ensure that the model can correctly understand the input content.
[0071] Model reasoning: The processed input is fed into the GPT model, which generates the complete question text based on the language patterns and knowledge base it has learned internally. This process involves multiple rounds of generation, and each generation is adjusted based on feedback.
[0072] Output post-processing: The generated complete question text needs to be post-processed, such as removing unnecessary repetitions, adjusting word order, etc., to ensure its accuracy and readability.
[0073] (2) Use the BM25 algorithm to calculate the relevance of the answer text data: After obtaining the completed question text data, the BM25 (Best Match 25) algorithm is used to calculate the relevance of the answer text data to the question text. BM25 is a retrieval algorithm based on word frequency, which considers the frequency of query words in the document and the frequency of the document in the query word set to evaluate the relevance of the document to the query.
[0074] Document representation: Convert both the answer text data and the question text data into vectors or indexes for efficient similarity calculations. This usually involves steps such as word segmentation, removal of stop words, and word frequency calculation.
[0075] Relevance calculation: Use the formula of the BM25 algorithm to calculate the similarity between each word in the answer text and the words in the question text, and combine the similarities of all words to get the relevance score of the entire answer text and the question.
[0076] Threshold judgment: Compare the calculated relevance score with the preset relevance threshold. This threshold is usually set based on historical data or expert experience to determine whether the answer text is relevant enough to be adopted.
[0077] (3) Result processing: Based on the comparison result between the relevance score calculated by the BM25 algorithm and the set relevance threshold, it is decided whether to adopt the answer text data.
[0078] Processing logic: If the relevance reaches the set relevance threshold, the answer text is considered a valid answer and is subsequently displayed, stored, or further processed. If the relevance does not reach the set relevance threshold, the answer text data is discarded, and it may be necessary to find other answer sources or adjust the question text to search again.
[0079] In some embodiments, the automatic question-answering system based on medical documents may include multiple functional modules composed of computer program segments. The computer programs of each program segment in the automatic question-answering system based on medical documents may be stored in a memory of a computer device and executed by at least one processor to perform (see Figure 1 Description) Automatic question answering capabilities based on medical documents.
[0080] In this embodiment, the automatic question-answering system based on medical documents can be divided into multiple functional modules according to the functions it performs, such as Figure 2As shown. The functional modules of the system 200 may include: a paragraph matching module 210, a multi-source processing module 220, a multi-source fusion module 230 and an answer generation module 240. The module referred to in the present invention 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.
[0081] A paragraph matching module, used to obtain question text data, and retrieve target paragraph data matching the question text data from a database, wherein the database is used to store paragraph data divided from medical documents; A multi-source processing module, for generating multiple candidate answers based on target paragraph data using multiple language models; The multi-source fusion module is used to segment candidate answers into logical sentence sets, and perform deduplication and fusion processing on multiple logical sentence sets to obtain the target set; The answer generation module is used to input the target set into the pre-trained language model to obtain the answer text data.
[0082] Optionally, as an embodiment of the present invention, the paragraph matching module includes: A feature extraction unit, configured to extract a first keyword combination from the question text data using a keyword extraction technique, and convert the first keyword combination into a first word vector; The feature comparison unit is used to calculate the similarity between the first word vector and the word vector of the paragraph data, and output the paragraph data whose similarity reaches a preset similarity threshold as the target paragraph data.
[0083] Optionally, as an embodiment of the present invention, the multi-source fusion module includes: An answer segmentation unit, used to segment candidate answers into sentences according to punctuation marks; The vector conversion unit is used to convert all characters in a sentence into sentence vectors through word embedding; A vector encoding unit, used to encode the sentence vector into a vector representation with context information using a deep neural network model; A label generation unit, used for converting the vector representation into a BIO label format to obtain a logical sentence with a label; A set saving unit, used for saving all logical sentences of candidate answers as a logical sentence set of candidate answers; A clustering processing unit, used for performing clustering processing on the logical sentences in the plurality of logical sentence sets to obtain a plurality of logical sentence categories; A de-duplication processing unit, used for de-duplication of identical logical sentences in the same logical sentence category, retaining one logical sentence among multiple identical logical sentences and marking the number of repetitions for the retained logical sentence, and deleting the remaining repeated logical sentences; A conflict processing unit is used to perform conflict analysis on similar logical sentences, and for multiple logical sentences with conflicts, count the number of repetitions, adopt the logical sentence with a higher number of repetitions and discard the logical sentence with a lower number of repetitions; The merging processing unit is used to merge similar logical sentences that have undergone conflict analysis to obtain fused logical sentences, and save the fused logical sentences to the target set.
[0084] Optionally, as an embodiment of the present invention, the system further includes: The question completion module is used to use the pre-trained GPT model to complete the question text data according to the context based on the target paragraph data; A correlation calculation module, used to calculate the correlation between the answer text data and the completed question text data using the BM25 algorithm; An answer adopting module, used for adopting the answer text data if the relevance reaches a set relevance threshold; The answer discarding module is used to discard the answer text data if the relevance does not reach a set relevance threshold.
[0085] Figure 3 A schematic diagram of the structure of a terminal 300 provided in an embodiment of the present invention. The terminal 300 can be used to execute the automatic question-answering method based on medical documents provided in an embodiment of the present invention.
[0086] The terminal 300 may include: a processor 310, a memory 320 and a communication unit 330. These components communicate via one or more buses. Those skilled in the art will appreciate that the server structure shown in the figure does not limit the present invention, and it may be a bus structure or a star structure, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0087] The memory 320 can be used to store the execution instructions of the processor 310, and the memory 320 can be implemented by any type of volatile or non-volatile storage terminal or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. When the execution instructions in the memory 320 are executed by the processor 310, the terminal 300 can perform some or all of the steps in the following method embodiments.
[0088] The processor 310 is the control center of the storage terminal, and uses various interfaces and lines to connect various parts of the entire electronic terminal. It runs or executes software programs and / or modules stored in the memory 320, and calls data stored in the memory to perform various functions of the electronic terminal and / or process data. The processor can be composed of an integrated circuit (IC), for example, it can be composed of a single packaged IC, or it can be composed of multiple packaged ICs with the same or different functions. For example, the processor 310 can only include a central processing unit (CPU). In the embodiment of the present invention, the CPU can be a single computing core or multiple computing cores.
[0089] The communication unit 330 is used to establish a communication channel so that the storage terminal can communicate with other terminals, receive user data sent by other terminals or send user data to other terminals.
[0090] The present invention also provides a computer storage medium, wherein the computer storage medium may store a program, and when the program is executed, the program may include some or all of the steps in each embodiment provided by the present invention. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM).
[0091] Therefore, the present invention generates multiple candidate answers by utilizing a multi-source model, and then logically combs and integrates the candidate answers to obtain more accurate answer text data. At the same time, by completing the question text data and verifying the answer text data based on the completed question text data, the accuracy of the output answer is further improved, and misleading the consultant due to errors in the output answer is effectively avoided. The technical effects that can be achieved by this embodiment can be found in the description above and will not be repeated here.
[0092] Those skilled in the art can clearly understand that the technology in the embodiments of the present invention can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution in the embodiments of the present invention, in essence or in other words, 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 a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes, including several instructions for enabling a computer terminal (which can be a personal computer, a server, or a second terminal, a network terminal, etc.) to execute all or part of the steps of the methods described in each embodiment of the present invention.
[0093] In this specification, the same or similar parts between the various embodiments can be referred to each other. In particular, for the terminal embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description in the method embodiment.
[0094] In the several embodiments provided by the present invention, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system 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 modules or components can be combined or integrated into another system, 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 through some interfaces, indirect coupling or communication connection of systems or modules, which can be electrical, mechanical or other forms.
[0095] The modules described as separate components may or may not be physically separated, and the components shown as modules 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 modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0096] In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.
[0097] Although the present invention has been described in detail with reference to the accompanying drawings and in combination with the preferred embodiments, the present invention is not limited thereto. Without departing from the spirit and essence of the present invention, a person of ordinary skill in the art may make various equivalent modifications or substitutions to the embodiments of the present invention, and these modifications or substitutions shall be within the scope of the present invention. Any person of ordinary skill in the art may easily think of changes or substitutions within the technical scope disclosed by the present invention, and these shall be within the scope of protection of the present invention.
Claims
1. An automatic question answering method based on medical documents, characterized in that: include: Acquire question text data, and retrieve target paragraph data matching the question text data from a database, wherein the database is used to store paragraph data divided from medical documents; Use multiple language models to generate multiple candidate answers based on the target paragraph data; The candidate answers are divided into logical sentence sets, and multiple logical sentence sets are deduplicated and merged to obtain the target set; Input the target set into the pre-trained language model to obtain the answer text data.
2. The method according to claim 1, characterized in that Acquire question text data, and retrieve target paragraph data matching the question text data from a database, wherein the database is used to store paragraph data divided from medical documents, including: Extracting a first keyword combination from the question text data using a keyword extraction technique, and converting the first keyword combination into a first word vector; The similarity between the first word vector and the word vector of the paragraph data is calculated, and the paragraph data whose similarity reaches a preset similarity threshold is output as the target paragraph data.
3. The method according to claim 1, characterized in that The candidate answers are divided into logical sentence sets, and multiple logical sentence sets are deduplicated and merged to obtain the target set, including: Split candidate answers into sentences based on punctuation marks; All characters in the sentence are converted into sentence vectors through word embedding; Encoding the sentence vector into a vector representation with context information using a deep neural network model; Convert the vector representation into a BIO annotation format to obtain a labeled logical sentence; Save all logical sentences of candidate answers as a logical sentence set of candidate answers; Clustering the logical sentences in the multiple logical sentence sets to obtain multiple logical sentence categories; De-duplicate identical logical sentences in the same logical sentence category, retain one logical sentence among multiple identical logical sentences and mark the number of repetitions for the retained logical sentence, and delete the remaining repeated logical sentences; Conduct conflict analysis on similar logical sentences. For multiple logical sentences with conflicts, count the number of repetitions, adopt the logical sentence with a higher number of repetitions and discard the logical sentence with a lower number of repetitions. The similar logical sentences that have been conflict analyzed are merged to obtain fused logical sentences, and the fused logical sentences are saved to the target set.
4. The method according to claim 1, characterized in that The method further comprises: Use the pre-trained GPT model to complete the question text data based on the target paragraph data according to the context; Calculate the correlation between the answer text data and the completed question text data using the BM25 algorithm; If the relevance reaches a set relevance threshold, the answer text data is adopted; If the relevance does not reach the set relevance threshold, the answer text data is discarded.
5. An automatic question-answering system based on medical documents, characterized in that: include: A paragraph matching module, used to obtain question text data, and retrieve target paragraph data matching the question text data from a database, wherein the database is used to store paragraph data divided from medical documents; A multi-source processing module, for generating multiple candidate answers based on target paragraph data using multiple language models; The multi-source fusion module is used to segment candidate answers into logical sentence sets, and perform deduplication and fusion processing on multiple logical sentence sets to obtain the target set; The answer generation module is used to input the target set into the pre-trained language model to obtain the answer text data.
6. The system according to claim 5, characterized in that The paragraph matching module includes: A feature extraction unit, configured to extract a first keyword combination from the question text data using a keyword extraction technique, and convert the first keyword combination into a first word vector; The feature comparison unit is used to calculate the similarity between the first word vector and the word vector of the paragraph data, and output the paragraph data whose similarity reaches a preset similarity threshold as the target paragraph data.
7. The system according to claim 5, characterized in that The multi-source fusion module includes: An answer segmentation unit, used to segment candidate answers into sentences according to punctuation marks; The vector conversion unit is used to convert all characters in a sentence into sentence vectors through word embedding; A vector encoding unit, used to encode the sentence vector into a vector representation with context information using a deep neural network model; A label generation unit, used for converting the vector representation into a BIO label format to obtain a logical sentence with a label; A set saving unit, used for saving all logical sentences of candidate answers as a logical sentence set of candidate answers; A clustering processing unit, used for performing clustering processing on the logical sentences in the plurality of logical sentence sets to obtain a plurality of logical sentence categories; A de-duplication processing unit, used for de-duplication of identical logical sentences in the same logical sentence category, retaining one logical sentence among multiple identical logical sentences and marking the number of repetitions for the retained logical sentence, and deleting the remaining repeated logical sentences; A conflict processing unit is used to perform conflict analysis on similar logical sentences, and for multiple logical sentences with conflicts, count the number of repetitions, adopt the logical sentence with a higher number of repetitions and discard the logical sentence with a lower number of repetitions; The merging processing unit is used to merge similar logical sentences that have undergone conflict analysis to obtain fused logical sentences, and save the fused logical sentences to the target set.
8. The system according to claim 5, characterized in that The system further comprises: The question completion module is used to use the pre-trained GPT model to complete the question text data according to the context based on the target paragraph data; A correlation calculation module, used to calculate the correlation between the answer text data and the completed question text data using the BM25 algorithm; An answer adopting module, used for adopting the answer text data if the relevance reaches a set relevance threshold; The answer discarding module is used to discard the answer text data if the relevance does not reach a set relevance threshold.
9. A terminal, characterized in that: include: A memory for storing an automatic question-answering program based on medical documents; A processor, configured to implement the steps of the automatic question-answering method based on medical documents as described in any one of claims 1 to 4 when executing the automatic question-answering program based on medical documents.
10. A computer-readable storage medium storing a computer program, characterized in that: The readable storage medium stores an automatic question-answering program based on medical documents, and when the automatic question-answering program based on medical documents is executed by a processor, the steps of the automatic question-answering method based on medical documents as described in any one of claims 1 to 4 are implemented.
Citation Information
Cited By
Recruitment test question generation method and device based on large model and storage medium
CN120509385A
