Automatic correction method and device based on training model and electronic equipment

By using the joint prediction and simulation of the teacher model and the student model in the text error correction system in the medical field, combined with the weight calculation of the entity recognition expert model, the problem of low accuracy of the text error correction system in the medical field is solved and a higher accuracy is achieved. The effectiveness of text correction accuracy and adaptation to domain-specific language features.

CN118780271APending Publication Date: 2024-10-15PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411074840.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-06
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

The existing text error correction system based on natural language processing technology in the medical field is difficult to achieve high-accuracy model training due to insufficient data, resulting in immature automatic detection and correction systems.

Method used

The automatic correction method based on the training model is adopted, and through the joint prediction and simulation of the teacher model and the student model, combined with the weight calculation of the entity recognition expert model, the accuracy of text correction is gradually improved and adapted to the language characteristics and terminology of specific fields.

Benefits of technology

It achieves more accurate and comprehensive error correction in the text correction process in the medical field, improves the accuracy of text correction, reduces dependence on large amounts of data, and is suitable for optimization of specific tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118780271A_ABST
    Figure CN118780271A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an automatic correction method and device based on a training model and electronic equipment, and belongs to the technical field of digital medical treatment. The method comprises the following steps: acquiring a first medical sample set and a second medical sample set, wherein the first medical sample set comprises a plurality of medical statements to be corrected; inputting the first medical sample set and the second medical sample set into a teacher model of a training model for statement error correction, and outputting a first prediction text; inputting the first medical sample set and the first prediction text into a student model of the training model for correction learning, and outputting a second prediction text; performing statement simulation on the to-be-corrected medical statement and the second prediction text to obtain a simulation text; performing weight calculation on the simulation text through an entity recognition expert model, and outputting a weight sequence; and performing statement correction on the to-be-corrected medical statement based on the weight sequence to obtain a target correction statement. According to the embodiment of the invention, learning comparison can be carried out by taking a related model in the field of medicine as a learning sample, so that the accuracy of text correction is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of digital medical technology, and in particular to an automatic correction method, device and electronic equipment based on a training model. Background Art

[0002] There are already some text error correction systems based on natural language processing (NLP) technology on the market, such as Microsoft Word, Grammarly, etc. These systems can automatically correct and amend past documents in the financial and medical fields based on learning records. For example, in the medical field, some early technologies had limited information or errors due to the imperfect level of science and technology. These systems can automatically detect and amend these medical concepts based on the current level of technology.

[0003] Since deep learning requires a large amount of data support, some pharmaceutical industries do not have enough data to complete the training of models with higher accuracy, and low accuracy will seriously affect the use of the model, so there is currently no very mature automatic detection and correction system. Summary of the invention

[0004] The main purpose of the embodiments of the present application is to propose an automatic correction method, device and electronic device based on a training model, which can use relevant models in the medical field as learning samples for learning comparison to improve the accuracy of text correction.

[0005] To achieve the above-mentioned purpose, a first aspect of an embodiment of the present application proposes an automatic correction method based on a training model, wherein the training model includes a teacher model, a student model and an entity recognition expert model, and the method includes: Acquire a first medical sample set and a second medical sample set, wherein the first medical sample set includes a plurality of medical statements to be corrected; Inputting the first medical sample set and the second medical sample set into the teacher model of the training model to perform sentence error correction, and outputting a first predicted text; Inputting the first medical sample set and the first predicted text into the student model of the training model for correction learning, and outputting a second predicted text; Performing sentence simulation on the medical sentence to be corrected and the second predicted text to obtain a simulated text; Performing weight calculation on the simulation text through the entity recognition expert model and outputting a weight sequence; The medical statement to be corrected is corrected based on the weight sequence to obtain a target corrected statement.

[0006] In some embodiments, the second medical sample set includes a plurality of correctly spelled target medical sentences; the step of inputting the first medical sample set and the second medical sample set into the teacher model of the training model for sentence correction and outputting a first predicted text comprises: Inputting the first medical sample set and the second medical sample set into the teacher model, so that the teacher model performs sentence prediction on the medical sentence to be corrected based on the target medical sentence, and outputs a predicted sentence; Performing supervised training on the teacher model through the prediction sentence to obtain a pre-trained teacher model; The medical sentence to be corrected is input into a pre-trained teacher model for sentence correction, and a first predicted text is output.

[0007] In some embodiments, inputting the first medical sample set and the first predicted text into the student model of the training model for correction learning and outputting the second predicted text comprises: Inputting the first medical sample set and the first predicted text into the student model, so that the student model performs cross entropy calculation on the medical statement to be corrected and the first predicted text, and outputs predicted cross entropy, wherein the predicted cross entropy is used to measure the difference between the medical statement to be corrected and the first predicted text; Updating the gradient of the student model according to the predicted cross entropy to obtain a pre-trained student model; The medical sentence to be corrected is input into a pre-trained student model for sentence prediction, and a second predicted text is output.

