Medical text error correction method, device, storage medium and electronic device
By using the two steps of the use of vocabulary errors and semantic errors to correct the model in the medical text errors, the problem of not high accuracy of the existing technical Chinese medicine text text is not high. Essence
Patent Information
- Application Number
- CN202210651940.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-09
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2042-06-09
AI Technical Summary
The existing medical text error correction schemes are not accurate when dealing with vocabulary errors and semantic errors in medical texts, especially the error correction effect of professional medical vocabulary is not good.
A two-step error correction method is adopted: first, the vocabulary typo correction model is used to identify and correct vocabulary typos in the medical text to be corrected, and the first error correction text is generated; then the semantic typo correction model is used to identify semantic typos in the first correction text. Identify and correct, and generate a second error-corrected text.
Through two steps of error correction, it can not only accurately correct the vocabulary errors in the medical text, but also correct semantic errors, significantly improve the accuracy of medical text error correction.
Smart Images

Figure CN115048937B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of natural language processing, and in particular to a medical text error correction method, a medical text error correction device, a storage medium and an electronic device. Background Art
[0002] In the actual medical diagnosis process, doctors are likely to write some typos and words when writing medical records. However, medicine is very rigorous, and typos and words in medical records may cause misdiagnosis and harm to patients. In addition, in the process of medical data production, medical texts with typos and words may also cause certain interference to subsequent medical research. Therefore, medical texts need to be corrected.
[0003] Text error correction is a technology in the field of natural language processing that detects whether a text contains typos and corrects them. There are two main solutions for existing medical text error correction solutions: the first is to use probability calculation models such as N-gram and kenlm for error correction. When using such models for text error correction, semantic errors that are context-dependent are not handled accurately, resulting in a low accuracy rate for text error correction.
[0004] The second type is a natural language processing (NLP) model based on a deep learning neural network model. This type of model is usually built using a massive Chinese corpus as a training set, and can correct common semantic errors in medical texts, but cannot effectively correct errors in professional medical vocabulary in medical texts.
[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0006] The purpose of the present disclosure is to provide a medical text correction method, a medical text correction device, a storage medium and an electronic device, thereby overcoming one or more problems caused by the limitations and defects of the relevant technology at least to a certain extent.
[0007] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.
[0008] According to a first aspect of the present disclosure, a medical text error correction method is provided, comprising:
[0009] Obtain the medical text to be corrected input by the user;
[0010] Dividing the medical text to be corrected into short sentences to obtain a plurality of short sentences;
[0011] Using a vocabulary typo correction model, performing vocabulary typos recognition and correction processing on each short sentence in the medical text to be corrected, to generate a first correction text;
[0012] The semantic typo correction model is used to perform semantic typo recognition and correction processing on the first error-correcting text to generate a second error-correcting text.
[0013] In an exemplary embodiment of the present disclosure, the method of using a vocabulary typo correction model to perform vocabulary typo recognition and correction processing on each short sentence in the medical text to be corrected to generate a first correction text includes:
[0014] Obtaining the N-gram probability score of each word in each short sentence of the medical text to be corrected;
[0015] Identify whether there are typos in the medical text to be corrected according to the N-gram probability score of each word;
[0016] When there are typos in the medical text to be corrected, the typos are corrected to generate a first correction text.
[0017] In an exemplary embodiment of the present disclosure, identifying whether there are typos in the medical text to be corrected according to the N-gram probability score of each word includes:
[0018] Determining the median value of each of the short sentences and the average absolute deviation of each of the short sentences according to the N-gram probability score of each word in each of the short sentences;
[0019] For each word in each of the short sentences, calculating the difference between the N-gram probability score of the word and the mean absolute deviation;
[0020] Calculating the product of the difference and a normal distribution parameter, and determining a ratio of the product to the mean absolute deviation;
[0021] If the ratio is greater than a preset threshold and the N-gram probability score of the character is less than the median value, the character is determined to be a wrong character.
[0022] In an exemplary embodiment of the present disclosure, the correcting the typo includes:
[0023] Obtaining the pinyin of the wrong character, and obtaining a correction candidate set corresponding to the wrong character according to the pinyin, wherein the correction candidate set includes at least one correction candidate character;
[0024] The wrong character is corrected using a target character, wherein the target character is the character with the highest frequency of use among the at least one error correction candidate character.
[0025] In an exemplary embodiment of the present disclosure, after correcting the wrong character using the target character, the method further includes:
[0026] Obtaining a first perplexity corresponding to the target word, where the first perplexity is the perplexity of the first correction text after the wrong word is corrected using the target word;
[0027] Correct the wrong character using each of the other characters except the target character in the at least one error correction candidate character, and obtain a second perplexity corresponding to each of the other characters;
[0028] Determining a minimum perplexity from the first perplexity and the second perplexity;
[0029] The wrong character is corrected using the character corresponding to the minimum perplexity.
[0030] In an exemplary embodiment of the present disclosure, the method further includes:
[0031] Performing word segmentation on each of the short sentences respectively, so as to compare the words in each of the short sentences with a preset confusion list, wherein the preset confusion list includes at least one wrong word;
[0032] If the word exists in the preset confusion list, the word is regarded as a typo.
[0033] In an exemplary embodiment of the present disclosure, after segmenting each of the short sentences, the method further includes:
[0034] Determine a filter word and a white-label word from the words in each of the short sentences, wherein the filter word is at least one of a number and a special character;
[0035] The other words in each of the short sentences except the filtered words and the whitelist words are regarded as wrong characters.
[0036] In an exemplary embodiment of the present disclosure, the semantic typo correction model includes a detection network, a SoftMasking connection layer and a correction network; the using the semantic typo correction model to perform semantic typo recognition and correction processing on the first correction text to generate a second correction text includes:
[0037] Inputting the first error-correcting text into a detection network to predict a first probability of a semantic error occurring in each word in the first error-correcting text according to context information of all words in the first error-correcting text, wherein the context information includes a long-term dependency relationship and a short-term dependency relationship between each word in the first error-correcting text and other words in the first error-correcting text;
[0038] Inputting the first probability and the first error correction text into the Soft Masking connection layer, performing a weighted operation on the first probability and the first error correction text to obtain a weighted result;
[0039] The weighted result and the first error-correcting text are input into a correction network to perform semantic typos recognition and correction processing on the first error-correcting text to generate a second error-correcting text.
[0040] In an exemplary embodiment of the present disclosure, the method further includes:
[0041] Obtaining the patient's disease information and medication information from the second error correction text;
[0042] Determining a medication rule corresponding to the disease information according to the disease information;
[0043] Determining whether medication complies with the medication rules according to the medication rules and the medication information;
[0044] When it is determined that the medication rule is met, adding the second error correction text as new medical text data to the medical text library;
[0045] When the amount of new medical text data added to the medical text library is greater than or equal to a preset amount, the new medical text data added to the medical text library is used to train the vocabulary typo correction model.
[0046] According to a second aspect of the present disclosure, a medical text error correction device is provided, comprising:
[0047] A module for obtaining medical texts to be corrected, used to obtain the medical texts to be corrected input by the user;
[0048] A short sentence division module is used to divide the medical text to be corrected into short sentences to obtain a plurality of short sentences;
[0049] A vocabulary typo correction module, used for using a vocabulary typo correction model to perform vocabulary typo recognition and correction processing on each short sentence in the medical text to be corrected, and generate a first correction text;
[0050] The semantic typo correction module is used to use the semantic typo correction model to perform semantic typo recognition and correction processing on the first error correction text to generate a second error correction text.
[0051] According to a third aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the steps of the medical text error correction method described in any one of the first aspects are implemented.
[0052] According to a fourth aspect of the present disclosure, there is provided an electronic device, including:
[0053] Processor; and
[0054] A memory, configured to store executable instructions of the processor;
[0055] Wherein, the processor is configured to perform the steps of the medical text error correction method described in any one of the first aspects of claim by executing the executable instructions.
[0056] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:
[0057] In summary, the method provided by the present disclosure uses a medical text library to train a vocabulary typo correction model, and uses the vocabulary typo correction model to perform vocabulary correction on a medical text to be corrected, which can accurately correct errors in medical vocabulary that appear in the medical text to be corrected. By inputting the first correction text after the correction of the medical text to be corrected by the vocabulary typo correction model into the detection network of the semantic typo correction model, the semantic errors of the medical text to be corrected can be corrected, which can not only accurately correct the errors in medical vocabulary in the medical text to be corrected, but also correct the errors in the semantics of the medical text to be corrected, thereby improving the accuracy of medical text correction.
[0058] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0060] Figure 1 A flowchart of a medical text error correction method in an exemplary embodiment of the present disclosure is schematically shown;
[0061] Figure 2 A schematic diagram schematically shows a system architecture in an exemplary embodiment of the present disclosure;
[0062] Figure 3 A flowchart of a method for correcting lexical typos in an exemplary embodiment of the present disclosure is schematically shown;
[0063] Figure 4 A flowchart of a semantically incorrect character correction method in an exemplary embodiment of the present disclosure is schematically shown;
[0064] Figure 5 A flowchart of a method for determining medication compliance in an exemplary embodiment of the present disclosure is schematically shown;
[0065] Figure 6 A flowchart of a vocabulary typo correction model training method in an exemplary embodiment of the present disclosure is schematically shown;
[0066] Figure 7 Schematically shows a block diagram of a medical text error correction device in an exemplary embodiment of the present disclosure;
[0067] Figure 8 A schematic diagram schematically shows a storage medium in an exemplary embodiment of the present disclosure;
[0068] Fig. 9 A block diagram of an electronic device in an exemplary embodiment of the present disclosure is schematically shown.
[0069] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts. DETAILED DESCRIPTION
[0070] The principles and spirit of the present invention will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present invention, and are not intended to limit the scope of the present invention in any way. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.
[0071] Those skilled in the art will appreciate that the embodiments of the present invention may be implemented as a system, device, apparatus, method or computer program product. Therefore, the present disclosure may be implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
[0072] There are two main solutions for the existing medical text error correction schemes: the first is to use probability calculation models such as n-gram and kenlm for error correction. The general process is: first, error detection is performed. Using a word cutter, the text is first cut into independent phrases. The wrong words are found out. Secondly, the wrong words are searched and the corresponding candidate word sets are screened out. Finally, the errors are corrected. From the candidate word set, the appropriate replacement words are traversed to minimize the overall confusion value of the text and complete the text error correction. However, the use of such models for text error correction is not accurate enough for handling semantic errors with context dependence, resulting in a low accuracy rate of text error correction.
[0073] The second type is a natural language processing (NLP) model built based on a deep learning neural network model, such as the Transformer model, the Bidirectional Encoder Representation from Transformers (Bert) model, the Sequence to Sequence (Seq2Seq) model, the Recurrent Neural Network (RNN) model, etc. for text error correction. Such models are usually built using a massive Chinese corpus as a training set. However, there are usually a large number of medical terms in medical texts, and the massive Chinese corpus usually only contains Chinese daily expressions and common Chinese expressions, and does not contain professional medical vocabulary, resulting in such models being unable to effectively correct errors in professional medical vocabulary in medical texts.
[0074] In view of the above-mentioned defects in the prior art, this exemplary embodiment first provides a medical text error correction method, which can correct medical vocabulary errors and semantic errors in medical texts and improve the accuracy of medical text error correction. Figure 1 As shown in , the above-mentioned medical text error correction method may include the following steps:
[0075] S1. Obtain the medical text to be corrected input by the user.
[0076] In this example implementation, reference Figure 2 The system architecture shown may include: a user-side mobile terminal device 201, a user-side smart terminal device 204, and a server 203. Data can be transmitted between the user-side mobile terminal device 201, the user-side smart terminal device 204, and the server 203 through the network 202. The network may include various connection types, such as wired communication links, wireless communication links, and the like. The above-mentioned medical text error correction method may be executed on the server side or by the user-side terminal device and the server side in collaboration. Taking the above-mentioned method executed on the server side as an example, the user may upload a medical text error correction request to the server side on the terminal device side; the medical text error correction request may include complete data corresponding to the medical text to be corrected. Alternatively, it may also include identification information in the medical text to be corrected; the server side may use the identification information to query the text library for the text as the medical text to be corrected. For example, the medical text to be corrected is a medical record, and the identification information in the medical text to be corrected may be a medical record number. The server side may use the medical record number to query the text library for the medical record as the medical text to be corrected.
[0077] S2. Divide the medical text to be corrected into short sentences to obtain a plurality of short sentences.
[0078] In an exemplary embodiment of the present disclosure, the medical text to be corrected can be divided into short sentences according to the punctuation marks of the medical text to be corrected. For example, if there are three "," and one "." in the medical text to be corrected, the medical text to be corrected is divided into four short sentences.
[0079] S3. Using a vocabulary typo correction model, perform vocabulary typos recognition and correction processing on each short sentence in the medical text to be corrected to generate a first correction text.
[0080] In an exemplary embodiment of the present disclosure, the vocabulary typo correction model can be a probability calculation model such as n-gram, kenlm, etc. Before using the vocabulary typo correction model to correct vocabulary typos in the medical text to be corrected, it is necessary to use the medical text library as a training set to train the vocabulary typo correction model to achieve the purpose of correcting professional vocabulary in the medical text to be corrected. The vocabulary typo correction model trained with the medical text library is used to correct vocabulary typos in the medical text, and the errors of medical vocabulary have been effectively corrected in the first corrected text.
[0081] S4. Using a semantic typo correction model, perform semantic typo recognition and correction processing on the first error correction text to generate a second error correction text.
[0082] In an exemplary embodiment of the present disclosure, the semantic typo correction model can be an NLP model built based on a deep learning neural network model, such as a Bert model, a Seq2Seq model, a Transformer model, an RNN model, etc. Such models can well correct context-dependent semantic errors in texts.
[0083] In the exemplary embodiment of the present disclosure, since the vocabulary typo correction model is used to perform semantic typos recognition and correction processing on each short sentence in the medical text to be corrected, the generated first correction text has effectively corrected the medical vocabulary errors, and then the semantic typo correction model is used to perform semantic typos recognition and correction processing on the first correction text, so that the semantic errors in the first correction text can be corrected. Therefore, after the semantic typo correction model performs semantic typos recognition and correction processing on the first correction text, the generated second correction text not only corrects the medical vocabulary errors, but also effectively corrects the semantic errors.
[0084] To sum up, the medical text correction method of the disclosed exemplary embodiment can use a vocabulary typo correction model to perform vocabulary typos recognition and correction processing on the medical text to be corrected to generate a first correction text; use a semantic typo correction model to perform semantic typos recognition and correction processing on the first correction text to generate a second correction text, which can not only correct professional vocabulary typos in the medical text to be corrected, but also correct semantic errors that are dependent on the context in the medical text to be corrected, thereby improving the accuracy of medical text correction.
[0085] In an exemplary embodiment of the present disclosure, the vocabulary typo correction model is used to perform vocabulary typo recognition and correction processing on each short sentence in the medical text to be corrected to generate a first correction text. Specifically, Figure 3 As shown, this may include:
[0086] S311, obtaining the N-gram probability score of each word in each short sentence of the medical text to be corrected.
[0087] In an exemplary embodiment of the present disclosure, N is an integer greater than 1 or equal to 1. The vocabulary typo correction model may be a kenlm model. The kenlm model can be used to obtain the N-gram probability n-Gram score of each word in each short sentence of the medical text to be corrected.
[0088] S312: Identify whether there are any typos in the medical text to be corrected based on the N-gram probability score of each word.
[0089] Specifically, according to the N-gram probability score of each word in each of the short sentences, the median value of each of the short sentences and the average absolute deviation of each of the short sentences are determined; for each word in each of the short sentences, the difference between the N-gram probability score of the word and the average absolute deviation is calculated; the product of the difference and the normal distribution parameter is calculated, and the ratio of the product to the average absolute deviation is determined; if the ratio is greater than a preset threshold value and the N-gram probability score of the word is less than the median value, the word is determined to be a wrong word.
[0090] The mean absolute deviation is defined as the average of the absolute values of the deviations of each data from the mean. For example, a short sentence in the medical text to be error-corrected consists of 5 characters, namely: taking Jinyinhua. The n-Gram scores of each character are 0.06, 0.07, 0.05, 0.045, and 0.07 respectively. Then the average value of the n-Grams of all characters in this short sentence is (0.06 + 0.07 + 0.05 + 0.045 + 0.07) / 5 = 0.058. The absolute values of the deviation values of the n-Gram scores of each character in "taking Jinyinhua" from the average value of 0.058 are 0.002, 0.012, 0.008, 0.013, and 0.012 respectively. Then, determine the average value of 0.002, 0.012, 0.008, 0.013, and 0.012 to be 0.0094, which is the mean absolute deviation of the first short sentence. And the "Jin" character is in the middle position of the first short sentence, so the n-Gram score of the "Jin" character, 0.005, is the median value of this short sentence. After determining the median value of 0.005 and the mean absolute deviation of 0.0094 of this short sentence, calculate the difference between the n-Gram score of each character in this short sentence and 0.0094, then calculate the product of this difference and the normal distribution parameter value of 0.6745 corresponding to the error probability within 75% in the standard normal distribution, and further calculate the ratio of this product to the mean absolute deviation of 0.0094. If the ratio corresponding to a certain character in this short sentence is greater than the preset threshold and the N-gram probability score of this character is less than the median value of 0.005, then determine this character as a misspelled word. In an exemplary embodiment of the present disclosure, the preset threshold is set to 2. For example, the ratio corresponding to the "Yin" character is 2.5545, which is greater than 2, and the n-Gram score of the "Yin" character, 0.045, is less than the median value of 0.005, so it is determined that "Yin" is a misspelled word.
[0091] In the exemplary embodiment of the present disclosure, only an exemplary value of the preset threshold is given here. The preset threshold can also take other values, and the present disclosure does not make specific limitations on the value of the preset threshold.
[0092] S313. When there are misspelled words in the medical text to be error-corrected, correct the misspelled words to generate a first error-corrected text.
[0093] In an exemplary embodiment of the present disclosure, when there are misspelled words in the medical text to be error-corrected, the pinyin of the misspelled word can be obtained and an error-correction candidate set corresponding to the misspelled word can be obtained according to the pinyin. The error-correction candidate set includes at least one error-correction candidate character; use the target character to correct the misspelled word, and the target character is the character with the highest usage frequency among the at least one error-correction candidate character.
[0094] In an exemplary embodiment of the present disclosure, after correcting the target character using the target word, the error may still exist, that is, the target character is not the correct character corresponding to the misspelled character. For example, the target character is "yin", and after replacing "yin" in "taking Jinyinhua" with "yin", the character "yin" is also a misspelled character.
[0095] To solve the problem that the error may still exist after correcting the misspelled character using the target word, in an exemplary embodiment of the present disclosure, after correcting the misspelled character using the target word, the first perplexity corresponding to the target word is obtained, where the first perplexity is the perplexity of the first corrected text after correcting the misspelled character using the target word; each of the other words in the at least one error correction candidate word except the target word is used to correct the misspelled character, and the second perplexity corresponding to each of the other words is obtained respectively; the minimum perplexity is determined from the first perplexity and the second perplexity; and the misspelled character is corrected using the word corresponding to the minimum perplexity. In natural language processing, perplexity is used to measure the quality of a language model. When the probability of a short sentence processed by the speech model is higher, the perplexity of the short sentence is smaller.
[0096] For example, after correcting "yin" with the target word "yin", the first perplexity of this short sentence is 0.053. Among the at least one error correction candidate word except the target word "yin", there are also "yin", "yin", and "yin". After correcting "yin" with "yin", "yin", and "yin" respectively, the second perplexities of this short sentence are 0.031, 0.068, 0.073, and 0.081 respectively. The minimum perplexity among the first perplexity and the second perplexity is 0.031, and the word corresponding to the minimum perplexity is "yin", so "yin" is used to correct "yin".
[0097] By determining the minimum perplexity from the first perplexity and the second perplexity; and correcting the misspelled character using the word corresponding to the minimum perplexity, the problem that the error still exists after correcting the misspelled character using the target word can be effectively solved, and the accuracy of medical text error correction is improved.
[0098] In an exemplary embodiment of the present disclosure, when there is a misspelled character in the medical text to be error-corrected, an error correction candidate set can also be displayed on the interaction interface of the terminal device; and the misspelled character is corrected according to a candidate word selected by the user from the error correction candidate set.
[0099] For example, display "yin", "yin2", "yin4", and "yin1" in the correction candidate set on the interactive interface of the terminal device, so that the user can select a candidate character from "yin", "yin2", "yin4", and "yin1" in the correction candidate set displayed on the interactive interface of the terminal device. For example, if the user selects the candidate character "yin2", then use "yin2" to correct "yin1".
[0100] In an exemplary embodiment of the present disclosure, in addition to identifying misspelled words from the medical text to be corrected according to the examples provided in the present disclosure Figure 3 in the manner of the embodiment, misspelled words can also be identified from the medical text to be corrected in the following two exemplary embodiments of the present disclosure:
[0101] In the first exemplary embodiment of the present disclosure, after dividing the medical text to be corrected into short sentences, each short sentence can be segmented separately for comparing each word in each short sentence with a preset confusion list, and the preset confusion list includes at least one misspelled word; if the word exists in the preset confusion list, the word is regarded as a misspelled word.
[0102] In the second exemplary embodiment of the present disclosure, after segmenting each short sentence separately, filtering words and whitelist words can be determined from the words in each short sentence, and the filtering words are at least one of numbers and special characters; other words in each short sentence except the filtering words and the whitelist words are regarded as misspelled words.
[0103] In an exemplary embodiment of the present disclosure, misspelled words determined according to the N-gram probability score, misspelled words determined according to the preset confusion list, and misspelled words determined according to the filtering words and the whitelist words can all be regarded as misspelled words in the medical text to be corrected. In this way, as many misspelled words as possible in the medical text to be corrected can be found to accurately correct the medical text to be corrected and improve the accuracy of medical text correction.
[0104] In an exemplary embodiment of the present disclosure, the semantic misspelled word correction model can be a Soft-MaskedBert model, including a detection network, a Soft Masking connection layer, and a correction network. The above uses the semantic misspelled word correction model to perform semantic misspelled word recognition and correction processing on the first corrected text to generate a second corrected text. Specifically, as Figure 4 shown, it can include:
[0105] S411. Input the first corrected text into the detection network to predict the first probability of semantic error occurrence for each word in the first corrected text according to the context information of all words in the first corrected text, where the context information includes the long-term and short-term dependencies of each word in the first corrected text with other words in the first corrected text.
[0106] In an exemplary embodiment of the present disclosure, the detection network is composed of a bidirectional gate recurrent unit (BidirectionalGate Recurrent Unit, Bi-GRU), which can extract features from text from two directions at the same time, and the Bi-GRU includes a unit reset gate and an update gate. The unit reset gate helps to capture the short-term dependencies in the text sequence based on the features extracted from the text from two directions, and the update gate helps to capture the long-term dependencies in the text sequence based on the features extracted from the text from two directions. Therefore, by inputting the first error correction text into the Bi-GRU, the long-term and short-term dependencies between each word in the first error correction text and other words in the first error correction text can be determined, and then the semantic errors of each word in the first error correction text will be predicted more accurately.
[0107] S412: Input the first probability and the first error correction text into a Soft Masking connection layer, perform a weighted operation on the first probability and the first error correction text, and obtain a weighted result.
[0108] In an exemplary embodiment of the present disclosure, the first error correction text and the first probability are input into the Soft Masking, and each word in the first error correction text and its corresponding weighted sum are weighted to obtain a weighted result. If the first probability of a word in the first error correction text is smaller, the character corresponding to the weighted result of the word is more similar to the word, and the possibility of the word being wrong is smaller.
[0109] S413: Input the weighted result and the first error correction text into a correction network to perform semantic typos recognition and correction processing on the first error correction text to generate a second error correction text.
[0110] In an exemplary embodiment of the present disclosure, a Bert model is corrected in the network, including 12 encoding Encoder layers, and a softmax layer is set after the Bert model. Each of the weighted results is input into the Bert model, and the last Encoder layer in the Bert model outputs all hidden states of each of the weighted results, and then all the hidden states of each of the weighted results are added to the corresponding words in the first error correction text for residual connection to obtain a residual connection value, and then the residual connection value is input into the full connection layer, and the full connection layer will use the hidden state to map the residual connection value into a vector with the same dimension as the candidate word. The softmax function is then used to output the second probability that a certain word in the first error correction text can be corrected as a candidate word. If the second probability is greater than the preset probability threshold, the word is determined to be a semantically wrong word and the candidate word is used to correct the word.
[0111] Based on the above, in other exemplary embodiments of the present disclosure, refer to Figure 5 As shown, the above method may further include:
[0112] S511, obtaining identification information of the patient from the second error correction text;
[0113] S512, obtaining the patient's historical medical records from a database according to the identification information;
[0114] S513. Display the patient's case history in the interactive interface of the terminal device.
[0115] In an exemplary embodiment of the present disclosure, the second error correction text is a corrected medical text. Therefore, the patient's name, gender, age and other identification information can be obtained from the second error correction text, and then the patient's history case can be obtained according to the patient's identification information, and then the patient's history case can be displayed on the interactive interface of the terminal device, so that the doctor can diagnose the patient according to the patient's history case.
[0116] In an exemplary embodiment of the present disclosure, when the medical text error correction method is applied to a terminal device, after the terminal device obtains the patient's historical case, the patient's historical case is directly displayed in the interactive interface. When the medical text error correction method is applied to a server, after the server obtains the patient's historical case, the patient's historical case needs to be sent to the terminal device so that the terminal device displays the patient's historical case in the interactive interface.
[0117] Based on the above, in other exemplary embodiments of the present disclosure, refer to Figure 6 As shown, the above method may further include:
[0118] S521, obtaining the patient's disease information and medication information from the second error correction text;
[0119] S522, determining a medication rule corresponding to the disease information according to the disease information;
[0120] S523: Determine whether the medication complies with the medication rule according to the medication rule and the medication information.
[0121] Specifically, the sick information includes at least one of the disease name, symptoms, and course of disease, and the medication information includes at least one of the drug type, drug name, medication quantity, medication duration, and medication time. After obtaining the patient's sick information and medication information, obtain the medication rules corresponding to the sick information from the medication rule library. Among them, the medication rule library stores medication rules corresponding to various sick information, and the medication rules are information such as the type of drugs that can be used, the drug name, the medication quantity, the medication duration, and the medication time corresponding to the sick information. For example, the patient's sick information is a mild cold, accompanied by nasal congestion and runny nose. The medication rule corresponding to the sick information is to take the over-the-counter drug honeysuckle granules for three days, morning and evening, and one bag each time. If the patient's medication information is to take the over-the-counter drug honeysuckle granules for three days, morning and evening, and one bag each time, it is determined that it meets the medication rules.
[0122] S524, when it is determined that the medication rule is met, adding the second error correction text as new medical text data to the medical text library;
[0123] S525: When the amount of new medical text data added to the medical text library is greater than or equal to a preset amount, the new medical text data added to the medical text library is used to train the vocabulary typo correction model.
[0124] For example, the preset number can be 100. When the number of new medical text data added to the medical text library is greater than or equal to 100, the new medical text data greater than or equal to 100 is used to train the vocabulary typo correction model, so that the vocabulary typo correction model constantly fits the doctor's habits. Different hospitals and different doctors use their own medical text libraries to train vocabulary typo correction models, which also makes the vocabulary typo correction model more flexible and more sensitive, and can meet the personalized needs of different hospitals and doctors. Other exemplary embodiments of the present disclosure only give the value of the preset number by way of example, and the preset number can also take other values. The present disclosure does not specifically limit the value of the preset number.
[0125] In summary, the medical text error correction method provided by the present disclosure uses a continuously updated medical text library to train a vocabulary typo correction model, and uses the vocabulary typo correction model to perform vocabulary correction on the medical text to be corrected, which can accurately correct the errors of medical vocabulary in the medical text to be corrected, and can meet the personalized needs of different hospitals and doctors. By inputting the first error correction text after the vocabulary typo correction model corrects the medical text to be corrected into the detection network in the semantic typo correction model, the long-term dependency relationship and short-term dependency relationship between each word in the first error correction text and other words in the first error correction text can be obtained, and then the probability of semantic errors in each word in the first error correction text can be accurately predicted. The first probability is input into the soft-mask layer, and the word to be corrected can be accurately determined from the first error correction text. Then the word to be corrected is input into the correction network, and the word to be corrected can be accurately corrected. Therefore, the medical text error correction method provided by the present disclosure can not only accurately correct the errors of medical vocabulary in the medical text to be corrected, but also correct the errors in the semantics of the medical text to be corrected. The accuracy of medical text error correction is high, and the personalized needs of different hospitals and doctors can be met at the same time.
[0126] After introducing the medical text error correction method of the exemplary embodiment of the present invention, next, refer to Figure 7 A medical text error correction device according to an exemplary embodiment of the present invention is described.
[0127] refer to Figure 7 As shown, the medical text error correction device 70 of the exemplary embodiment of the present invention may include: a medical text acquisition module 701 to be corrected, a short sentence division module 702, a vocabulary typo correction module 703 and a semantic typo correction module 704, wherein:
[0128] The module 701 for obtaining the medical text to be corrected is used to obtain the medical text to be corrected input by the user;
[0129] The short sentence division module 702 is used to divide the medical text to be corrected into short sentences to obtain a plurality of short sentences;
[0130] The vocabulary typo correction module 703 is used to use the vocabulary typo correction model to perform vocabulary typo recognition and correction processing on each short sentence in the medical text to be corrected, and generate a first correction text;
[0131] The semantic typo correction module 704 is used to use the semantic typo correction model to perform semantic typo recognition and correction processing on the first error correction text to generate a second error correction text.
[0132] In an exemplary embodiment of the present disclosure, the vocabulary typo correction module includes:
[0133] A grammatical probability score acquisition unit (not shown in the figure), used to acquire the N-gram grammatical probability score of each word in each short sentence of the medical text to be corrected;
[0134] A wrong character recognition unit (not shown in the figure), used to identify whether there is a wrong character in the medical text to be corrected according to the N-gram probability score of each character;
[0135] A typo correction unit (not shown in the figure) is used to correct typos when typos exist in the medical text to be corrected, and generate a first correction text.
[0136] In an exemplary embodiment of the present disclosure, the typo recognition unit is specifically used for:
[0137] Determining the median value of each of the short sentences and the average absolute deviation of each of the short sentences according to the N-gram probability score of each word in each of the short sentences;
[0138] For each word in each of the short sentences, calculating the difference between the N-gram probability score of the word and the mean absolute deviation;
[0139] Calculating the product of the difference and a normal distribution parameter, and determining a ratio of the product to the mean absolute deviation;
[0140] If the ratio is greater than a preset threshold and the N-gram probability score of the character is less than the median value, the character is determined to be a wrong character.
[0141] In an exemplary embodiment of the present disclosure, the typo correction unit includes:
[0142] A target word correction unit (not shown in the figure) is used to obtain the pinyin of the wrong word, and obtain a correction candidate set corresponding to the wrong word based on the pinyin, wherein the correction candidate set includes at least one correction candidate word; the wrong word is corrected using a target word, wherein the target word is the word with the highest frequency of use among the at least one correction candidate word.
[0143] In an exemplary embodiment of the present disclosure, the device further includes:
[0144] A perplexity acquisition unit (not shown in the figure) is used to acquire a first perplexity corresponding to the target word, where the first perplexity is the perplexity of the first correction text after the wrong word is corrected using the target word; respectively correct the wrong word using each of the other words in the at least one correction candidate word except the target word, and respectively acquire a second perplexity corresponding to each of the other words; determine a minimum perplexity from the first perplexity and the second perplexity; and correct the wrong word using the word corresponding to the minimum perplexity.
[0145] In an exemplary embodiment of the present disclosure, the device further includes:
[0146] The short sentence segmentation module (not shown in the figure) is used to segment each of the short sentences respectively, so as to compare the words in each of the short sentences with a preset confusion list, wherein the preset confusion list includes at least one wrong word; if the word exists in the preset confusion list, the word is regarded as a wrong word.
[0147] In an exemplary embodiment of the present disclosure, the device further includes:
[0148] A filter word determination unit (not shown in the figure) is used to determine filter words and white-list words from the words in each of the short sentences, wherein the filter words are at least one of numbers and special characters; and other words in each of the short sentences except the filter words and the white-list words are regarded as typos.
[0149] In an exemplary embodiment of the present disclosure, the semantic typo correction model includes a detection network, a SoftMasking connection layer and a correction network;
[0150] The semantic typo correction module comprises:
[0151] a probability acquisition unit (not shown in the figure), configured to input the first error-correcting text into a detection network to predict a first probability of a semantic error occurring in each word in the first error-correcting text according to context information of all words in the first error-correcting text, wherein the context information includes a long-term dependency relationship and a short-term dependency relationship between each word in the first error-correcting text and other words in the first error-correcting text;
[0152] A weighted result acquisition unit (not shown in the figure), used for inputting the first probability and the first error correction text into the Soft Masking connection layer, performing a weighted operation on the first probability and the first error correction text, and obtaining a weighted result;
[0153] The second error correction text generating unit is used to input the weighted result and the first error correction text into the correction network to perform semantic typos recognition and correction processing on the first error correction text to generate a second error correction text.
[0154] In an exemplary embodiment of the present disclosure, the device further includes:
[0155] A vocabulary typo correction model training module (not shown in the figure) is used to obtain the patient's disease information and medication information from the second error correction text; determine the medication rules corresponding to the disease information based on the disease information; judge whether the medication complies with the medication rules based on the medication rules and the medication information; when determining that the medication is compliant, add the second error correction text as new medical text data to the medical text library; when the number of new medical text data added to the medical text library is greater than or equal to a preset number, use the new medical text data added to the medical text library to train the vocabulary typo correction model.
[0156] Since the functional modules of the text correction device according to the embodiment of the present invention are the same as those in the above-mentioned text correction method invention embodiment, they will not be described in detail here.
[0157] After introducing the medical text error correction method and the medical text error correction device according to the exemplary embodiment of the present invention, next, reference is made to Figure 8 A storage medium according to an exemplary embodiment of the present invention is described.
[0158] refer to Figure 8 As shown, a program product 800 for implementing the above method according to an embodiment of the present invention is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.
[0159] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0160] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0161] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0162] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user computing device, partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0163] After introducing the storage medium of the exemplary embodiment of the present invention, next, reference is made to Fig. 9 An electronic device according to an exemplary embodiment of the present invention is described.
[0164] Fig. 9 The electronic device 90 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0165] like Fig. 9 As shown, the electronic device 90 is in the form of a general computing device. The components of the electronic device 90 may include but are not limited to: at least one processing unit 910, at least one storage unit 920, a bus 930 connecting different system components (including the storage unit 920 and the processing unit 910), and a display unit 940.
[0166] The storage unit stores program codes, which can be executed by the processing unit 910, so that the processing unit 910 performs the steps of various exemplary embodiments of the present invention described in the above "Exemplary Method" section of this specification. For example, the processing unit 910 can perform the following steps: Figure 1 Steps S1 to S4 shown in FIG.
[0167] The storage unit 920 may include a volatile storage unit, such as a random access storage unit (RAM) 9201 and / or a cache storage unit 9202, and may further include a read-only storage unit (ROM) 9203. The storage unit 920 may also include a program / utility 9204 having a set (at least one) of program modules 9205, such program modules 9205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination thereof may include the implementation of a network environment.
[0168] The bus 930 may include a data bus, an address bus, and a control bus.
[0169] The electronic device 90 may also communicate with one or more external devices 100 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), and such communication may be performed through an input / output (I / O) interface 950. The electronic device 90 also includes a display unit 940, which is connected to the input / output (I / O) interface 950 for display. In addition, the electronic device 90 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) through a network adapter 960. As shown, the network adapter 960 communicates with other modules of the electronic device 90 through the bus 90. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 90, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0170] It should be noted that although several modules or submodules of the text error correction device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided into multiple units / modules to be embodied.
[0171] In addition, although the operations of the method of the present invention are described in a specific order in the drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.
[0172] Although the spirit and principle of the present invention have been described with reference to several specific embodiments, it should be understood that the present invention is not limited to the disclosed specific embodiments, and the division of various aspects does not mean that the features in these aspects cannot be combined to benefit, and such division is only for the convenience of expression. The present invention is intended to cover various modifications and equivalent arrangements included in the spirit and scope of the attached claims.
Claims
1. A medical text error correction method, characterized in that: include: Obtain the medical text to be corrected input by the user; Dividing the medical text to be corrected into short sentences to obtain a plurality of short sentences; Using a vocabulary typo correction model, performing vocabulary typos recognition and correction processing on each short sentence in the medical text to be corrected, to generate a first correction text; Using a semantic typo correction model to perform semantic typo recognition and correction processing on the first error correction text to generate a second error correction text; The semantic typo correction model includes a detection network, a Soft Masking connection layer and a correction network; the step of using the semantic typo correction model to perform semantic typo recognition and correction processing on the first correction text to generate a second correction text includes: Inputting the first error-correcting text into the detection network to predict a first probability of a semantic error occurring in each word in the first error-correcting text according to context information of all words in the first error-correcting text; Inputting the first probability and the first error correction text into the Soft Masking connection layer, performing a weighted operation on the first probability and the first error correction text to obtain a weighted result; Input the weighted results and the first error correction text into the correction network, output all hidden states of the weighted results, add all hidden states of the weighted results to the corresponding words in the first error correction text to perform residual connection to obtain residual connection values, input the residual connection values into a fully connected layer to map the residual connection values into a vector with the same dimension as the candidate word, and use a softmax function to output a second probability that a certain word in the first error correction text is corrected as a candidate word; When the second probability is greater than a preset probability threshold, the character is determined to be a semantically incorrect character and the candidate character is used to correct the character to generate a second error-corrected text.
2. The method according to claim 1, characterized in that The method of using the vocabulary typo correction model to perform vocabulary typo recognition and correction processing on each short sentence in the medical text to be corrected to generate a first correction text includes: Obtaining the N-gram probability score of each word in each short sentence of the medical text to be corrected; Identify whether there are typos in the medical text to be corrected according to the N-gram probability score of each word; When there are typos in the medical text to be corrected, the typos are corrected to generate a first correction text.
3. The method according to claim 2, characterized in that Identifying whether there are typos in the medical text to be corrected according to the N-gram probability score of each word includes: Determining the median value of each of the short sentences and the average absolute deviation of each of the short sentences according to the N-gram probability score of each word in each of the short sentences; For each word in each of the short sentences, calculating the difference between the N-gram probability score of the word and the mean absolute deviation; Calculating the product of the difference and a normal distribution parameter, and determining a ratio of the product to the mean absolute deviation; If the ratio is greater than a preset threshold and the N-gram probability score of the character is less than the median value, the character is determined to be a wrong character.
4. The method according to claim 2, characterized in that: The correcting of the typos comprises: Obtaining the pinyin of the wrong character, and obtaining a correction candidate set corresponding to the wrong character according to the pinyin, wherein the correction candidate set includes at least one correction candidate character; The wrong character is corrected using a target character, wherein the target character is the character with the highest frequency of use among the at least one error correction candidate character.
5. The method according to claim 4, characterized in that After the target character is used to correct the wrong character, the method further comprises: Obtaining a first perplexity corresponding to the target word, where the first perplexity is the perplexity of the first correction text after the wrong word is corrected using the target word; Correct the wrong character using each of the other characters except the target character in the at least one error correction candidate character, and obtain a second perplexity corresponding to each of the other characters; Determining a minimum perplexity from the first perplexity and the second perplexity; The wrong character is corrected using the character corresponding to the minimum perplexity.
6. The method according to claim 1, characterized in that The method further comprises: Performing word segmentation on each of the short sentences respectively, so as to compare the words in each of the short sentences with a preset confusion list, wherein the preset confusion list includes at least one wrong word; If the word exists in the preset confusion list, the word is regarded as a typo.
7. The method according to claim 6, characterized in that After segmenting each of the short sentences, the method further includes: Determine a filter word and a white-label word from the words in each of the short sentences, wherein the filter word is at least one of a number and a special character; The other words in each of the short sentences except the filtered words and the whitelist words are regarded as wrong characters.
8. The method according to claim 1, characterized in that The context information includes long-term dependency and short-term dependency between each word in the first error correction text and other words in the first error correction text.
9. The method according to claim 1, characterized in that: The method further comprises: Obtaining the patient's disease information and medication information from the second error correction text; Determining a medication rule corresponding to the disease information according to the disease information; Determining whether medication complies with the medication rules according to the medication rules and the medication information; When it is determined that the medication rule is met, adding the second error correction text as new medical text data to the medical text library; When the amount of new medical text data added to the medical text library is greater than or equal to a preset amount, the new medical text data added to the medical text library is used to train the vocabulary typo correction model.
10. A medical text error correction device, characterized in that: include: A module for obtaining medical texts to be corrected, used to obtain the medical texts to be corrected input by the user; A short sentence division module is used to divide the medical text to be corrected into short sentences to obtain a plurality of short sentences; A vocabulary typo correction module is used to use a vocabulary typo correction model to perform vocabulary typo correction processing on the medical text to be corrected to obtain a first corrected text; A semantic typo correction module, configured to perform semantic typo correction processing on the first error-correcting text using a semantic typo correction model to obtain a second error-correcting text; The semantic typo correction model includes a detection network, a Soft Masking connection layer and a correction network; the step of using the semantic typo correction model to perform semantic typo recognition and correction processing on the first correction text to generate a second correction text includes: Inputting the first error-correcting text into the detection network to predict a first probability of a semantic error occurring in each word in the first error-correcting text according to context information of all words in the first error-correcting text; Inputting the first probability and the first error correction text into the Soft Masking connection layer, performing a weighted operation on the first probability and the first error correction text to obtain a weighted result; Input the weighted results and the first error correction text into the correction network, output all hidden states of the weighted results, add all hidden states of the weighted results to the corresponding words in the first error correction text to perform residual connection to obtain residual connection values, input the residual connection values into a fully connected layer to map the residual connection values into a vector with the same dimension as the candidate word, and use a softmax function to output a second probability that a certain word in the first error correction text is corrected as a candidate word; When the second probability is greater than a preset probability threshold, the character is determined to be a semantically incorrect character and the candidate character is used to correct the character to generate a second error-corrected text.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method described in any one of claims 1 to 9 are implemented.
12. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the steps of the method according to any one of claims 1 to 9 by executing the executable instructions.
Citation Information
Patent Citations
Text error correction method and system, computer equipment and readable storage medium
CN112287670A
Method, device and equipment for identifying wrongly written characters and words and computer readable storage medium
CN113705165A
Text error correction method for automobile proper nouns and readable storage medium
CN114492396A