Medical intelligent question answering method and device based on radical modeling and text matching

By building a radical-based text matching model, we solved the problem in online medical Q&A communities where the number of patient questions increases much faster than the number of doctors. By using radical information to capture the semantic connections between texts, we improved text matching performance, reduced doctors' workload, and increased the speed of answering questions.

CN117093680BActive Publication Date: 2025-09-19海南榕树家信息科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310819782.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-06
Publication Date
2025-09-19
Estimated Expiration
2043-07-06

AI Technical Summary

Technical Problem

In online medical Q&A communities, the rate at which patients' questions increase is much faster than the rate at which they are answered. Furthermore, due to the small number of doctors and the patients' lack of professional medical knowledge, they are unable to describe their problems professionally. This results in a large number of repeated questions, making it impossible to effectively match answers, and increases the workload of doctors.

Method used

By building a radical-based text matching model, using radical information to help the deep learning model capture the semantic connections between texts, building a text matching medical question and answer knowledge base, training the text matching medical question and answer model, and improving text matching performance.

Benefits of technology

It effectively reduces the workload of doctors, improves the speed of question answering, and generates more correlation matrices through the multi-correlation feature interaction layer and the three-dimensional convolutional feature encoding layer, thereby improving the performance of text matching and the semantic matching effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117093680B_ABST
    Figure CN117093680B_ABST
Patent Text Reader

Abstract

The present invention discloses a medical intelligent question-answering method and device, a storage medium, and an electronic device based on radical modeling and text matching. The technical problem to be solved by the present invention is how to use natural language processing technology to help doctors answer patients' questions and reduce doctors' workload. The technical solution adopted is as follows: ① A medical intelligent question-answering method based on radical modeling and text matching, the method comprising the following steps: S1, constructing a text-matching medical question-answering knowledge base; S2, constructing a text-matching medical question-answering model training data set; S3, constructing a text-matching medical question-answering model; S4, training the text-matching medical question-answering model. ② A medical intelligent question-answering device based on radical modeling and text matching, the device comprising: a text-matching medical question-answering knowledge base construction unit, a text-matching medical question-answering model training data set generation unit, a text-matching medical question-answering model construction unit, and a text-matching medical question-answering model training unit.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] Technical problem

[0002] The present invention relates to the technical field of natural language processing, and in particular to a medical intelligent question-answering method and device based on radical modeling text matching.

[0003] With the rapid development of the current Internet, the traditional medical industry has begun to embrace the Internet, and a large number of applications convenient for patients have emerged. Among them, the online medical Q&A community has developed relatively rapidly because it greatly reduces the link for patients to seek help from doctors. Patients post questions in the Internet community, and relevant professional doctors answer the questions, avoiding the processes of going to the hospital, registering, and queuing in the traditional medical treatment process. However, with the increase in the number of users asking questions online, the growth rate of questions is much faster than the answering rate. There are two reasons for this problem. On the one hand, the number of patients is much higher than the number of professional doctors, and the number of doctors answering questions in the community is even less; on the other hand, due to the lack of professional medical knowledge among patients, they cannot describe questions professionally, so they will put forward different descriptions for the same question, which results in a large number of duplicate questions in the Q&A community. We use text matching technology to match the questions of patients with the questions in the question-answer pairs stored in the database, that is, duplicate question-answer pairs, so as to select the corresponding answer and feedback it to the user. This can not only reduce the workload of doctors but also improve the answering speed.

[0004] For Chinese, each character has a corresponding radical. Generally speaking, there is often a certain semantic connection between characters with the same radical. For example, "割" and "划", these two characters have the same radical "刂", which indicates that these two characters are both related to "knife" to a certain extent. Obviously, radical information helps the deep learning model better learn text semantic information and capture the semantic connection between texts. Therefore, the present invention constructs a text matching model based on radicals and applies it to medical question-answering, so as to select the most relevant answer from the existing question-answer pairs according to the questions raised by users. Summary of the invention:

[0005] The technical task of the present invention is to provide a medical intelligent question-answering method and device, a storage medium, and an electronic device based on radical modeling text matching to solve how to use natural language processing technology to match the questions of patients with existing questions and feedback the answers corresponding to the matched preset questions to the patients, reduce the workload of doctors, and improve the speed of question answering. The present invention incorporates radicals into the modeling process, helps the model capture the semantic connection between texts, effectively improves the performance of text matching, and further promotes the development of medical question-answering.

[0006] The technical task of the present invention is realized as follows. A medical intelligent question-answering method based on radical modeling text matching, the method includes the following steps:

[0007] S1. Construct a text-matching medical question-answering knowledge base: Collect frequently asked medical question-answering texts from the Internet and pre-process the texts to construct a text-matching medical question-answering knowledge base;

[0008] S2. Constructing a training dataset for a text-matching medical question-answering model: For the text pairs in the text-matching medical question-answering knowledge base obtained in step S1, if their semantics are consistent, the text pairs are used to construct positive training examples; otherwise, they are used to construct negative training examples. A large amount of positive and negative data are mixed to obtain a training dataset.

[0009] S3. Build a text-matching medical question-answering model: Build a text-matching medical question-answering model based on radicals;

[0010] S4. Training the text matching medical question answering model: The text matching medical question answering model constructed in step S3 is trained on the text matching medical question answering model training dataset obtained in step S2.

[0011] A medical intelligent question-answering device based on radical modeling and text matching, comprising:

[0012] A text matching medical question and answer knowledge base construction unit is used to obtain a large amount of text pair data and then pre-process the data to obtain a text matching medical question and answer knowledge base that meets the training requirements;

[0013] The training dataset generation unit for the text matching medical question-answering model uses a text pair in the text matching medical question-answering knowledge base to construct positive training examples if the text pair has consistent semantics; otherwise, it constructs negative training examples. A large amount of positive and negative data is mixed to generate a training dataset.

[0014] A text matching medical question-answering model construction unit is used to construct a word mapping conversion table, a radical mapping conversion table, an input encoding module, a word vector mapping layer, a radical vector mapping layer, a text semantic encoding layer, a multi-correlation feature interaction layer, a three-dimensional convolutional feature encoding layer, and a prediction layer;

[0015] The text matching medical question-answering model training unit is used to construct the loss function and optimization function required in the model training process and complete the model training.

[0016] A storage medium stores a plurality of instructions, which are loaded by a processor to execute the steps of the above-mentioned medical intelligent question-answering method based on radical modeling and text matching.

[0017] An electronic device comprises: the above-mentioned storage medium; and a processor for executing instructions in the storage medium.

[0018] Technical effects:

[0019] (1) The present invention extracts the character representation, word representation and radical representation of the text through text semantic coding layer processing, which can more comprehensively learn the semantic information of the text, thereby improving the text matching performance. In addition, the radical information further provides clues to model the semantic connection between the characters in the text;

[0020] (2) The present invention uses multiple correlation feature interaction layers and multiple calculation methods, namely, dot multiplication, absolute value subtraction, and multiplication, to construct a correlation matrix between texts. Compared with a single calculation method, more correlation matrices are generated to improve the performance of text matching;

[0021] (3) The present invention constructs a correlation matrix based on multiple granularity information between texts, namely characters, words, and radicals through a multi-correlation feature interaction layer, thereby generating more correlation matrices and being able to better construct a correlation feature graph to improve the performance of the text matching model.

[0022] (4) The present invention constructs a correlation cube based on the correlation feature map through a three-dimensional convolutional feature encoding layer, and further uses a three-dimensional convolutional neural network model to generate a matching representation of the input text pair. This method models the matching representation of the input text pair from a higher dimension, thereby achieving better performance;

[0023] (5) The present invention can effectively improve the effect of semantic matching by comprehensively using the text semantic coding layer, the multi-correlation feature interaction layer, and the three-dimensional convolution feature coding layer.