[0008] In some embodiments, the training model includes a discriminant model; the sentence simulation of the medical statement to be corrected and the second predicted text to obtain the simulated text includes: The student model is used as a generator, and the medical statement to be corrected is input into the generator for statement simulation, and a first simulation statement is output; Inputting the second predicted text and the target medical sentence into the discriminant model, and outputting a second simulation sentence; Training the generator according to the first simulation statement and the second simulation statement; The medical sentence to be corrected is input into the trained generator for sentence simulation to obtain a simulated text.

[0009] In some embodiments, the weight calculation of the simulated text by the entity recognition expert model and outputting a weight sequence includes: Performing word segmentation processing on the simulated text to obtain a plurality of simulated characters; Input all the simulated characters into the entity recognition expert model to calculate the weights, and output the entity category weights; For each of the simulated characters, traverse all the entity category weights to screen and obtain a character weight value; The character weight values ​​of each simulated character are concatenated to obtain a weight sequence.

[0010] In some embodiments, the sentence correction of the to-be-corrected medical sentence based on the weight sequence to obtain a target corrected sentence includes: Obtaining a weight matrix of a self-attention layer of the entity recognition expert model, wherein the weight matrix is ​​used to characterize an internal representation of the simulated text; Performing a dot product of the weight sequence and the weight matrix to obtain a dot product vector; Perform parameter update on the training model by using the dot product vector; The medical statement to be corrected is input into the training model with updated parameters to perform sentence correction to obtain a target corrected sentence.

[0011] In some embodiments, the training of the generator according to the first simulation statement and the second simulation statement includes: Performing data classification on the second simulation sentence according to the discriminant model to obtain a classification result; The generator is trained according to the classification result and the first simulation sentence.

[0012] To achieve the above-mentioned purpose, the second aspect of the embodiment of the present application proposes an automatic correction device based on a training model, wherein the training model includes a teacher model, a student model and an entity recognition expert model, and the device includes: A sample acquisition module, used to acquire a first medical sample set and a second medical sample set, wherein the first medical sample set includes a plurality of medical statements to be corrected; A sentence correction module, used for inputting the first medical sample set and the second medical sample set into the teacher model of the training model to perform sentence correction and output a first predicted text; A correction learning module, used for inputting the first medical sample set and the first predicted text into the student model of the training model for correction learning, and outputting a second predicted text; A sentence simulation module, used for performing sentence simulation on the medical sentence to be corrected and the second predicted text to obtain a simulation text; A weight calculation module, used for performing weight calculation on the simulation text through the entity recognition expert model and outputting a weight sequence; The sentence correction module is used to perform sentence correction on the medical sentence to be corrected based on the weight sequence to obtain a target corrected sentence.

[0013] To achieve the above-mentioned purpose, the third aspect of an embodiment of the present application proposes an electronic device, an electronic device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the automatic correction method based on the training model as described in the first aspect when executing the computer program.

[0014] To achieve the above-mentioned purpose, the fourth aspect of an embodiment of the present application proposes a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the automatic correction method based on the training model as described in the first aspect.

[0015] The automatic correction method, device, electronic device and storage medium based on the training model proposed in the present application first obtain a first medical sample set and a second medical sample set, wherein the first medical sample set includes a plurality of medical sentences to be corrected, and then the first medical sample set and the second medical sample set are input into the teacher model of the training model for sentence correction, so as to achieve preliminary correction of the medical sentences to be corrected in the first medical sample set, ensure the uniformity of the correction results of different texts, and obtain a first predicted text, and then input the first medical sample set and the first predicted text into the student model of the training model for correction learning, so as to effectively measure the difference between the medical sentences to be corrected and the first predicted text of the teacher model. Difference, and can update the gradient through back propagation, improve the correction accuracy, output the second predicted text, and then simulate the medical sentence to be corrected and the second predicted text, so that it can generate a simulated text that is more similar to the real text, thereby improving the accuracy of the generated text, and then calculate the weight of the simulated text through the entity recognition expert model to determine the weight value of each character in the simulated text, output the weight sequence, and highlight potential errors or inappropriate words, thereby guiding the correction process. Finally, based on the weight sequence, the medical sentence to be corrected is corrected to obtain the target corrected sentence, so that the sentence correction can be more accurately and comprehensively implemented, and the accuracy of text correction can be improved. The embodiment of the present application predicts the medical sentence to be corrected through the teacher model and the student model respectively, and then simulates the second predicted text output by the student model and the medical sentence to be corrected to obtain the simulated text, and finally corrects the medical sentence to be corrected through the weight sequence of the simulated text to obtain the target corrected sentence. These small models can be optimized for the language characteristics and terminology of specific fields, so as to perform better on specific tasks, and do not require a large amount of data as support. It can directly use the relevant models in the medical field as learning samples for learning comparison to improve the accuracy of text correction. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1is a flow chart of an automatic correction method based on a training model provided by an embodiment of the present application; Figure 2 yes Figure 1 Flow chart of step S102 in FIG. Figure 3 yes Figure 1 Flow chart of step S103 in FIG. Figure 4 yes Figure 1 Flow chart of step S104 in FIG. Figure 5 yes Figure 1 Flow chart of step S105 in FIG. Figure 6 yes Figure 1 Flow chart of step S106 in FIG. Figure 7 yes Figure 4 Flow chart of step S403 in FIG. Figure 8 It is a structural schematic diagram of an automatic correction device based on a training model provided in an embodiment of the present application; Fig. 9 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION

