Medical text segmentation method and device based on reading comprehension model
By applying the reading comprehension model in medical text segmentation, the problem of slow training decoding speed caused by the failure to effectively consider the meaning of text chunking in the prior art is solved, and a more efficient text segmentation process is achieved.
Patent Information
- Application Number
- CN202210523902.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-14
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2042-05-14
AI Technical Summary
The existing text segmentation method based on sequence labeling fails to effectively consider the specific meaning of each chunk during training and prediction, resulting in slower training and prediction speeds.
The medical text segmentation method based on reading comprehension model is adopted, and the problem design and characterization construction of the slicing text objects are designed and characterized, and information encoding and decoding is used using the encoder network and attention mechanism to generate the final label generation result.
The representational capabilities of the model are improved by taking into account the actual meaning of each chunk and speeding up training and decoding by using attention mechanisms.
Smart Images

Figure CN114841159B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of text processing, and in particular relates to a medical text segmentation method and device based on a reading comprehension model. Background Art
[0002] Text segmentation refers to dividing a long document into different chunks according to requirements. Text segmentation usually uses a sequence labeling model to mark each character. This method first defines BIE labels for each category of chunks in advance, representing the characters at the beginning (B), the middle (I) and the end (E) of the chunk, while the O label represents the characters outside the chunk. Then, a bidirectional recurrent neural network model is trained to predict the corresponding label for each character. Finally, the prediction results are post-processed and the BIE labels are merged to obtain the final segmentation result.
[0003] The existing text segmentation method based on sequence annotation only considers the text context information, but does not consider the specific meaning of each block. At the same time, when using the bidirectional recurrent neural network model, the hidden layer representation of each character needs to rely on context information during training and prediction, resulting in slow training and prediction speeds. How to overcome the defect of slow training and decoding speed caused by the traditional sequence annotation method without considering the actual meaning of each block is a technical problem that needs to be solved urgently. Summary of the invention
[0004] To this end, the present invention provides a medical text segmentation method and device based on a reading comprehension model to solve the problem of slow training decoding speed caused by the traditional sequence labeling method not considering the actual meaning of each block.
[0005] In order to achieve the above object, the present invention provides the following technical solution: a medical text segmentation method based on a reading comprehension model, comprising:
[0006] S1. Design questions and construct representations of reading comprehension models based on segmented text objects;
[0007] S2, preprocessing and characterizing the paragraphs contained in the text object to be segmented;
[0008] S3, inputting the questions designed in S1 and the paragraphs in S2 into the encoder network respectively, using the encoder network to encode information, obtaining encoding representations of the designed questions and paragraphs respectively, and outputting the reading comprehension model through the attention mechanism;
[0009] S4, performing softmax calculation on the weighted representation of the reading comprehension model, outputting the probability distribution in the candidate label set at each moment, selecting the label corresponding to the maximum probability as the output result at the corresponding moment, and decoding in sequence to obtain the final label generation result;
[0010] S5. Post-process the label generation result obtained by decoding to obtain a segmentation result of the text object to be segmented.
[0011] As a preferred solution of the medical text segmentation method based on the reading comprehension model, step S1 includes:
[0012] S11, construct the problem;
[0013] S12, pre-processing the question constructed in S11 by word segmentation and sub-word segmentation to obtain a question sequence;
[0014] S13. The question sequence obtained in S12 is represented by the pre-trained language model Bert.
[0015] As a preferred solution of the medical text segmentation method based on the reading comprehension model, step S2 includes:
[0016] S21, using the text object to be segmented as training corpus, and using the BPE algorithm to perform sub-word segmentation on the sentences in the training corpus to obtain a paragraph sequence;
[0017] S22, representing the paragraph sequence obtained in S21 by using the pre-trained language model Bert.
[0018] As a preferred solution of the medical text segmentation method based on the reading comprehension model, step S3 includes:
[0019] S31, defining an encoder calculation unit for a question sequence and a paragraph sequence based on a self-attention mechanism, and encoding each word of the question sequence and the paragraph sequence through the encoder;
[0020] S32, the calculated attention weight distribution between the question sequence and the paragraph sequence encoding representation;
[0021] S33. Obtain the cumulative sum of the attention weight distribution to obtain the final weighted representation of the reading comprehension model.
[0022] As a preferred solution of the medical text segmentation method based on the reading comprehension model, step S4 includes:
[0023] S41, performing a linear transformation on the final weighted representation of the reading comprehension model;
[0024] S42, output the probability distribution of the obtained linear transformation result in the candidate label set at each moment through softmax;
[0025] S43: Select the label corresponding to the maximum probability as the output result at the corresponding moment, and decode them in sequence to obtain the final label generation result.
[0026] As a preferred solution of the medical text segmentation method based on the reading comprehension model, in step S5, post-processing the label generation result obtained by decoding includes extracting the marked parts according to the label result and merging them to obtain the final segmentation result.
[0027] The present invention also provides a medical text segmentation device based on a reading comprehension model, comprising:
[0028] A question design and representation unit, which is used to design and construct the representation of the reading comprehension model based on the segmented text objects;
[0029] A paragraph processing and characterization unit, used for preprocessing and characterizing the paragraphs contained in the text object to be segmented;
[0030] An information encoding unit, used to input the designed question and paragraph into an encoder network respectively, use the encoder network to encode information, obtain encoded representations of the designed question and paragraph respectively, and output the reading comprehension model through an attention mechanism;
[0031] A label generation unit is used to perform softmax calculation on the weighted representation of the reading comprehension model, output the probability distribution of each moment in the candidate label set, select the label corresponding to the maximum probability as the output result at the corresponding moment, and decode in sequence to obtain the final label generation result;
[0032] The segmentation result processing unit is used to post-process the label generation result obtained by decoding to obtain the segmentation result of the text object to be segmented.
[0033] As a preferred solution of the medical text segmentation device based on the reading comprehension model, the question design representation unit includes:
[0034] A question construction subunit, used for question construction;
[0035] The question sequence generation subunit is used to perform word segmentation and sub-word segmentation preprocessing on the constructed questions to obtain a question sequence;
[0036] The question sequence representation subunit is used to represent the obtained question sequence through the pre-trained language model Bert.
[0037] As a preferred solution of the medical text segmentation device based on the reading comprehension model, the paragraph processing representation unit includes:
[0038] A paragraph sequence generation subunit is used to use the text object to be segmented as training corpus, and use the BPE algorithm to perform sub-word segmentation on the sentences in the training corpus to obtain a paragraph sequence;
[0039] The paragraph sequence representation subunit is used to represent the obtained paragraph sequence through the pre-trained language model Bert.
[0040] As a preferred solution of the medical text segmentation device based on the reading comprehension model, the information encoding unit includes:
[0041] An encoding representation subunit, used for the encoder calculation unit defining the question sequence and paragraph sequence based on the self-attention mechanism, encoding and representing each word of the question sequence and paragraph sequence through the encoder;
[0042] The attention weight subunit is used to calculate the attention weight distribution between the encoded representations of the question sequence and the paragraph sequence;
[0043] The weighted representation subunit is used to obtain the cumulative sum of the attention weight distribution to obtain the final weighted representation of the reading comprehension model.
[0044] As a preferred solution of the medical text segmentation device based on the reading comprehension model, the label generation unit includes:
[0045] A linear transformation subunit, used for performing a linear transformation on the final weighted representation of the reading comprehension model;
[0046] The softmax processing subunit is used to output the probability distribution of the candidate label set at each moment through the softmax of the obtained linear transformation result;
[0047] The label generation result decoding subunit is used to select the label corresponding to the maximum probability as the output result at the corresponding moment, and decode it in sequence to obtain the final label generation result.
[0048] As a preferred solution of the medical text segmentation device based on the reading comprehension model, the segmentation result processing unit includes:
[0049] The post-processing subunit is used to extract the marked parts according to the label results and merge them to obtain the final segmentation results.
[0050] The present invention has the following advantages: designing questions and constructing representations of a reading comprehension model according to segmented text objects; preprocessing and representing paragraphs contained in the text object to be segmented; inputting the designed questions and paragraphs into the encoder network respectively, using the encoder network to encode information, obtaining the encoding representations of the designed questions and paragraphs respectively, and outputting the reading comprehension model through the attention mechanism; performing softmax calculation on the weighted representation of the reading comprehension model, outputting the probability distribution in the candidate tag set at each moment, selecting the tag corresponding to the maximum probability as the output result at the corresponding moment, and decoding in sequence to obtain the final tag generation result; post-processing the decoded tag generation result to obtain the segmentation result of the text object to be segmented. The present invention designs corresponding questions for the content of the text object to be segmented, so that the segmented content is related to the actual meaning of the block; at the same time, the present invention proposes to use an encoder network based on the attention mechanism to replace the recurrent neural network, which not only enhances the representation ability of the model, but also speeds up the training and decoding speed. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the implementation methods of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for the implementation methods or the description of the prior art. Obviously, the drawings in the following description are only exemplary, and for ordinary technicians in this field, other implementation drawings can be derived from the provided drawings without creative work.
[0052] The structures, proportions, sizes, etc. illustrated in this specification are only used to match the contents disclosed in the specification so as to facilitate understanding and reading by persons familiar with the technology. They are not used to limit the conditions under which the present invention can be implemented, and therefore have no substantial technical significance. Any structural modification, change in proportion or adjustment of size shall still fall within the scope of the technical contents disclosed in the present invention without affecting the effects and purposes that can be achieved by the present invention.
[0053] Figure 1 A schematic diagram of a reading comprehension model involved in the medical text segmentation method based on a reading comprehension model provided in Example 1 of the present invention;
[0054] Figure 2 A schematic diagram of a flow chart of a medical text segmentation method based on a reading comprehension model provided in Example 1 of the present invention;
[0055] Figure 3 Schematic diagram of a medical text segmentation device based on a reading comprehension model provided in Example 2 of the present invention. DETAILED DESCRIPTION
[0056] The following is a description of the implementation of the present invention by specific embodiments. People familiar with the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. Obviously, the described embodiments are 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 are within the scope of protection of the present invention.
[0057] Example 1
[0058] See also Figure 1 The reading comprehension model involved in the embodiment of the present invention is composed of three parts, namely, Query, Context and Answer. Among them, Query represents the question in the reading comprehension model framework, Context is a paragraph composed of multiple sentences, which contains Answer. The goal of the reading comprehension model is to search for Answer from Context according to Query.
[0059] The overall idea of the present invention is to segment text objects using a reading comprehension model. First, a question is designed according to the field of the text object to be segmented, and a query of the reading comprehension model is constructed. The context is the entire text object, and the answer is the text segment to be segmented. Then, the (query, context, answer) data is used for model training to realize the construction of the reading comprehension model. Finally, when the reading comprehension model is inferred, the query and context are input into the reading comprehension model to obtain the segmentation result. The following is the detailed content of the present invention.
[0060] See also Figure 2 Embodiment 1 of the present invention provides a medical text segmentation method based on a reading comprehension model, comprising:
[0061] S1. Design questions and construct representations of reading comprehension models based on segmented text objects;
[0062] S2, preprocessing and characterizing the paragraphs contained in the text object to be segmented;
[0063] S3, inputting the questions designed in S1 and the paragraphs in S2 into the encoder network respectively, using the encoder network to encode information, obtaining encoding representations of the designed questions and paragraphs respectively, and outputting the reading comprehension model through the attention mechanism;
[0064] S4, performing softmax calculation on the weighted representation of the reading comprehension model, outputting the probability distribution in the candidate label set at each moment, selecting the label corresponding to the maximum probability as the output result at the corresponding moment, and decoding in sequence to obtain the final label generation result;
[0065] S5. Post-process the label generation result obtained by decoding to obtain a segmentation result of the text object to be segmented.
[0066] In this embodiment, step S1 includes:
[0067] S11, construct the problem;
[0068] S12, pre-processing the question constructed in S11 by word segmentation and sub-word segmentation to obtain a question sequence;
[0069] S13. The question sequence obtained in S12 is represented by the pre-trained language model Bert.
[0070] Specifically, step S1 is to design and construct a query representation for the segmented fields. In S11, the question construction method is as follows:
[0071] Fragment: A fragment of the physical examination text.
[0072] Question: What physical examinations did the patient undergo?
[0073] In step S12, the question obtained in S11 is preprocessed by word segmentation, sub-word segmentation, etc., so as to obtain the question Query sequence Q = [q1, ..., q nq ]; the question sequence Query obtained in step S12 is Q = [q1,…,q nq ] is represented by the pre-trained language model Bert, and we get
[0074] Specifically, the word segmentation algorithm, sub-word segmentation algorithm, and pre-trained language model Bert algorithm used in this embodiment are already existing.
[0075] In this embodiment, step S2 includes:
[0076] S21, using the text object to be segmented as training corpus, and using the BPE algorithm to perform sub-word segmentation on the sentences in the training corpus to obtain a paragraph sequence;
[0077] S22, representing the paragraph sequence obtained in S21 by using the pre-trained language model Bert.
[0078] Specifically, in step S2, the text object Context to be segmented is preprocessed and represented. In order to reduce the impact of out-of-set words on the generation performance, step S21 first uses the BPE method to segment all sentences in the training corpus into sub-words, and obtains the Context sequence C = [c1,…,c nl ]. The Context sequence C obtained in step S21 is C=[c1,…,cnl ] is represented by the pre-trained language model Bert, and we get
[0079] In this embodiment, step S3 includes:
[0080] S31, defining an encoder calculation unit for a question sequence and a paragraph sequence based on a self-attention mechanism, and encoding each word of the question sequence and the paragraph sequence through the encoder;
[0081] S32, the calculated attention weight distribution between the question sequence and the paragraph sequence encoding representation;
[0082] S33. Obtain the cumulative sum of the attention weight distribution to obtain the final weighted representation of the reading comprehension model.
[0083] Specifically, step S3 inputs the preprocessed question sequence Query and the paragraph sequence Context of the text object to be segmented into the encoder network respectively, and the encoder network encodes the information of the question sequence Query and the paragraph sequence Context to obtain the corresponding encoded representation; then the model output is calculated through the attention mechanism.
[0084] Specifically, in step S31, define and For the query and context encoder calculation unit based on the self-attention mechanism, the encoded representation of each word after the encoder can be calculated by the following formula:
[0085]
[0086]
[0087] in, and Represents the encoding representation of the ith word in the nth layer of the Query and Context encoders. The top-level encoding representation hq can be obtained using the encoder network N and hc N .
[0088] In step S32, the attention weight distribution between the Query and Context encoding representations is calculated:
[0089]
[0090] Among them, a ij is the attention weight distribution, It represents the encoding representation of the jth word in the nth layer of the encoder corresponding to Query, Represents the encoded representation of the i-th word in the n-th layer of the encoder corresponding to the Context.
[0091] In step S33, the attention weight distribution a ij Calculate the cumulative sum to get the final weighted representation of the reading comprehension model:
[0092]
[0093] in, is the final weighted representation of the reading comprehension model, a ij is the attention weight distribution, Represents the encoded representation of the i-th word in the n-th layer of the encoder corresponding to the Context.
[0094] In this embodiment, step S4 includes:
[0095] S41, performing a linear transformation on the final weighted representation of the reading comprehension model;
[0096] S42, output the probability distribution of the obtained linear transformation result in the candidate label set at each moment through softmax;
[0097] S43: Select the label corresponding to the maximum probability as the output result at the corresponding moment, and decode them in sequence to obtain the final label generation result.
[0098] Specifically, in step S4, the final weighted representation of the reading comprehension model is used to perform softmax calculation to determine whether it is the beginning and end of the segmented text object. After a layer of linear transformation f, it is as follows:
[0099]
[0100] in, is the input representation of the softmax unit.
[0101] In step S42, the linear transformation is performed to obtain The probability distribution of each moment i in the candidate label set (BIEO, representing the beginning of the segment, the middle of the segment, the end of the segment, and others) is output through softmax:
[0102]
[0103] Among them, Prob i Represents the probability distribution of i in the candidate label set at each moment.
[0104] In step S43, the label corresponding to the maximum probability is selected as the output result at time i:i =Max(Prob i );
[0105] According to the above steps, the final label generation result L[l1,…,l nl ].
[0106] In this embodiment, in step S5, post-processing the label generation result obtained by decoding includes extracting the marked part according to the label result and merging them to obtain the final segmentation result.
[0107] Specifically, according to the label generation result obtained in step S43, the parts marked as B, I, and E (B at the beginning of the block, I in the middle of the block, and E at the end of the block) are extracted and merged to obtain the final segmentation result Answer, L = [a span1 ,…,a spann ]. spani Represents the i-th segment output by the reading comprehension model.
[0108] In summary, the present invention designs and constructs representations of questions for a reading comprehension model based on segmented text objects; performs word segmentation and sub-word segmentation preprocessing on the constructed questions to obtain a question sequence; uses the text object to be segmented as a training corpus, uses the BPE algorithm to perform sub-word segmentation on the sentences in the training corpus, and obtains a paragraph sequence; represents the obtained paragraph sequence through a pre-trained language model Bert; preprocesses and represents the paragraphs contained in the text object to be segmented; inputs the designed questions and paragraphs into the encoder network respectively, uses the encoder network to encode information, obtains the encoded representations of the designed questions and paragraphs respectively, and outputs the reading comprehension model through the attention mechanism; performs a layer of linear transformation on the final weighted representation of the reading comprehension model; outputs the probability distribution of the obtained one-layer linear transformation result in the candidate label set at each moment through softmax; selects the label corresponding to the maximum probability as the output result at the corresponding moment, and decodes them in sequence to obtain the final label generation result. The present invention designs corresponding questions for the content of the text object to be segmented, so that the segmented content is related to the actual meaning of the block; at the same time, the present invention proposes to use an encoder network based on an attention mechanism to replace the recurrent neural network, which not only enhances the representation ability of the model, but also speeds up the training and decoding speeds.
[0109] Example 2
[0110] See also Figure 3 Embodiment 2 of the present invention further provides a medical text segmentation device based on a reading comprehension model, comprising:
[0111] Question design and representation unit 1 is used to design and construct the representation of the reading comprehension model based on the segmented text objects;
[0112] A paragraph processing and characterization unit 2, used for preprocessing and characterizing the paragraphs contained in the text object to be segmented;
[0113] An information encoding unit 3, used to input the designed question and paragraph into the encoder network respectively, use the encoder network to encode information, obtain the encoding representation of the designed question and paragraph respectively, and output the reading comprehension model through the attention mechanism;
[0114] The label generation unit 4 is used to perform softmax calculation on the weighted representation of the reading comprehension model, output the probability distribution of each moment in the candidate label set, select the label corresponding to the maximum probability as the output result at the corresponding moment, and decode in sequence to obtain the final label generation result;
[0115] The segmentation result processing unit 5 is used to post-process the label generation result obtained by decoding to obtain the segmentation result of the text object to be segmented.
[0116] In this embodiment, the problem design representation unit 1 includes:
[0117] A question construction subunit 11, for constructing questions;
[0118] The question sequence generation subunit 12 is used to perform word segmentation and sub-word segmentation preprocessing on the constructed questions to obtain a question sequence;
[0119] The question sequence characterization subunit 13 is used to characterize the obtained question sequence through the pre-trained language model Bert.
[0120] In this embodiment, the paragraph processing representation unit 2 includes:
[0121] The paragraph sequence generating subunit 21 is used to use the text object to be segmented as training corpus, and use the BPE algorithm to perform sub-word segmentation on the sentences in the training corpus to obtain a paragraph sequence;
[0122] The paragraph sequence characterization subunit 22 is used to characterize the obtained paragraph sequence through the pre-trained language model Bert.
[0123] In this embodiment, the information encoding unit 3 includes:
[0124] The encoding representation subunit 31 is used for the encoder calculation unit that defines the question sequence and paragraph sequence based on the self-attention mechanism, and encodes each word of the question sequence and the paragraph sequence through the encoder;
[0125] An attention weight subunit 32, for calculating the attention weight distribution between the obtained question sequence and the paragraph sequence encoding representation;
[0126] The weighted representation subunit 33 is used to obtain the cumulative sum of the attention weight distribution to obtain the final weighted representation of the reading comprehension model.
[0127] In this embodiment, the label generation unit 4 includes:
[0128] A linear transformation subunit 41, used for performing a linear transformation on the final weighted representation of the reading comprehension model;
[0129] A softmax processing subunit 42 is used to output the probability distribution of the obtained linear transformation result in the candidate label set at each moment through softmax;
[0130] The label generation result decoding subunit 43 is used to select the label corresponding to the maximum probability as the output result at the corresponding moment, and decode it in sequence to obtain the final label generation result.
[0131] In this embodiment, the segmentation result processing unit 5 includes:
[0132] The post-processing subunit 51 is used to extract the marked parts according to the label results and merge them to obtain the final segmentation result.
[0133] It should be noted that the information interaction, execution process, etc. between the units / sub-units of the above-mentioned device are based on the same concept as the method embodiment in Example 1 of the present application, and the technical effects they bring are the same as those of the method embodiment of the present application. For specific contents, please refer to the description in the method embodiment shown in the previous part of the present application, and will not be repeated here.
[0134] Example 3
[0135] Embodiment 3 of the present invention provides a non-transitory computer-readable storage medium, in which a program code of a medical text segmentation method based on a reading comprehension model is stored, and the program code includes instructions for executing the medical text segmentation method based on a reading comprehension model of embodiment 1 or any possible implementation thereof.
[0136] The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more available media. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).
[0137] Example 4
[0138] Embodiment 4 of the present invention provides an electronic device, including: a memory and a processor;
[0139] The processor and the memory communicate with each other via a bus; the memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to execute the medical text segmentation method based on the reading comprehension model of Example 1 or any possible implementation thereof.
[0140] Specifically, the processor can be implemented by hardware or by software. When implemented by hardware, the processor can be a logic circuit, an integrated circuit, etc.; when implemented by software, the processor can be a general-purpose processor implemented by reading software codes stored in a memory. The memory can be integrated in the processor or can be located outside the processor and exist independently.
[0141] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center.
[0142] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0143] Although the present invention has been described in detail above by general description and specific embodiments, it is obvious to those skilled in the art that some modifications or improvements can be made on the basis of the present invention. Therefore, these modifications or improvements made on the basis of not departing from the spirit of the present invention all belong to the scope of protection claimed by the present invention.
Claims
1. A medical text segmentation method based on a reading comprehension model, characterized in that: include: S1. Design questions and construct representations of reading comprehension models based on segmented text objects; S2, preprocessing and characterizing the paragraphs contained in the text object to be segmented; S3, inputting the questions designed in S1 and the paragraphs in S2 into the encoder network respectively, using the encoder network to encode information, obtaining encoding representations of the designed questions and paragraphs respectively, and outputting the reading comprehension model through the attention mechanism; S4, performing softmax calculation on the weighted representation of the reading comprehension model, outputting the probability distribution in the candidate label set at each moment, selecting the label corresponding to the maximum probability as the output result at the corresponding moment, and decoding in sequence to obtain the final label generation result; S5. Post-process the label generation result obtained by decoding to obtain a segmentation result of the text object to be segmented.
2. The medical text segmentation method based on the reading comprehension model according to claim 1 is characterized in that: Step S1 includes: S11, construct the problem; S12, pre-processing the question constructed in S11 by word segmentation and sub-word segmentation to obtain a question sequence; S13. The question sequence obtained in S12 is represented by the pre-trained language model Bert.
3. The medical text segmentation method based on the reading comprehension model according to claim 2 is characterized in that: Step S2 includes: S21, using the text object to be segmented as training corpus, and using the BPE algorithm to perform sub-word segmentation on the sentences in the training corpus to obtain a paragraph sequence; S22, representing the paragraph sequence obtained in S21 by using the pre-trained language model Bert.
4. The medical text segmentation method based on the reading comprehension model according to claim 3 is characterized in that: Step S3 includes: S31, defining an encoder calculation unit for a question sequence and a paragraph sequence based on a self-attention mechanism, and encoding each word of the question sequence and the paragraph sequence through the encoder; S32, the calculated attention weight distribution between the question sequence and the paragraph sequence encoding representation; S33. Obtain the cumulative sum of the attention weight distribution to obtain the final weighted representation of the reading comprehension model.
5. The medical text segmentation method based on the reading comprehension model according to claim 4 is characterized in that: Step S4 includes: S41, performing a linear transformation on the final weighted representation of the reading comprehension model; S42, output the probability distribution of the obtained linear transformation result in the candidate label set at each moment through softmax; S43: Select the label corresponding to the maximum probability as the output result at the corresponding moment, and decode them in sequence to obtain the final label generation result.
6. The medical text segmentation method based on the reading comprehension model according to claim 4 is characterized in that: In step S5, post-processing the label generation result obtained by decoding includes extracting the marked part according to the label result and merging them to obtain the final segmentation result.
7. A medical text segmentation device based on a reading comprehension model, characterized in that: include: A question design and representation unit, which is used to design and construct the representation of the reading comprehension model based on the segmented text objects; A paragraph processing and characterization unit, used for preprocessing and characterizing the paragraphs contained in the text object to be segmented; An information encoding unit, used to input the designed question and paragraph into an encoder network respectively, use the encoder network to encode information, obtain encoded representations of the designed question and paragraph respectively, and output the reading comprehension model through an attention mechanism; A label generation unit is used to perform softmax calculation on the weighted representation of the reading comprehension model, output the probability distribution of each moment in the candidate label set, select the label corresponding to the maximum probability as the output result at the corresponding moment, and decode in sequence to obtain the final label generation result; The segmentation result processing unit is used to post-process the label generation result obtained by decoding to obtain the segmentation result of the text object to be segmented.
8. The medical text segmentation device based on the reading comprehension model according to claim 7 is characterized in that: The problem design representation unit includes: A question construction subunit, used for question construction; The question sequence generation subunit is used to perform word segmentation and sub-word segmentation preprocessing on the constructed questions to obtain a question sequence; The question sequence representation subunit is used to represent the obtained question sequence through the pre-trained language model Bert; The paragraph processing representation unit includes: A paragraph sequence generation subunit is used to use the text object to be segmented as training corpus, and use the BPE algorithm to perform sub-word segmentation on the sentences in the training corpus to obtain a paragraph sequence; The paragraph sequence representation subunit is used to represent the obtained paragraph sequence through the pre-trained language model Bert.
9. The medical text segmentation device based on the reading comprehension model according to claim 8, characterized in that: The information encoding unit comprises: The encoding representation subunit is used to define the encoder calculation unit of the question sequence and paragraph sequence based on the self-attention mechanism, and encode each word of the question sequence and paragraph sequence through the encoder; The attention weight subunit is used to calculate the attention weight distribution between the encoded representations of the question sequence and the paragraph sequence; The weighted representation subunit is used to obtain the cumulative sum of the attention weight distribution to obtain the final weighted representation of the reading comprehension model.
10. The medical text segmentation device based on the reading comprehension model according to claim 9, characterized in that: The label generating unit comprises: A linear transformation subunit, used for performing a linear transformation on the final weighted representation of the reading comprehension model; The softmax processing subunit is used to output the probability distribution of the candidate label set at each moment through the softmax of the obtained linear transformation result; The label generation result decoding subunit is used to select the label corresponding to the maximum probability as the output result at the corresponding moment, and decode it in sequence to obtain the final label generation result; The segmentation result processing unit comprises: The post-processing subunit is used to extract the marked parts according to the label results and merge them to obtain the final segmentation results.
Citation Information
Patent Citations
Machine reading comprehension method based on multi-task joint training, and computer storage medium
CN110309305A
Traditional Chinese medicine literature content analysis method and device
CN114444467A