[0024] The present invention will be further described below with reference to the accompanying drawings.

[0025] Figure 1 Flowchart of the medical intelligent question answering method based on radical modeling and text matching

[0026] Figure 2 Flowchart for building a text matching medical question answering knowledge base

[0027] Figure 3 Flowchart for building a training dataset for a text-matching medical question-answering model

[0028] Figure 4 Flowchart for building a text matching medical question answering model

[0029] Figure 5 Flowchart for training text matching medical question answering model

[0030] Figure 6 Schematic diagram of the structure of the hierarchical expansion convolutional network

[0031] Figure 7 Schematic diagram for constructing the structure of the dot product correlation matrix

[0032] Figure 8 Schematic diagram of the framework of the medical question-answering model for text matching DETAILED DESCRIPTION

[0034] The medical intelligent question-answering method and device based on radical modeling and text matching of the present invention are described in detail below with reference to the accompanying drawings and specific embodiments of the specification.

[0035] Example 1:

[0036] The overall framework structure of the present invention is as follows Figure 8 As shown. Figure 8 It can be seen that the main framework structure of the present invention includes a text semantic encoding layer, a multi-correlation feature interaction layer, a three-dimensional convolutional feature encoding layer and a prediction layer. Among them, the text semantic encoding layer first embeds the character granularity information, word granularity information and radical granularity information of the input text to obtain character embedding representation, word embedding representation and radical embedding representation; then uses a bidirectional LSTM, abbreviated as BiLSTM, to encode them respectively to generate character context representation, word context representation and radical context representation, and pass them into the hierarchical expansion convolution network. The structural diagram of the hierarchical expansion convolution network is shown in the figure. Figure 6As shown, it takes the contextual representation as input, namely the character / word / radical contextual representation, and encodes it through a dilated convolutional neural network with a dilation rate of 1 to obtain the first-layer convolutional representation, i.e., the first-layer convolutional representation of the character / word / radical. It then encodes it through a dilated convolutional neural network with a dilation rate of 2 to obtain the second-layer convolutional representation. It further encodes it through a dilated convolutional neural network with a dilation rate of 3 to obtain the third-layer convolutional representation. Finally, the first, second, and third-layer convolutional representations are concatenated to obtain the dilated convolutional text representation. The character contextual representation, word contextual representation, and radical contextual representation are encoded through hierarchical dilated convolutional networks, respectively, to obtain the dilated convolutional character text representation, dilated convolutional word text representation, and dilated convolutional radical text representation. The text semantic encoding layer further concatenates the character contextual representation, word contextual representation, and radical contextual representation with the dilated convolutional character text representation, dilated convolutional word text representation, and dilated convolutional radical text representation, respectively, to generate the text character representation, text word representation, and text radical representation, which are then passed to the multi-correlation feature interaction layer. The multi-correlation feature interaction layer receives the representations of two texts obtained through the text semantic encoding layer, namely, the character representation of text P, the character representation of text Q, the word representation of text P, the word representation of text Q, the radical representation of text P, and the radical representation of text Q; first, based on different calculation methods, a dot product correlation matrix, an absolute value subtraction correlation matrix, and a multiplication correlation matrix are constructed respectively; then they are stacked to construct a dot product-based correlation feature map, a multiplication-based correlation feature map, and an absolute value subtraction-based correlation feature map. Among them, the structural diagram of constructing the dot product correlation matrix is ​​as follows: Figure 7As shown in FIG, it takes the character representation of text P, the word representation of text P, the radical representation of text P, the character representation of text Q, the word representation of text Q, and the radical representation of text Q as input; performs dot multiplication on the character representation of text P with the character representation of text Q, the radical representation of text Q, and the word representation of text Q, respectively, to obtain the dot product correlation matrix between the characters of text P and the characters / radicals / words of text Q; performs dot multiplication on the radical representation of text P with the character representation of text Q, the radical representation of text Q, and the word representation of text Q, respectively, to obtain the dot product correlation matrix between the radicals of text P and the characters / radicals / words of text Q; performs dot multiplication on the word representation of text P with the character representation of text Q and the radical representation of text Q, respectively, to obtain the dot product correlation matrix between the words of text P and the characters / radicals of text Q. The multi-correlation feature interaction layer passes the dot product-based correlation feature map, the multiplication-based correlation feature map, and the absolute value subtraction-based correlation feature map to the three-dimensional convolutional feature encoding layer. The three-dimensional convolutional feature encoding layer stacks these to construct a relevance cube. This is then encoded using a three-dimensional convolutional neural network to obtain a matching representation of the input text pair, which is then passed to the prediction layer. The prediction layer encodes the matching representation of the received input text pair using a fully connected layer to obtain a matching value.

[0037] Example 2:

[0038] As attached Figure 1 As shown, the medical intelligent question-answering method based on radical modeling and text matching of the present invention comprises the following steps:

[0039] S1. Construct a text-matching medical question-answering knowledge base: Collect frequently asked medical question-answering texts from the Internet and pre-process the texts to construct a text-matching medical question-answering knowledge base;

[0040] S2. Constructing a training dataset for a text-matching medical question-answering model: For the text pairs in the text-matching medical question-answering knowledge base obtained in step S1, if their semantics are consistent, the text pairs are used to construct positive training examples; otherwise, they are used to construct negative training examples. A large amount of positive and negative data are mixed to obtain a training dataset.

[0041] S3. Build a text-matching medical question-answering model: Build a text-matching medical question-answering model based on radicals;

[0042] S4. Training the text matching medical question answering model: The text matching medical question answering model constructed in step S3 is trained on the text matching medical question answering model training dataset obtained in step S2.

[0043] S1. Construct a text-matching medical question-answering knowledge base: Collect frequently asked medical question-answering texts from the Internet and pre-process the texts to construct a text-matching medical question-answering knowledge base;

[0044] S101. Collect data: Collect the common question texts of medical Q&A as the original data for the text-matching medical Q&A knowledge base;

[0045] Illustrative example: Collect the question text pairs that appear in medical Q&A and use them as the original data. The text pair example is expressed as follows:

[0046] Txt P Hemoptysis after strenuous exercise. What's wrong? Txt Q What are the reasons for hemoptysis after strenuous exercise?

[0047] S102. Preprocess the original data for building the text-matching medical Q&A knowledge base. Perform word-breaking operations, word-segmentation operations, and radical extraction operations on each text in it to obtain the text-matching medical Q&A word-breaking processing knowledge base, the word-segmentation processing knowledge base, and the radical processing knowledge base;

[0048] Perform word-breaking preprocessing, word-segmentation preprocessing, and radical extraction preprocessing on each text in the original data for building the text-matching medical Q&A knowledge base obtained in step S101 to obtain the text-matching medical Q&A word-breaking processing knowledge base, the word-segmentation processing knowledge base, and the radical processing knowledge base; The specific steps of the word-breaking operation are: Take each character in the Chinese text as a unit and use a space as a delimiter to split each text; The specific steps of the word-segmentation operation are: Use the Jieba word-segmentation tool and select the default accurate mode to split each text; The specific operation steps of the radical extraction operation are: First, use the radical tool kit to convert each character into its corresponding traditional form, and then use the Radical tool kit to obtain the radical of each character in the text; In this operation, in order to avoid the loss of semantic information, all contents including punctuation marks, special characters, and stop words in the text are retained;

[0049] Illustrative example: Taking the txt P shown in S101 as an example, after performing the word-breaking operation on it, "What's wrong with coughing up blood after strenuous exercise?" is obtained; After performing the word-segmentation operation on it using the Jieba word-segmentation tool, "What's wrong with coughing up blood after strenuous exercise?" is obtained; After using the radical tool kit to extract the radical of each character in it, "刂灬辶力彳口血,日心麻目?" is obtained.