[0017] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0018] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0019] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0020] First, some nouns involved in this application are analyzed: Natural Language Processing (NLP): NLP uses computers to process, understand, and apply human languages ​​(such as Chinese, English, etc.). NLP is a branch of artificial intelligence and an interdisciplinary subject between computer science and linguistics. It is often referred to as computational linguistics. Natural language processing includes grammatical analysis, semantic analysis, and text understanding. Natural language processing is commonly used in technical fields such as machine translation, handwritten and printed character recognition, speech recognition and text-to-speech conversion, information intent recognition, information extraction and filtering, text classification and clustering, public opinion analysis, and opinion mining. It involves data mining related to language processing, machine learning, knowledge acquisition, knowledge engineering, artificial intelligence research, and linguistic research related to language computing.

[0021] Convolutional Neural Network (CNN): Convolutional neural network is a type of feedforward neural network with deep structure and convolutional calculation, and is one of the representative algorithms of deep learning. Convolutional neural network has the ability of representation learning and can classify input information in a translation-invariant manner according to its hierarchical structure.

[0022] Transformer-based pre-trained language model (Bidirectional and Auto-RegressiveTransformers, BART): The BART model is a pre-trained model based on the Transformer architecture, which combines the characteristics of a bidirectional encoder and an auto-regressive decoder, and is specifically designed for natural language generation, translation, and understanding tasks.

[0023] Based on this, the embodiments of the present application provide an automatic correction method and device based on a training model, an electronic device and a storage medium, which can use relevant models in the medical field as learning samples for learning comparison to improve the accuracy of text correction.

[0024] The automatic correction method and device based on the training model, electronic device and storage medium provided in the embodiments of the present application are specifically illustrated through the following embodiments. First, the automatic correction method based on the training model in the embodiments of the present application is described.

[0025] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0026] The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. Artificial intelligence software technologies mainly include computer vision technology, robotics technology, biometrics technology, module management technology of online meeting systems, natural language processing technology, and machine learning / deep learning.

[0027] The automatic correction method based on the training model provided in the embodiment of the present application relates to the field of data processing technology. The automatic correction method based on the training model provided in the embodiment of the present application can be applied to the terminal, can also be applied to the server side, and can also be software running in the terminal or the server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or it can be configured as a server cluster or a distributed system composed of multiple physical servers, and can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements the automatic correction method based on the training model, etc., but is not limited to the above forms.

[0028] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0029] It should be noted that in each specific implementation of the present application, when it comes to the need to perform relevant processing based on data related to user identity or characteristics such as user information, user behavior data, user historical data, and user location information, the user's permission or consent will be obtained first, and the collection, use, and processing of these data will comply with the relevant laws, regulations, and standards of the relevant countries and regions. In addition, when the embodiment of the present application needs to obtain the user's sensitive personal information, the user's separate permission or consent will be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining the user's separate permission or consent, the necessary user-related data for the normal operation of the embodiment of the present application will be obtained.

[0030] There are already some text error correction systems based on natural language processing (NLP) technology on the market, such as Microsoft Word, Grammarly, etc. These systems can automatically correct and amend past documents in the financial and medical fields based on learning records. For example, in the medical field, some early technologies had limited information or errors due to the imperfect level of science and technology. These systems can automatically detect and amend these medical concepts based on the current level of technology.

[0031] Since deep learning requires a large amount of data support, some pharmaceutical industries do not have enough data to complete the training of models with higher accuracy, and low accuracy will seriously affect the use of the model, so there is currently no very mature automatic detection and correction system.