[0050] S103. Aggregate the text-matching medical Q&A word-breaking processing knowledge base, the text-matching medical Q&A word-segmentation processing knowledge base, and the text-matching medical Q&A radical processing knowledge base to build the text-matching medical Q&A knowledge base;

[0051] Aggregate the text-matching medical Q&A word-breaking processing knowledge base, the text-matching medical Q&A word-segmentation processing knowledge base, and the text-matching medical Q&A radical processing knowledge base obtained in step S102 into the same folder to obtain the text-matching medical Q&A knowledge base. Its process is as Figure 2As shown; it should be noted here that the data processed by the hyphenation operation, the data processed by the word segmentation operation, and the data processed by the radical extraction operation will not be merged into the same file, that is, the text matching medical question and answer knowledge base actually contains three independent sub-knowledge bases; each preprocessed text retains the ID information of its original text.

[0052] S2. Constructing a training dataset for a text-matching medical question-answering model: For the text pairs in the text-matching medical question-answering knowledge base obtained in step S1, if their semantics are consistent, the text pairs are used to construct positive training examples; otherwise, they are used to construct negative training examples. A large amount of positive and negative data are mixed to obtain a training dataset.

[0053] S201. Construct training positive data: construct two texts with consistent semantics as positive data; since the text matching medical question-answering knowledge base actually contains three independent sub-knowledge bases, the same text will have three initial representations, namely (txt P_char,txt Q_char,1), (txt P_word,txt Q_word,1), and (txt P_radical,txtQ_radical,1); merge them together, and the final constructed positive data can be formalized as: (txt P_char,txt Q_char,txt P_word,txt Q_word,txt P_radical,txt Q_radical,1).

[0054] Among them, txt P_char and txt Q_char refer to the character sequence of text P and the character sequence of text Q in the text matching medical question and answer word segmentation processing knowledge base, respectively; txt P_word and txt Q_word refer to the word sequence of text P and the word sequence of text Q in the text matching medical question and answer word segmentation processing knowledge base, respectively; txt P_radical and txt Q_radical refer to the radical sequence of text P and the radical sequence of text Q in the text matching medical question and answer radical processing knowledge base, respectively; and the 1 here indicates that the semantics of the two texts match, which is a positive example;

[0055] For example, for text P and text Q shown in S101, after word segmentation, radical extraction, the constructed positive data format is:

[0056] ("I cough up blood after strenuous exercise, what's wrong?", "What causes coughing up blood after strenuous exercise?", "I cough up blood after strenuous exercise, what's wrong?", "What causes coughing up blood after strenuous exercise?", "I cough up blood in my mouth and my eyes become numb and dizzy?", "I cough up blood in my mouth and my eyes become numb and dizzy?", 1).

[0057] S202, constructing training negative examples: For each positive example text obtained in step S201, select a text contained in it, and randomly select a text that does not match it to combine; these two semantically inconsistent texts are constructed as negative example data; using similar operations as step S201, the negative example data can be formalized as: (txt P_char, txt Q_char, txt P_word, txt Q_word, txt P_radical, txt Q_radical, 0); the meaning of each symbol is the same as in step S201, and 0 indicates that the semantics of the two texts do not match, which is a negative example;

[0058] For example: Since the construction method of negative examples is very similar to that of positive examples, I will not go into details here;

[0059] S203. Construct a training data set: merge all the positive example text data and negative example text data obtained after the operations in step S201 and step S202, and shuffle their order to construct the final training data set; both positive example data and negative example data contain seven dimensions, namely, txt P_char, txt Q_char, txt P_radical, txt Q_radical, txt P_word, txt Q_word, 0 or 1.

[0060] S3. Build a text matching medical question answering model: The process of building a text matching medical question answering model is as follows Figure 4 As shown, the main operations are to build a word mapping conversion table, build a radical mapping conversion table, build an input encoding module, build a word vector mapping layer, build a radical vector mapping layer, build a text semantic encoding layer, build a multi-correlation feature interaction layer, build a three-dimensional convolution feature encoding layer, and build a prediction layer; the specific steps are as follows:

[0061] S301. Constructing a word mapping conversion table: The word table is constructed using the text matching medical question and answer segmentation processing knowledge base and the word segmentation processing knowledge base obtained after step S102. After the word table is constructed, each word in the table is mapped to a unique numerical identifier. The mapping rule is: starting with the number 1, and then sorting each word in the order in which it was entered into the word table in ascending order, thereby forming the required word mapping conversion table.

[0062] For example, the content processed in step S102 is “coughing up blood after strenuous exercise, what’s wrong?” and “coughing up blood after strenuous exercise, what’s wrong?”. The word table and word mapping conversion table are constructed as follows:

[0063]

[0064] Afterwards, the present invention uses Word2Vec to train a word vector model to obtain a word vector matrix char_word_embedding_matrix for each word;

[0065] For example, in Keras, the code described above is implemented as follows:

[0066] w2v_model_char_word=genism.models.Word2Vec(w2v_corpus_char_word, size=EMBDIM, window=5, min_count=1, sg=1, workers=4, seed=1234, iter=25)

[0067] tokenizer=Tokenizer(num_words=len(char_word_set))

[0068] tokenizer.fit_on_texts(corpus)

[0069] L=len(tokenizer.char_word_index)

[0070] char_word_embedding_matrix=np.zeros([len(tokenizer.word_index)+1,EMBDIM])

[0071] for char_word,idx in tokenizer.word_index.items():

[0072] if char_word in w2v_model.wv:

[0073] char_word_embedding_matrix[idx,:]=w2v_model.wv[char_word]

[0074] Among them, w2v_corpus_char_word is the training corpus for word segmentation and hyphenation processing, that is, all the data in the text matching medical question and answer hyphenation and word segmentation processing knowledge base; EMBDIM is the vector dimension of the word. This model sets EMBDIM to 300, and char_word_set is the word list.

[0075] S302. Construct a radical mapping conversion table: The radical table is constructed by matching the text obtained through step S102 with the medical Q&A radical processing knowledge base; after the radical table is constructed, each radical in the table is mapped to a unique numerical identifier, and the mapping rule is: starting from the number 1, and then incrementing and sorting in sequence according to the order in which each radical is entered into the radical table, so as to form the required radical mapping conversion table;

[0076] Illustrative example: Taking the content processed in step S102, "刂灬辶力彳口血,日心麻目?", the radical table and the radical mapping conversion table are constructed as follows

[0077] Radical 刂 灬 辶 力 彳 口 血 , 日 心 麻 目 ? Mapping 1 2 3 4 5 6 7 8 9 10 11 12 13

[0078] After that, the present invention uses Word2Vec to train a radical vector model to obtain a radical vector matrix radical_embedding_matrix for each character;

[0079] Illustrative example: In Keras, for the code implementation described above, it is basically the same as the illustrative example in S301, except that each parameter is changed from char_word to radical-related. Due to space limitations, it will not be elaborated here.

[0080] Among them, in the illustrative example in S301, w2v_corpus_char_word is replaced by w2v_corpus_radical, which is the radical processing training corpus, that is, all the data in the medical Q&A radical processing knowledge base; the radical vector dimension is RADICAL_EMBDIM, and the present model sets RADICAL_EMBDIM to 70; char_word_set is replaced by radical_set, which is the radical table.

[0081] S303. Construct an input module: The input module includes six inputs; for each text in the training dataset or the text to be predicted, use the corresponding modules in S1 and S2 to preprocess it, and respectively obtain the character sequence txt P_char of text P, the character sequence txt Q_char of text Q, the word sequence txt P_word of text P, the word sequence txt Q_word of text Q, the radical sequence txt P_radical of text P, and the radical sequence txt Q_radical of text Q, and formalize it as: (txt P_char, txt Q_char, txt P_word, txt Q_word, txt P_radical, txt Q_radical);

[0082] For each character, word, and radical in the input text, the present invention converts it into a corresponding digital identifier according to the word mapping conversion table and radical mapping conversion table constructed in steps S301 and S302;

[0083] ("What's wrong with coughing up blood after strenuous exercise?", "What causes coughing up blood after strenuous exercise?", "What's wrong with coughing up blood after strenuous exercise?", "What causes coughing up blood after strenuous exercise?", "刂灬辶力彳口血,日心麻目?", "刂灬辶力彳口血日亻麻厂囗?")

[0084] Each input data contains 6 texts; for the first four texts, according to the word mapping conversion table in step S301, convert them into numerical representations; for the next two texts, according to the radical mapping conversion table in step S302, convert them into numerical representations; the combined representation results of the 6 texts of the input data are as follows (assuming the mapping relationships that appear in text 2 but not in text 1 are: "什": 17, "原": 18, "因": 19, "什么": 20, "原因": 21, "亻": 14, "厂": 15, "囗": 16): <0000...请注意,原文中“

[0085] ”和“ ”等标签后的内容缺失,翻译时保留了原标签形式。你可补充完整原文内容以便我能更准确地为你翻译。 另外,原文中“

[0085] ”和“ ”等标签后的内容缺失,翻译时保留了原标签形式。你可补充完整原文内容以便我能更准确地为你翻译。 另外,原文中“

[0085] ”和“ ”等标签后的内容缺失,翻译时保留了原标签形式。你可补充完整原文内容以便我能更准确地为你翻译。 (“1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13”, “1, 2, 3, 4, 5, 6, 7, 9, 17, 11, 18, 19, 13”, “14, 5, 15, 8, 9, 16, 12, 13”, “14, 5, 16, 9, 20, 21, 13”, “1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13”, “1, 2, 3, 4, 5, 6, 7, 9, 14, 11, 15, 16, 13”).

[0086] S304. Construct a word vector mapping layer: Initialize the weight parameters of the current layer by loading the word vector matrix obtained from training in the step of constructing the word mapping conversion table; for the input texts txt P_char, txt Q_char, txt P_word, and txt Q_word, obtain their corresponding vectors txt P_char_embed, txt Q_char_embed, txt P_word_embed, and txt Q_word_embed. For each text in the text matching medical Q&A word breaking and word segmentation processing knowledge base, through the method of word vector mapping, convert the text word information into vector form, that is, character embedding representation and word embedding representation;

[0087] Illustrate with an example: In Keras, the code implementation for the above description is as follows:

[0088] char_word_embedding_layer=Embedding(char_word_embedding_matrix.shape[0],char_word_emb_dim,weights=[char_word_embedding_matrix],

[0089] input_length=input_dim, trainable=False)

[0090] Among them, char_word_embedding_matrix is ​​the word vector matrix trained in the step of building the word mapping conversion table, char_word_embedding_matrix.shape[0] is the size of the word table of the word vector matrix, char_word_emb_dim is the dimension of the output word vector, and input_length is the length of the input sequence.

[0091] The corresponding texts txt P_char, txt Q_char, txt P_word, and txt Q_word are processed by the Keras Embedding layer to obtain the character embedding representations txt P_char_embed and txt Q_char_embed, and the word embedding representations txt P_word_embed and txt Q_word_embed of the corresponding texts.

[0092] S305. Constructing a Radical Vector Mapping Layer: Initialize the weight parameters of the current layer by loading the radical vector matrix trained in the step of constructing a radical mapping conversion table. For the input texts txt P_radical and txt Q_radical, obtain their corresponding vectors txt P_radical_embed and txt Q_radical_embed. For each text in the text matching medical question and answer radical processing knowledge base, the text radical information is converted into a vector form, i.e., a radical embedding representation, through radical vector mapping.

[0093] For example: In Keras, the code implementation described above is basically the same as in S304, except that the parameters are changed from char to radical. Due to space limitations, I will not go into details here.

[0094] The corresponding texts txt P_radical and txt Q_radical are processed by the Keras Embedding layer to obtain the corresponding text radical embedding representations txt P_radical_embed and txt Q_radical_embed.

[0095] S306, constructing a text semantic encoding layer: This layer receives the character embedding representation output by the word vector mapping layer, the word embedding representation, and the radical embedding representation output by the radical vector mapping layer as input; first, using BiLSTM to encode the character embedding representation and the word embedding representation respectively to generate a character context representation and a word context representation; at the same time, using a fully connected neural network to encode the radical embedding representation, and then passing it into BiLSTM to generate a radical context representation; then further using a hierarchical dilated convolutional network to encode, to obtain a dilated convolution character text representation, a dilated convolution word text representation, and a dilated convolution radical text representation; and then connecting them with the corresponding context representation to generate a character representation of the text, a word representation of the text, and a radical representation of the text;

[0096] S30601, BiLSTM feature extraction: The text semantic encoding layer first uses BiLSTM to encode the character embedding representations and word embedding representations of the two texts respectively to generate character context representations and word context representations. For the radical embedding representation, it is first encoded using a fully connected neural network and then passed to BiLSTM to generate the radical context representation. For text P, the specific operation is shown in the following formula:

[0097]

[0098] Where N is the length of the text; represents the character embedding representation of the text P at the i-th position under the character granularity c; Represents the word embedding representation of the text P at the jth position under the word granularity w; represents the radical embedding representation of the text P at the mth position under the radical granularity r; Dense represents the fully connected neural network encoding; and Represent the character context representation of text P, the word context representation of text P and the radical context representation of text P respectively; similarly, for text Q, we get Q respectively. c' , Q w' , Q r' , its symbolic meaning is similar to that of text P, except that Q represents text Q, and the rest represent similarities with this text, which can make their meaning clear, so we will not elaborate on them one by one here;

[0099] For example, in Keras, the code described above is implemented as follows:

[0100] w_embedding=embedding_layer(w_input)

[0101] c_embedding=embedding_layer(c_input)

[0102] rad_embedding=rad_embedding_layer(rad_input)

[0103] w_r=Bidirectional(LSTM(300, return_sequences='True', dropout=0.2), merge_mode='sum')(w_embedding)

[0104] c_r=Bidirectional(LSTM(300, return_sequences='True', dropout=0.2), merge_mode='sum')(c_embedding)

[0105] rad_embedding2=Dense(300)(rad_embedding)

[0106] rad_r=Bidirectional(LSTM(300, return_sequences='True', dropout=0.2), merge_mode='sum')(rad_embedding2)

[0107] Among them, w_input, c_input and rad_input represent text input at word granularity, text input at character granularity and text input at radical granularity respectively.

[0108] S30602, Hierarchical Dilated Convolutional Network Coding: Encode the character context representations, word context representations, and radical context representations of two texts using a hierarchical dilated convolutional network to generate dilated convolutional character text representations, dilated convolutional word text representations, and dilated convolutional radical text representations of the corresponding texts;

[0109] Specifically, the hierarchical dilated convolutional network consists of three layers of dilated convolutional networks with dilation rates of 1, 2, and 3 respectively. The character / word / radical context representation is passed through the three layers of dilated convolutional networks to obtain the character / word / radical representation after the first convolution layer, the character / word / radical representation after the second convolution layer, and the character / word / radical representation after the third convolution layer. Then, they are connected according to the characters, words, and radicals to generate the dilated convolution character / word / radical text representation. For the convenience of explanation, the character context representation P of the text P is used here. c' For example, the calculation formula is as follows:

[0110]

[0111] Among them, Dilated_CNN represents a one-dimensional dilated convolutional neural network; dilation_rate is the dilation rate; Represents the character representation of the text P after the first layer of convolution; Represents the character representation of the text P after the second convolution layer; Represents the character representation of the text P after the third convolution layer; Represents the character text representation of the text P after dilation and convolution; [;] represents the connection operation; similarly, for P w' 、P r' , Q c' , Q w' , Q r' Process, get Its symbolic meaning is Similarly, the only difference is that Q represents text Q, superscript w represents word, and superscript r represents radical. By analogy, the meaning can be made clear, so I will not go into details here;