[0032] In order to solve the above problems, the present embodiment provides an automatic correction method, device, electronic device and storage medium based on a training model. First, a first medical sample set and a second medical sample set are obtained, wherein the first medical sample set includes a plurality of medical sentences to be corrected. Then, the first medical sample set and the second medical sample set are input into a teacher model of a training model for sentence correction, thereby achieving preliminary correction of the medical sentences to be corrected in the first medical sample set, ensuring the uniformity of correction results of different texts, and obtaining a first predicted text. Afterwards, the first medical sample set and the first predicted text are input into a student model of the training model for correction learning, thereby being able to effectively measure the medical sentences to be corrected and the first predicted text of the teacher model. The difference between the texts can be detected, and the gradient can be updated through back propagation to improve the correction accuracy, output the second predicted text, and then simulate the medical sentence to be corrected and the second predicted text, so that a simulated text that is more similar to the real text can be generated, thereby improving the accuracy of the generated text, and then the simulated text is weighted by the entity recognition expert model to determine the weight value of each character in the simulated text, and the weight sequence is output, which can highlight potential errors or inappropriate words, thereby guiding the correction process, and finally, the medical sentence to be corrected is corrected based on the weight sequence to obtain the target corrected sentence, so that the sentence correction can be realized more accurately and comprehensively, and the accuracy of text correction can be improved. The embodiment of the present application predicts the medical sentence to be corrected by using a teacher model and a student model respectively, then simulates the second predicted text output by the student model and the medical sentence to be corrected to obtain a simulated text, and finally corrects the medical sentence to be corrected by using the weight sequence of the simulated text to obtain a target corrected sentence. These small models can be optimized for the language characteristics and terminology of specific fields, so as to perform better on specific tasks, and do not require a large amount of data as support. They can directly use relevant models in the medical field as learning samples for learning comparison to improve the accuracy of text correction.

[0033] The following is a detailed description with reference to the accompanying drawings.

[0034] Figure 1 is an optional flowchart of the automatic correction method based on the training model provided in the embodiment of the present application, Figure 1 The method may include but is not limited to steps S101 to S106.

[0035] It should be noted that the training model in the embodiment of the present application includes a teacher model, a student model and an entity recognition expert model.

[0036] Step S101: Acquire a first medical sample set and a second medical sample set.

[0037] It should be noted that the first medical sample set includes a plurality of medical sentences to be corrected, and the second medical sample set includes a plurality of correctly spelled target medical sentences.

[0038] In step S101 of some embodiments, the embodiments of the present application obtain a first medical sample set and a second medical sample set to facilitate subsequent sentence correction, wherein the first medical sample set includes multiple medical sentences to be corrected, and the second medical sample set includes multiple correctly spelled target medical sentences.

[0039] It is understandable that, taking the first medical sample set including spelling errors of medical terms such as aspirin and rheumatism, general spelling, word order inversion and other errors as an example for explanation, the first medical sample set at this time may include "Aspirin is an antipyretic analgesic, a salicylic acid derivative, which can be used to relieve mild or moderate pain in the link, and can also be used to reduce fever in fever diseases such as colds and influenza, and treat rheumatism, etc.", where "aspirin" and "link" have typos, "salicylic acid" has missing words, and "link", "disease fever" and "rheumatism" have inverted sentences. In contrast, the second medical sample set in the embodiment of the present application may include "Aspirin is an antipyretic analgesic, a salicylic acid derivative, which can be used to relieve mild or moderate pain, and can also be used to reduce fever in fever diseases such as colds and influenza, and treat rheumatism, etc." and other correctly spelled target medical sentences.

[0040] Step S102: input the first medical sample set and the second medical sample set into a teacher model of a training model to perform sentence correction and output a first predicted text.

[0041] In step S102 of some embodiments, the first medical sample set and the second medical sample set are input into the teacher model of the training model for sentence correction to improve the accuracy of sentence correction. The teacher model can provide a consistent correction standard and output a first predicted text to ensure that the correction results of different texts are uniform.

[0042] Step S103, inputting the first medical sample set and the first predicted text into the student model of the training model for correction learning, and outputting the second predicted text.

[0043] In step S103 of some embodiments, the first medical sample set and the first predicted text are input into the student model of the training model for correction learning, so as to gradually reduce the loss, output the second predicted text, and generate a more accurate error correction text.

[0044] Step S104, performing sentence simulation on the medical sentence to be corrected and the second predicted text to obtain a simulated text.

[0045] In step S104 of some embodiments, sentence simulation is performed on the medical statement to be corrected and the second predicted text to generate a simulated sentence that is closer to the target text, thereby improving the quality of the generated text and obtaining a simulated text, thereby obtaining a more accurate and natural simulated text.

[0046] Step S105, weight calculation is performed on the simulation text through the entity recognition expert model, and a weight sequence is output.

[0047] In step S105 of some embodiments, weight calculation is performed on the simulated text through the entity recognition expert model, which can effectively process the simulated text, extract key text features, output a weight sequence, and provide support for further natural language processing tasks.

[0048] Step S106, performing sentence correction on the medical sentence to be corrected based on the weight sequence to obtain a target corrected sentence.

[0049] In step S106 of some embodiments, sentence correction is performed on the medical sentence to be corrected based on the weight sequence, which can integrate information from different parts into a vector, provide a unified representation for subsequent processing, enhance the generalization ability of different text features, obtain the target corrected sentence, and improve the professionalism and reliability of sentence correction.

[0050] See also Figure 2 In some embodiments, step S102 may also include but is not limited to steps S201 to S203.

[0051] Step S201, inputting the first medical sample set and the second medical sample set into the teacher model, so that the teacher model predicts the medical sentence to be corrected based on the target medical sentence, and outputs the predicted sentence.

[0052] Step S202, supervise the teacher model through prediction sentences to obtain a pre-trained teacher model.

[0053] Step S203: input the medical sentence to be corrected into the pre-trained teacher model for sentence correction, and output a first predicted text.

[0054] In steps S201 to S203 of some embodiments, in the process of inputting the first medical sample set and the second medical sample set into the teacher model of the training model for sentence correction, the embodiment of the present application inputs the first medical sample set and the second medical sample set into the teacher model, so that the teacher model can take the target medical sentence in the second medical sample set as the target, and perform sentence prediction on the medical sentence to be corrected, that is, take the medical sentence to be corrected as input, take the target medical sentence as output, output the predicted sentence, and be able to identify and correct various language errors, improve the accuracy of the sentence, and then supervise the teacher model through the predicted sentence to obtain a pre-trained teacher model, so that the teacher model can continuously optimize its correction ability through continuous learning, adapt to language changes and newly emerging grammatical rules, and finally input the medical sentence to be corrected into the pre-trained teacher model for sentence correction, output the first predicted text, improve the accuracy of sentence correction, and the teacher model can provide a consistent correction standard to ensure that the correction results of different texts are uniform.

[0055] It should be noted that the teacher model in the embodiment of the present application is a small model for a special field or a special application scenario. Compared with a large model, a small model usually has a faster training and reasoning speed, consumes less resources, and is suitable for use in a resource-constrained environment. And the target medical sentence in the embodiment of the present application is the text after error correction, that is, the target medical sentence with correct spelling.

[0056] See also Figure 3 In some embodiments, step S103 may also include but is not limited to steps S301 to S303.

[0057] Step S301: input the first medical sample set and the first predicted text into the student model, so that the student model performs cross entropy calculation on the medical sentence to be corrected and the first predicted text, and outputs the predicted cross entropy.

[0058] It should be noted that the prediction cross entropy is used to measure the difference between the medical sentence to be corrected and the first predicted text.

[0059] Step S302, updating the gradient of the student model according to the predicted cross entropy to obtain a pre-trained student model.

[0060] Step S303: input the medical sentence to be corrected into the pre-trained student model for sentence prediction, and output a second predicted text.

[0061] In steps S301 to S303 of some embodiments, in the process of inputting the first medical sample set and the first predicted text into the student model of the training model for correction learning, first, the first medical sample set and the first predicted text are input into the student model, so that the student model uses the medical sentence to be corrected in the first medical sample set as input and the first predicted text as the target for cross entropy calculation, thereby being able to calculate the cross entropy loss between the medical sentence to be corrected and the first predicted text, and being able to measure the difference between the medical sentence to be corrected and the first predicted text by the predicted cross entropy. Afterwards, the gradient of the student model is updated according to the predicted cross entropy, and the steps of forward propagation, loss calculation, back propagation and gradient update are repeated until the model performance reaches the expected level or reaches a predetermined number of iterations, thereby obtaining a pre-trained student model, and calculating the gradient of the model parameters through the back propagation algorithm, thereby being able to gradually reduce the loss and improve the model performance. Finally, the medical sentence to be corrected is input into the pre-trained student model for sentence prediction, and the second predicted text is output, thereby being able to generate a more accurate correction text.

[0062] It should be noted that the student model in the embodiment of the present application uses BART as a pre-training model, and adds a fully connected layer as an output layer on the basis of BART.

[0063] In some embodiments, the process of updating the gradient of the student model according to the predicted cross entropy can be expressed as follows: H(p,q)=-Σp(x)*log(q(x)); Among them, p(x) is the true probability distribution, q(x) is the probability distribution predicted by the model, and x is the label of the sample. The smaller the cross entropy, the closer the model's prediction result is to the true result.

[0064] See also Figure 4 In some embodiments, step S104 may also include but is not limited to steps S401 to S404.

[0065] It should be noted that the training model includes a discriminant model.

[0066] Step S401, using the student model as a generator, and inputting the medical sentence to be corrected into the generator for sentence simulation, and outputting a first simulation sentence.

[0067] Step S402, input the second predicted text and the target medical sentence into the discriminant model, and output a second simulation sentence.

[0068] Step S403: training the generator according to the first simulation statement and the second simulation statement.

[0069] Step S404, inputting the medical sentence to be corrected into the trained generator to perform sentence simulation to obtain a simulated text.

[0070] In steps S401 to S404 of some embodiments, after the student model is trained, the embodiment of the present application first uses the student model as a generator, and inputs the medical sentence to be corrected into the generator for sentence simulation, and outputs a first simulated sentence. Thereafter, the second predicted text and the target medical sentence are input into the discriminant model, and the second predicted text and the target medical sentence are compared using the discriminant model, and a second simulated sentence is output, thereby determining the difference between the second predicted text and the target medical sentence. The generator is then trained based on the first simulated sentence and the second simulated sentence to optimize its ability to generate text. By training the generator, it is able to generate simulated sentences that are closer to the target text, thereby improving the quality of the generated text. Finally, the medical sentence to be corrected is input into the trained generator for sentence simulation to obtain simulated text, thereby obtaining a more accurate and natural simulated text.