[0112] S30603, Feature Connection: For text P, the text semantic encoding layer uses the connection operation to respectively connect P c' and P w' and P r' and Perform the join to generate the character representation of text P, the word representation of text P, and the radical representation of text P. The specific formula is as follows:

[0113]

[0114] in, Represents the character representation of the text P; The word representation representing the text P; Represents the radical representation of text P; similarly, for text Q, we get and Its meaning is similar to the corresponding symbol of text P, the only difference is that Q represents text Q, which will not be repeated here;

[0115] For example, in Keras, the code described above is implemented as follows:

[0116] w_l=Conv1D(300,3,padding='same',dilation_rate=1,activation='relu')(w_r)

[0117] w_l2=Conv1D(300,3,padding='same',dilation_rate=2,activation='relu')(w_l)

[0118] w_l3=Conv1D(300,3,padding='same',dilation_rate=3,activation='relu')(w_l2)

[0119] w_r=concatenate([w_r,w_l,w_l2,w_l3])

[0120] c_l=Conv1D(300,3,padding='same',dilation_rate=1,activation='relu')(c_r)

[0121] c_l2=Conv1D(300,3,padding='same',dilation_rate=2,activation='relu')(c_l)

[0122] c_l3=Conv1D(300,3,padding='same',dilation_rate=3,activation='relu')(c_l2)

[0123] c_r=concatenate([c_r,c_l,c_l2,c_l3])

[0124] rad_l=Conv1D(300,3,padding='same',dilation_rate=1,activation='relu')(rad_r)

[0125] rad_l2=Conv1D(300,3,padding='same',dilation_rate=2,activation='relu')(rad_l)

[0126] rad_l3=Conv1D(300,3,padding='same',dilation_rate=3,activation='relu')(rad_l2)

[0127] rad_r=concatenate([rad_r,rad_l,rad_l2,rad_l3])

[0128] S307, constructing a multi-correlation feature interaction layer: This layer receives the character representation of the text P in step S306 Word representation of text P Radical representation of text P Character representation of text Q Word representation of text Q and the radical representation of the text Q As input; construct the point product correlation matrix, absolute value subtraction correlation matrix, and multiplication correlation matrix respectively by point multiplication, absolute value subtraction, and multiplication operations; then construct the correlation feature map according to the correlation matrix;

[0129] S30701. Constructing a correlation matrix: The structural diagram for constructing a dot product correlation matrix is ​​as follows: Figure 7 As shown; it takes the character representation of text P, the word representation of text P, the radical representation of text P, the character representation of text Q, the word representation of text Q and the radical representation of text Q as input, and performs dot product of the character representation of text P with the character representation of text Q, the radical representation of text Q and the word representation of text Q, to obtain the dot product correlation matrix of text P characters and text Q characters / radicals / words; performs dot product of the radical representation of text P with the character representation of text Q, the radical representation of text Q and the word representation of text Q, to obtain the dot product correlation matrix of text P radicals and text Q characters / radicals / words; performs dot product of the word representation of text P with the character representation of text Q and the radical representation of text Q, to obtain the dot product correlation matrix of text P words and text Q characters / radicals; taking the dot product of the character representation of text P with the character representation of text Q, the radical representation of text Q and the word representation of text Q as an example, its specific formula is as follows:

[0130]

[0131] in, The subscript a in the matrix indicates that the matrix is ​​calculated by dot product, and the subscript ij indicates the dot product correlation matrix of text P characters and text Q characters. The value at row i and column j in ; The superscripts c and c represent that the matrix is ​​generated according to the character representation of text P and the character representation of text Q respectively; similarly Respectively represent The value at the i-th row and j-th column in the matrix; the superscripts c and r represent that the matrix is ​​generated based on the character representation of text P and the radical representation of text Q, and the superscripts c and w represent that the matrix is ​​generated based on the character representation of text P and the word representation of text Q; Represent the dot product correlation matrix of text P characters and text Q radicals / words respectively; Character representation of text P The character representation at position i in ; Character representation of the text Q The character representation at the j-th position in ; Represents the radical representation of the text Q The radical at the j-th position in represents; Word representation representing text Q The word representation at the jth position in ; The generation method of other point product correlation matrices is similar to it, and we get, Its symbolic meaning is Similarly, by analogy with this, the meaning can be made clear, so I will not elaborate on them here;

[0132] For example, in Keras, the code described above is implemented as follows:

[0133] pc_qc=Dot(axes=-1)([pc,qc])

[0134] pc_qrad=Dot(axes=-1)([pc,qrad])

[0135] pc_qw=Dot(axes=-1)([pc,qw])

[0136] prad_qrad=Dot(axes=-1)([prad,qrad])

[0137] prad_qw=Dot(axes=-1)([prad,qw])

[0138] prad_qc=Dot(axes=-1)([prad,qc])

[0139] pw_qc=Dot(axes=-1)([pw,qc])

[0140] pw_qrad=Dot(axes=-1)([pw,qrad])

[0141] Among them, pc represents the character representation of text P; prad represents the radical representation of text P; pw represents the word representation of text P; qc represents the character representation of text Q; qrad represents the radical representation of text Q; and qw represents the word representation of text Q.

[0142] The construction of the multiplication correlation matrix and the construction of the absolute value subtraction correlation matrix are similar to the construction of the dot product correlation matrix; the only difference is the generation method of the correlation matrix. Taking the character representation of text P and the character representation of text Q as an example, the specific formula is as follows:

[0143]

[0144] Among them, ⊙ represents element-wise dot product; |-| represents absolute value subtraction; TimeDistribution represents the use of fully connected neural network encoding (Dense) at each time step; tanh represents the tanh function; and The superscript meaning is the same as The subscripts mul and sub respectively represent that the correlation matrix is ​​obtained by multiplication and absolute value subtraction; similar to constructing the dot product correlation matrix; using the same method to encode different inputs, we can get and The meaning of its symbols and construction formula can be obtained by analogy, so I will not go into details here;

[0145] For example, in Keras, the code described above is implemented as follows:

[0146] pc_qc_multi=multi_attn(pc,qc)

[0147] pc_qrad_multi=multi_attn(pc,qrad)

[0148] pc_qw_multi=multi_attn(pc,qw)

[0149] prad_qrad_multi=multi_attn(prad,qrad)

[0150] prad_qc_multi=multi_attn(prad,qc)

[0151] prad_qw_multi=multi_attn(prad,qw)

[0152] pw_qc_multi=multi_attn(pw,qc)

[0153] pw_qrad_multi=multi_attn(pw,qrad)

[0154] pc_qc_abs=abs_attn(pc,qc)

[0155] pc_qrad_abs=abs_attn(pc,qrad)

[0156] pc_qw_abs=abs_attn(pc,qw)

[0157] prad_qrad_abs=abs_attn(prad,qrad)

[0158] prad_qc_abs=abs_attn(prad,qc)

[0159] prad_qw_abs=abs_attn(prad,qw)

[0160] pw_qc_abs=abs_attn(pw,qc)

[0161] pw_qrad_abs=abs_attn(pw,qrad)

[0162] Among them, multi_attn and abs_attn are the defined multiplication and absolute value subtraction functions, and their codes are as follows:

[0163]

[0164] S30702. Constructing a correlation feature map: The multi-correlation feature interaction layer stacks the correlation matrices obtained in step S30701 to construct a correlation feature map. The specific formula is as follows:

[0165]

[0166] Taking the dot product correlation matrix as an example, the dot product correlation matrix of text P characters and text Q characters / radicals, the dot product correlation matrix of text P radicals and text Q characters / radicals, the dot product correlation matrix of text P words and text Q characters / radicals, the dot product correlation matrix of text P characters and text Q words, and the dot product correlation matrix of text P radicals and text Q words are stacked to construct four dot product-based correlation feature maps, namely A'1, A'2, A'3, and A'4; similarly, for the multiplication correlation matrix and the absolute value subtraction correlation matrix, four multiplication-based correlation feature maps, namely M'1, M'2, M'3, and M'4, and four absolute value subtraction-based correlation feature maps, namely U'1, U'2, U'3, and U'4, are formed respectively.

[0167] For example, in Keras, the code described above is implemented as follows:

[0168] pc=Lambda(stack_dim1)([pc_qc,pc_qrad])

[0169] prad=Lambda(stack_dim1)([prad_qc,prad_qrad])

[0170] pw=Lambda(stack_dim1)([pw_qc,pw_qrad])

[0171] qw=Lambda(stack_dim1)([pc_qw,prad_qw])

[0172] pc_multi=Lambda(stack_dim1)([pc_qc_multi,pc_qrad_multi])

[0173] prad_multi=Lambda(stack_dim1)([prad_qc_multi,prad_qrad_multi])

[0174] pw_multi=Lambda(stack_dim1)([pw_qc_multi,pw_qrad_multi])

[0175] qw_multi=Lambda(stack_dim1)([pc_qw_multi,prad_qw_multi])

[0176] pc_abs=Lambda(stack_dim1)([pc_qc_abs,pc_qrad_abs])

[0177] prad_abs=Lambda(stack_dim1)([prad_qc_abs,prad_qrad_abs])

[0178] pw_abs=Lambda(stack_dim1)([pw_qc_abs,pw_qrad_abs])

[0179] qw_abs=Lambda(stack_dim1)([pc_qw_abs,prad_qw_abs])

[0180] Among them, the code of stack_dim1 is as follows:

[0181] def stack_dim1(a):

[0182] x = K.stack(a,axis=1)

[0183] return x

[0184] S308: Construct a three-dimensional convolutional feature encoding layer: further stack the correlation feature map based on dot multiplication, the correlation feature map based on multiplication, and the correlation feature map based on absolute value subtraction obtained in step S307 to construct a correlation cube; then encode the correlation cube through a three-dimensional convolutional neural network to generate a matching representation of the input text pair;

[0185] S30801. Constructing a correlation cube: The three-dimensional convolutional feature encoding layer first stacks the correlation feature map based on dot multiplication, the correlation feature map based on multiplication, and the correlation feature map based on absolute value subtraction obtained in step S307 to construct a correlation cube. The specific formula is as follows:

[0186]

[0187] Where F represents the correlation cube, stack represents the stacking operation, and the meanings of other symbols are the same as those in formula (6);

[0188] S30802, 3D Convolutional Neural Network Encoding: Use a 3D convolutional neural network to encode the relevance cube to generate a matching representation of the input text pair. The specific formula is as follows:

[0189] F′=Conv3d(F) (19)

[0190] Among them, F′ represents the matching representation of the input text pair, and Conv3d represents the three-dimensional convolutional neural network.

[0191] For example, in Keras, the code described above is implemented as follows:

[0192] stack2=Lambda(stack_dim1)([pc,prad,pw,qw,pc_multi,prad_multi,pw_multi,qw_multi,pc_abs,prad_abs,pw_abs,qw_abs])

[0193] conv_sim=Conv3D(32, kernel_size=[3,3,3], strides=[2,2,2], activation='relu', padding='same')(stack2)

[0194] S309, construct prediction layer: The prediction layer takes the matching representation of the input text pair in step S308 as input, flattens it using the Flatten method, and then encodes it using a three-layer fully connected neural network to predict the matching degree y of the input text pair. pred and compare it with the preset threshold. If y pred If the value is greater than or equal to the threshold, the text is considered to be semantically matched, otherwise it is not matched.

[0195] S4. Training the text matching medical question answering model: using the text matching medical question answering model training dataset obtained in step S2 to train the text matching medical question answering model constructed in step S3;

[0196] S401, constructing a loss function: using the modified binary cross entropy as the loss function based on the matching degree of the input text pair obtained in step 309, the formula is as follows:

[0197]

[0198] Where θ(x) is the unit step function, thre is the threshold value, which is set to 0.6 in the present invention, and L represents the modified cross entropy formula; y pred Represents the matching degree of the predicted input text pair; y true The true label representing whether the input text pair matches;

[0199] For example, in Keras, the code described above is implemented as follows:

[0200] m=0.6

[0201] theta=lambda t:(K.sign(t)+1.) / 2.

[0202] Loss=-(1-theta(y_true-m)*theta(y_pred-m)-theta(1-m-y_true)*theta(1-m-y_pred))*(y_true*K.log(y_pred+1e-8)+(1y_true)*K.log(1-y_pred+1e-8))

[0203] S402. Construct an optimization function: Use the Adam algorithm as the optimization function of the model; all hyperparameters are set to the default values ​​in Keras;

[0204] For example, the optimization function and its settings described above are expressed in Keras using the following code:

[0205] optim=Keras.optimizers.Aadm()

[0206] When the model is not fully trained, it needs to be trained on the training dataset to optimize the model parameters. Once the model is trained, it predicts the matching degree of the input text pair. The proposed model can achieve excellent results on the medical question-answering dataset.

[0207] Example 3:

[0208] The medical intelligent question-answering device based on radical modeling text matching according to Example 2 includes a text matching medical question-answering knowledge base construction unit, a text matching medical question-answering model training data set generation unit, a text matching medical question-answering model construction unit, and a text matching medical question-answering model training unit, which respectively implement the functions of steps S1, S2, S3, and S4 in the medical intelligent question-answering method based on radical modeling text matching. The specific functions of each unit are as follows:

[0209] A text matching medical question and answer knowledge base construction unit is used to obtain a large amount of text pair data and then pre-process the data to obtain a text matching medical question and answer knowledge base construction unit that meets the training requirements;

[0210] The training dataset generation unit for the text matching medical question-answering model uses a text pair in the text matching medical question-answering knowledge base to construct positive training examples if the text pair has consistent semantics; otherwise, it constructs negative training examples. A large amount of positive and negative data is mixed to generate a training dataset.

[0211] A text matching medical question-answering model construction unit is used to construct a word mapping conversion table, a radical mapping conversion table, an input encoding module, a word vector mapping layer, a radical vector mapping layer, a text semantic encoding layer, a multi-correlation feature interaction layer, a three-dimensional convolutional feature encoding layer, and a prediction layer;

[0212] The text matching medical question-answering model training unit is used to construct the loss function and optimization function required in the model training process and complete the model training.

[0213] Example 4:

[0214] Based on the storage medium of Example 2, multiple instructions are stored therein, and the instructions are loaded by a processor to execute the steps of the medical intelligent question-answering method based on radical modeling and text matching of Example 2.

[0215] Example 5:

[0216] Based on the electronic device of embodiment 4, the electronic device includes: the storage medium of embodiment 4; and a processor for executing instructions in the storage medium of embodiment 4.