[0071] Specifically, after training the student model, the student model is used as a generator and a discriminator is learned. The discriminator is a self-attention layer, which is then weighted and finally a fully connected layer is added to output the discriminant value of the two categories, where classification to 0 indicates false, and classification to 1 indicates that the input is true, and the cross entropy is used as the loss function.

[0072] It can be understood that the generator in the embodiment of the present application can adjust itself according to the feedback of the discriminant model to improve the adaptability and accuracy of the generated text. The generated simulated text can more accurately reflect the characteristics of the target text and help correct and improve medical statements.

[0073] See also Figure 5 In some embodiments, step S105 may also include but is not limited to steps S501 to S504.

[0074] Step S501, performing word segmentation processing on the simulation text to obtain a plurality of simulation characters.

[0075] Step S502: input all simulated characters into the entity recognition expert model for weight calculation, and output entity category weights.

[0076] Step S503: for each simulated character, traverse all entity category weights to screen and obtain a character weight value.

[0077] Step S504: concatenate the character weight values ​​of each simulated character to obtain a weight sequence.

[0078] In steps S501 to S504 of some embodiments, in the process of weight calculation of simulated text by entity recognition expert model, first, word segmentation is performed on the simulated text to obtain multiple simulated characters, and the continuous simulated text is divided into smaller units to provide a basis for subsequent processing. Word segmentation allows each character to be individually identified and processed, thereby improving the processing precision. Afterwards, all simulated characters are input into the entity recognition expert model for weight calculation, and entity category weights are output. Through weight calculation, the key features and importance of each character can be identified, wherein the entity category weight reflects the importance of the character in different entity categories. For each simulated character, all entity category weights are traversed to screen and obtain the character weight value. Specifically, the maximum value of the weight values ​​of different categories in the character is taken as the character weight value of the character. By selecting the maximum weight value, the representation of the character is simplified, its most significant features are highlighted, and the complexity of processing is reduced. Finally, the character weight values ​​of each simulated character are connected in series to form a unified weight sequence, which is convenient for subsequent analysis and processing of the weight sequence. The simulated text can be effectively processed, key text features can be extracted, and support for further natural language processing tasks can be provided.

[0079] It should be noted that in the process of word segmentation processing of the simulated text in the embodiment of the present application, it is necessary to clean the simulated text and remove irrelevant characters and noise, such as punctuation marks, special symbols, etc., and then select a suitable word segmentation tool or algorithm according to the language and characteristics of the text. After that, the preprocessed text is input into the word segmentation algorithm for word segmentation processing to divide the simulated text into multiple simulated characters.

[0080] See also Figure 6 In some embodiments, step S106 may also include but is not limited to steps S601 to S604.

[0081] Step S601, obtaining the weight matrix of the self-attention layer of the entity recognition expert model.

[0082] It should be noted that the weight matrix is ​​used to characterize the internal representation of the simulation text.

[0083] Step S602, performing a dot product of the weight sequence and the weight matrix to obtain a dot product vector.

[0084] Step S603, updating the parameters of the training model through the dot product vector.

[0085] Step S604, input the medical statement to be corrected into the training model with updated parameters to perform sentence correction to obtain the target corrected sentence.

[0086] In steps S601 to S604 of some embodiments, in the process of correcting the medical statement to be corrected based on the weight sequence, first, the weight matrix of the self-attention layer of the entity recognition expert model is obtained, and the matrix contains the representation inside the simulated text, so that the relationship between the various parts of the text can be captured, and the relationship between the words or characters in the text can be reflected through the weight matrix. After that, the weight sequence is dot-producted with the weight matrix to obtain a dot product vector. Through the dot product operation, the weight sequence is combined with the weight matrix of the self-attention layer. The dot product can enhance the representation of important features in the text, suppress unimportant features, and can The information from different parts is integrated into a vector to provide a unified representation for subsequent processing, which enhances the generalization ability of different text features. The dot product vector is then used as feedback to update the parameters of the model through the back propagation algorithm, thereby improving the accuracy of the model correction and reducing the difference between the model prediction and the actual result. Finally, the medical sentence to be corrected is input into the training model with updated parameters for sentence correction to obtain the target corrected sentence. The medical sentence is corrected using the training model with updated parameters to generate a more accurate target corrected sentence, so that the training model can adapt to the language and terminology unique to the medical field and improve the professionalism and reliability of sentence correction.

[0087] See also Figure 7 In some embodiments, step S403 may also include but is not limited to steps S701 to S702.

[0088] Step S701, classify the second simulation sentence according to the discriminant model to obtain a classification result.

[0089] Step S702, training the generator according to the classification result and the first simulation sentence.