[0217] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that the technical solutions described in the above embodiments may still be modified, or some or all of the technical features therein may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A medical intelligent question-answering method based on radical modeling and text matching, characterized by: The method comprises the following steps: S1. Construct a text-matching medical question-answering knowledge base: Collect frequently asked medical question-answering texts from the Internet and pre-process the texts to construct a text-matching medical question-answering knowledge base; S2. Constructing a training dataset for a text-matching medical question-answering model: For text pairs in the text-matching medical question-answering knowledge base obtained in step S1, if their semantics are consistent, the text pairs are used to construct training positive examples; On the contrary, it is used to construct training negative examples; a large amount of positive and negative data are mixed to obtain a training data set; S3. Build a text-matching medical question-answering model: Build a text-matching medical question-answering model based on radicals; S4. Training the text matching medical question answering model: training the text matching medical question answering model constructed in step S3 on the text matching medical question answering model training dataset obtained in step S2; The specific steps for building a text matching medical question-answering model in step S3 are as follows: S301, constructing a word mapping conversion table; S302, constructing a radical mapping conversion table; S303, constructing an input module; S304, constructing a word vector mapping layer; S305, constructing a radical vector mapping layer; S306, constructing a text semantic encoding layer: This layer encodes the character embedding representation and word embedding representation output by the word vector mapping layer and the radical embedding representation output by the radical vector mapping layer to obtain a character representation of the text, a word representation of the text, and a radical representation of the text; S307, constructing a multi-correlation feature interaction layer: This layer takes the character representation of the text, the word representation of the text, and the radical representation of the text as input; constructs a dot product correlation matrix, an absolute value subtraction correlation matrix, and a multiplication correlation matrix using dot product, absolute value subtraction, and multiplication operations respectively; then constructs a correlation feature map based on the correlation matrix; S308, constructing a three-dimensional convolutional feature encoding layer: stacking the correlation feature maps to construct a correlation cube, and further encoding the correlation cube using a three-dimensional convolutional neural network to generate a matching representation of the input text pair; S309, build prediction layer: use Flatten method to flatten the matching representation of input text pairs, and then encode it through a three-layer fully connected neural network to predict the matching degree y of the input text pairs pred , and compare it with the preset threshold. If it is greater than or equal to the threshold, the text is considered to be semantically matched, otherwise it is not matched.

2. The medical intelligent question-answering method based on radical modeling and text matching according to claim 1 is characterized in that: The specific steps of constructing the text matching medical question answering model in step S3 are as follows: S301, constructing a word mapping conversion table: the mapping rule is to start with the number 1, and then sort each word in the order in which it is entered into the word table, thereby forming the required word mapping conversion table; Afterwards, Word2Vec is used to train the word vector model to obtain the word vector matrix of each word; S302, constructing a radical mapping conversion table: starting with the number 1, and then sorting each radical in the order in which it is entered into the radical table, thereby forming the required radical mapping conversion table; then, using Word2Vec to train a radical vector model to obtain a radical vector matrix for each radical; S303, constructing an input module: The input module includes six inputs; for each text in the training data set or the text to be predicted, preprocess it using the corresponding modules in S1 and S2 to obtain the character sequence txtP_char of text P, the character sequence txtQ_char of text Q, the word sequence txtP_word of text P, the word sequence txtQ_word of text Q, the radical sequence txtP_radical of text P, and the radical sequence txtQ_radical of text Q respectively; for each character, word, and radical in the input text, convert it into a corresponding digital identifier according to the word mapping conversion table and the radical mapping conversion table; S304, constructing a word vector mapping layer: Initializing the weight parameters of the current layer by loading the word vector matrix trained in the word mapping conversion table construction step; for the input texts txt P_char, txt Q_char and txt P_word, txt Q_word, obtaining their corresponding vectors txt P_char_embed, txt Q_char_embed, txt P_word_embed, txt Q_word_embed; for each text in the text matching medical question and answer knowledge base, the text word information is converted into vector form, i.e., character embedding representation and word embedding representation, by means of word vector mapping; S305. Construct a radical vector mapping layer: Initialize the weight parameters of the current layer by loading the radical vector matrix trained in the step of constructing the radical mapping conversion table; for the input texts txt P_radical and txt Q_radical, obtain their corresponding vectors txt P_radical_embed and txt Q_radical_embed; For each text in the text matching medical question and answer knowledge base, the text radical information is converted into a vector form, i.e., a radical embedding representation, through radical vector mapping.

3. The medical intelligent question-answering method based on radical modeling and text matching according to claim 2 is characterized in that: The text semantic coding layer construction process in step S306 is as follows: S306. Constructing a text semantic encoding layer: This layer receives as input the character embedding representation, word embedding representation output by the word vector mapping layer, and the radical embedding representation output by the radical vector mapping layer; first, a bidirectional long short-term memory (BiLSTM) network is used to encode the character embedding representation and word embedding representation, respectively, to generate a character context representation and a word context representation; simultaneously, a fully connected neural network is used to encode the radical embedding representation, which is then passed to the BiLSTM to generate a radical context representation; then, a hierarchical dilated convolutional network is further used to encode the representation to obtain a dilated convolutional character text representation, a dilated convolutional word text representation, and a dilated convolutional radical text representation; and these are connected with the corresponding context representation to generate a character representation of the text, a word representation of the text, and a radical representation of the text; S30601, BiLSTM feature extraction: The text semantic encoding layer first uses BiLSTM to encode the character embedding representations and word embedding representations of the two texts respectively to generate character context representations and word context representations. For the radical embedding representation, it is first encoded using a fully connected neural network and then passed to BiLSTM to generate the radical context representation. For text P, the specific operation is described as follows: Where N is the length of the text; represents the character embedding representation of the text P at the i-th position under the character granularity c; Represents the word embedding representation of the text P at the jth position under the word granularity w; represents the radical embedding representation of the text P at the mth position under the radical granularity r; Dense represents the fully connected neural network encoding; and Represent the character context representation of text P, the word context representation of text P and the radical context representation of text P respectively; for text Q, the character context representation Q of text Q is obtained respectively c' , the word context representation Q of text Q w' and the radical context of text Q represents Q r' ; S30602, Hierarchical Dilated Convolutional Network Coding: Encode the character context representations, word context representations, and radical context representations of two texts using a hierarchical dilated convolutional network to generate dilated convolutional character text representations, dilated convolutional word text representations, and dilated convolutional radical text representations of the corresponding texts; The hierarchical dilated convolutional network consists of three layers of dilated convolutional networks with dilation rates of 1, 2, and 3, respectively. The character / word / radical context representation is passed through the three layers of dilated convolutional networks to obtain the character / word / radical representation after the first convolution layer, the character / word / radical representation after the second convolution layer, and the character / word / radical representation after the third convolution layer. These representations are then concatenated according to the characters, words, and radicals to generate the dilated convolution text representation of the characters / words / radicals. The calculation formula is as follows: Among them, Dilated_CNN represents a one-dimensional dilated convolutional neural network; dilation_rate is the dilation rate; Represents the character representation of the text P after the first layer of convolution; Represents the character representation of the text P after the second convolution layer; Represents the character representation of the text P after the third convolution layer; Represents the character text representation of the text P after dilation convolution; [;] represents the connection operation; w' 、P r' , Q c' , Q w' , Q r' Processing, get the word text representation after the text P expansion convolution Radical text representation of text P after dilated convolution Character text representation after text Q dilation convolution Text Q word text representation after dilated convolution Radical text representation after text Q dilation convolution S30603, Feature Connection: For text P, the text semantic encoding layer uses the connection operation to respectively connect P c' and P w' and P r' and Perform the join to generate the character representation of text P, the word representation of text P, and the radical representation of text P. The specific formula is as follows: in, Represents the character representation of the text P; The word representation representing the text P; Represents the radical representation of text P; for text Q, obtains the character representation of text Q Word representation of text Q and the radical representation of the text Q 4. The medical intelligent question-answering method based on radical modeling and text matching according to claim 2 is characterized in that: The process of constructing the multi-correlation feature interaction layer in step S307 is as follows: S307, constructing a multi-correlation feature interaction layer: This layer receives the character representation of the text P in step S306 Word representation of text P Radical representation of text P Character representation of text Q Word representation of text Q and the radical representation of the text Q As input; construct the point product correlation matrix, absolute value subtraction correlation matrix, and multiplication correlation matrix by point multiplication, absolute value subtraction, and multiplication operations respectively; then construct the correlation feature map according to the correlation matrix; S30701. Construct a correlation matrix: take the character representation of text P, the word representation of text P, the radical representation of text P, the character representation of text Q, the word representation of text Q and the radical representation of text Q as input, perform dot product of the character representation of text P with the character representation of text Q, the radical representation of text Q and the word representation of text Q, respectively, to obtain a dot product correlation matrix of text P characters and text Q characters / radicals / words; perform dot product of the radical representation of text P with the character representation of text Q, the radical representation of text Q and the word representation of text Q, respectively, to obtain a dot product correlation matrix of text P radicals and text Q characters / radicals / words; perform dot product of the word representation of text P with the character representation of text Q and the radical representation of text Q, respectively, to obtain a dot product correlation matrix of text P words and text Q characters / radicals; the specific formula is as follows: in, The subscript a in the matrix indicates that the matrix is ​​calculated by dot product, and the subscript ij indicates the dot product correlation matrix of text P characters and text Q characters. The value at row i and column j in ; The superscripts c and c represent that the matrix is ​​generated according to the character representation of text P and the character representation of text Q respectively; Respectively represent The value at the i-th row and j-th column in the matrix; the superscripts c and r represent that the matrix is ​​generated based on the character representation of text P and the radical representation of text Q, and the superscripts c and w represent that the matrix is ​​generated based on the character representation of text P and the word representation of text Q; Represent the dot product correlation matrix of text P characters and text Q radicals / words respectively; Character representation of text P The character representation at position i in ; Character representation of the text Q The character representation at the j-th position in ; Represents the radical representation of the text Q The radical at the j-th position in represents; Word representation representing text Q The word representation at the jth position in the text is obtained in sequence, and the correlation matrix of the text P radical and the text Q character dot product is obtained Dot product correlation matrix of text P radical and text Q radical The dot product correlation matrix of text P radical and text Q word The dot product correlation matrix of text P words and text Q characters The dot product correlation matrix of the words in text P and the radicals in text Q The specific formulas for constructing the multiplication correlation matrix and the absolute value subtraction correlation matrix are as follows: Among them, ⊙ represents element-wise dot product; |-| represents absolute value subtraction; Dense represents fully connected neural network encoding; TimeDistributed represents the use of fully connected neural network encoding at each time step; tanh represents the tanh function; and The superscript meaning is the same as The subscripts mul and sub respectively represent that the correlation matrix is ​​obtained by multiplication and absolute value subtraction; different inputs are encoded to obtain the multiplication correlation matrix of text P characters and text Q radicals in turn. Multiplication correlation matrix of text P characters and text Q words Multiplication correlation matrix of text P radical and text Q character Multiplication correlation matrix of text P radical and text Q radical Multiplication correlation matrix of text P radical and text Q word Multiplication correlation matrix of text P words and text Q characters Multiplication correlation matrix of words in text P and radicals in text Q Correlation matrix of absolute value subtraction of text P characters and text Q radicals Absolute value subtraction correlation matrix of text P characters and text Q words Correlation matrix of text P radical and text Q character absolute value subtraction Correlation matrix of absolute value subtraction of text P radical and text Q radical Correlation matrix of text P radical and text Q word absolute value subtraction Correlation matrix of absolute value subtraction between words in text P and characters in text Q Correlation matrix of absolute value subtraction of words in text P and radicals in text Q S30702. Constructing a correlation feature map: The multi-correlation feature interaction layer stacks the correlation matrices obtained in step S30701 to construct a correlation feature map. The specific formula is as follows: The dot product correlation matrix of text P characters and text Q characters / radicals, the dot product correlation matrix of text P radicals and text Q characters / radicals, the dot product correlation matrix of text P words and text Q characters / radicals, the dot product correlation matrix of text P characters and text Q words, and the dot product correlation matrix of text P radicals and text Q words are stacked to construct four dot product-based correlation feature maps, namely A'1, A'2, A'3, and A'4; for the multiplication correlation matrix and the absolute value subtraction correlation matrix, four multiplication-based correlation feature maps, namely M'1, M'2, M'3, and M'4, and four absolute value subtraction-based correlation feature maps, namely U'1, U'2, U'3, and U'4, are formed respectively.

5. The medical intelligent question-answering method based on radical modeling and text matching according to claim 4 is characterized in that: The process of constructing the three-dimensional convolutional feature coding layer in step S308 is as follows: S308: Construct a three-dimensional convolutional feature encoding layer: further stack the correlation feature map based on dot multiplication, the correlation feature map based on multiplication, and the correlation feature map based on absolute value subtraction obtained in step S307 to construct a correlation cube; then encode the correlation cube through a three-dimensional convolutional neural network to generate a matching representation of the input text pair; S30801. Constructing a correlation cube: The three-dimensional convolutional feature encoding layer first stacks the correlation feature map based on dot multiplication, the correlation feature map based on multiplication, and the correlation feature map based on absolute value subtraction obtained in step S307 to construct a correlation cube. The specific formula is as follows: Where F represents the correlation cube, stack represents the stacking operation, and the meanings of other symbols are the same as those in formula (6); S30802, 3D Convolutional Neural Network Encoding: Use a 3D convolutional neural network to encode the relevance cube to generate a matching representation of the input text pair. The specific formula is as follows: F′=Conv3d(F) (8) Among them, F′ represents the matching representation of the input text pair, and Conv3d represents the three-dimensional convolutional neural network.

6. The medical intelligent question-answering method based on radical modeling and text matching according to claim 1 or 2, characterized in that: The specific steps of step S4: training the text matching medical question answering model are as follows: S401, constructing a loss function: using the modified binary cross entropy as the loss function based on the matching degree of the input text pair obtained in step S309, the formula is as follows: Where θ(x) is the unit step function, thre is the threshold, which is set to 0.6, and L represents the modified cross entropy formula; y pred Represents the matching degree of the predicted input text pair; y true The true label representing whether the input text pair matches; S402. Construct an optimization function: Use the Adam algorithm as the optimization function of the model; all hyperparameters are set to the default values ​​in Keras; When the method model has not been fully trained, it needs to be trained on the training dataset to optimize the model parameters; when the model training is completed, the model predicts the matching degree of the input text pair.

7. A medical intelligent question-answering device based on radical modeling and text matching, which implements the medical intelligent question-answering method based on radical modeling and text matching according to any one of claims 1 to 6, characterized in that: The device comprises, A text matching medical question and answer knowledge base construction unit is used to obtain a large amount of text pair data and then pre-process the data to obtain a text matching medical question and answer knowledge base construction unit that meets the training requirements; A text matching medical question answering model training dataset generation unit is used to construct training positive examples for text pairs in the text matching medical question answering knowledge base if their semantics are consistent; On the contrary, it is used to construct training negative examples; a large amount of positive and negative data are mixed to obtain a training data set; A text matching medical question-answering model construction unit is used to construct a word mapping conversion table, a radical mapping conversion table, an input encoding module, a word vector mapping layer, a radical vector mapping layer, a text semantic encoding layer, a multi-correlation feature interaction layer, a three-dimensional convolutional feature encoding layer, and a prediction layer; The text matching medical question-answering model training unit is used to construct the loss function and optimization function required in the model training process and complete the model training.

8. A storage medium storing a plurality of instructions, characterized in that: The instructions are loaded by a processor to execute the medical intelligent question-answering method based on radical modeling text matching according to any one of claims 1-6.

9. An electronic device, characterized in that: The electronic device comprises: the storage medium according to claim 8; and a processor for executing instructions in the storage medium.

Citation Information

Patent Citations

  • Text semantic matching method and device for intelligent questions and answers of fire safety knowledge

    CN114547256A

  • Text classification method, text classification apparatus, electronic device, storage medium and program product

    US20230126826A1