[0090] In steps S701 to S702 of some embodiments, in the process of training the generator according to the first simulation sentence and the second simulation sentence, the last fully connected layer of the discriminant model in the embodiment of the present application outputs one or more logit values, and the logit values ​​are used for the binary classification task, and these logit values ​​represent the probability that the input data is real data or false data generated by the generator. Therefore, the embodiment of the present application will classify the second simulation sentence according to the discriminant model to obtain the classification result, that is, divide the data into two categories of 0 and 1, and then train the generator according to the classification result and the first simulation sentence, and continuously optimize the iterative generator so that it can generate a simulation text that is more similar to the real text.

[0091] See also Figure 8 The embodiment of the present application also provides an automatic correction device based on a training model, the training model includes a teacher model, a student model and an entity recognition expert model, and the device includes: A sample acquisition module 801 is used to acquire a first medical sample set and a second medical sample set, wherein the first medical sample set includes a plurality of medical statements to be corrected; A sentence correction module 802, used for inputting the first medical sample set and the second medical sample set into a teacher model of a training model to perform sentence correction and output a first predicted text; A correction learning module 803, used for inputting the first medical sample set and the first predicted text into the student model of the training model for correction learning, and outputting a second predicted text; A sentence simulation module 804 is used to perform sentence simulation on the medical sentence to be corrected and the second predicted text to obtain a simulated text; The weight calculation module 805 is used to perform weight calculation on the simulation text through the entity recognition expert model and output a weight sequence; The sentence correction module 806 is used to perform sentence correction on the medical sentence to be corrected based on the weight sequence to obtain a target corrected sentence.

[0092] The specific implementation of the automatic correction device based on the training model is basically the same as the specific implementation of the automatic correction method based on the training model mentioned above, and will not be repeated here.

[0093] The embodiment of the present application also provides an electronic device, the electronic device comprising: a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for realizing connection and communication between the processor and the memory, and the program is executed by the processor to realize the above-mentioned automatic correction method based on the training model. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.

[0094] See also Fig. 9 , Fig. 9 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes: The processor 901 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application; The memory 902 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 902, and the processor 901 calls and executes the automatic correction method based on the training model in the embodiment of this application; Input / output interface 903, used to implement information input and output; Communication interface 904, used to realize communication interaction between the device and other devices, which can be realized through wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.); A bus 905 that transmits information between various components of the device (e.g., the processor 901, the memory 902, the input / output interface 903, and the communication interface 904); The processor 901 , the memory 902 , the input / output interface 903 and the communication interface 904 are connected to each other in communication within the device via a bus 905 .

[0095] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the above-mentioned automatic correction method based on the training model.

[0096] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0097] The automatic correction method, device, electronic device and storage medium based on the training model provided in the embodiment of the present application first obtain a first medical sample set and a second medical sample set, wherein the first medical sample set includes a plurality of medical sentences to be corrected, and then the first medical sample set and the second medical sample set are input into the teacher model of the training model for sentence correction, so as to achieve preliminary correction of the medical sentences to be corrected in the first medical sample set, ensure the uniformity of the correction results of different texts, and obtain a first predicted text, and then input the first medical sample set and the first predicted text into the student model of the training model for correction learning, so as to effectively measure the difference between the medical sentences to be corrected and the first predicted text of the teacher model. The difference between them can be found, and the gradient can be updated through back propagation to improve the correction accuracy, output the second predicted text, and then simulate the medical sentence to be corrected and the second predicted text, so that a simulated text that is more similar to the real text can be generated, thereby improving the accuracy of the generated text, and then the simulated text is weighted by the entity recognition expert model to determine the weight value of each character in the simulated text, and the weight sequence is output, which can highlight potential errors or inappropriate words, thereby guiding the correction process, and finally, the medical sentence to be corrected is corrected based on the weight sequence to obtain the target corrected sentence, so that the sentence correction can be more accurately and comprehensively implemented, and the accuracy of text correction can be improved. The embodiment of the present application predicts the medical sentence to be corrected by the teacher model and the student model respectively, and then simulates the second predicted text output by the student model and the medical sentence to be corrected to obtain the simulated text, and finally corrects the medical sentence to be corrected by the weight sequence of the simulated text to obtain the target corrected sentence. These small models can be optimized for the language characteristics and terminology of specific fields, so as to perform better on specific tasks, and do not require a large amount of data as support, and can directly use the relevant models in the medical field as learning samples for learning comparison to improve the accuracy of text correction.

[0098] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0099] It can be understood by those skilled in the art that Figure 1-7 The technical solutions shown in the figure do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than those shown in the figure, or a combination of certain steps, or different steps.

[0100] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0101] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.

[0102] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0103] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

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

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

[0106] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0107] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.

[0108] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.

Claims

1. An automatic correction method based on a training model, It is characterized in that The training model includes a teacher model, a student model and an entity recognition expert model, and the method includes: Acquire a first medical sample set and a second medical sample set, wherein the first medical sample set includes a plurality of medical statements to be corrected; Inputting the first medical sample set and the second medical sample set into the teacher model of the training model to perform sentence error correction, and outputting a first predicted text; Inputting the first medical sample set and the first predicted text into the student model of the training model for correction learning, and outputting a second predicted text; Performing sentence simulation on the medical sentence to be corrected and the second predicted text to obtain a simulated text; Performing weight calculation on the simulation text through the entity recognition expert model and outputting a weight sequence; The medical statement to be corrected is corrected based on the weight sequence to obtain a target corrected statement.

2. The automatic correction method based on the training model according to claim 1, It is characterized in that The second medical sample set includes a plurality of correctly spelled target medical sentences; The step of inputting the first medical sample set and the second medical sample set into the teacher model of the training model to perform sentence error correction and output a first predicted text comprises: Inputting the first medical sample set and the second medical sample set into the teacher model, so that the teacher model performs sentence prediction on the medical sentence to be corrected based on the target medical sentence, and outputs a predicted sentence; Performing supervised training on the teacher model through the prediction sentence to obtain a pre-trained teacher model; The medical sentence to be corrected is input into a pre-trained teacher model for sentence correction, and a first predicted text is output.

3. The automatic correction method based on the training model according to claim 1, It is characterized in that The step of inputting the first medical sample set and the first predicted text into the student model of the training model for correction learning and outputting a second predicted text comprises: Inputting the first medical sample set and the first predicted text into the student model, so that the student model performs cross entropy calculation on the medical statement to be corrected and the first predicted text, and outputs predicted cross entropy, wherein the predicted cross entropy is used to measure the difference between the medical statement to be corrected and the first predicted text; Updating the gradient of the student model according to the predicted cross entropy to obtain a pre-trained student model; The medical sentence to be corrected is input into a pre-trained student model for sentence prediction, and a second predicted text is output.

4. The automatic correction method based on the training model according to claim 1, It is characterized in that The training model includes a discriminant model; the sentence simulation of the medical statement to be corrected and the second predicted text to obtain the simulated text includes: The student model is used as a generator, and the medical statement to be corrected is input into the generator for statement simulation, and a first simulation statement is output; Inputting the second predicted text and the target medical sentence into the discriminant model, and outputting a second simulation sentence; Training the generator according to the first simulation statement and the second simulation statement; The medical sentence to be corrected is input into the trained generator for sentence simulation to obtain a simulated text.

5. The automatic correction method based on the training model according to claim 1, It is characterized in that The step of performing weight calculation on the simulation text by using the entity recognition expert model and outputting a weight sequence comprises: Performing word segmentation processing on the simulated text to obtain a plurality of simulated characters; Input all the simulated characters into the entity recognition expert model to calculate the weights, and output the entity category weights; For each of the simulated characters, traverse all the entity category weights to screen and obtain a character weight value; The character weight values ​​of each simulated character are concatenated to obtain a weight sequence.

6. The automatic correction method based on the training model according to claim 1, It is characterized in that The step of performing sentence correction on the medical sentence to be corrected based on the weight sequence to obtain a target corrected sentence includes: Obtaining a weight matrix of a self-attention layer of the entity recognition expert model, wherein the weight matrix is ​​used to characterize an internal representation of the simulated text; Performing a dot product of the weight sequence and the weight matrix to obtain a dot product vector; Perform parameter update on the training model by using the dot product vector; The medical statement to be corrected is input into the training model with updated parameters to perform sentence correction to obtain a target corrected sentence.

7. The automatic correction method based on the training model according to claim 4, It is characterized in that The step of training the generator according to the first simulation statement and the second simulation statement comprises: Performing data classification on the second simulation sentence according to the discriminant model to obtain a classification result; The generator is trained according to the classification result and the first simulation sentence.

8. An automatic correction device based on a training model, It is characterized in that The training model includes a teacher model, a student model and an entity recognition expert model, and the device includes: A sample acquisition module, used to acquire a first medical sample set and a second medical sample set, wherein the first medical sample set includes a plurality of medical statements to be corrected; A sentence correction module, used for inputting the first medical sample set and the second medical sample set into the teacher model of the training model to perform sentence correction and output a first predicted text; A correction learning module, used for inputting the first medical sample set and the first predicted text into the student model of the training model for correction learning, and outputting a second predicted text; A sentence simulation module, used for performing sentence simulation on the medical sentence to be corrected and the second predicted text to obtain a simulation text; A weight calculation module, used for performing weight calculation on the simulation text through the entity recognition expert model and outputting a weight sequence; The sentence correction module is used to perform sentence correction on the medical sentence to be corrected based on the weight sequence to obtain a target corrected sentence.

9. An electronic device, It is characterized in that The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the automatic correction method based on the training model described in any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium storing a computer program. It is characterized in that When the computer program is executed by a processor, the automatic correction method based on a training model described in any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Data classification method and device

    CN119691592A