Text error correction model training method and device and text error correction method and device
By introducing a combined training method of the main error correction model and the side branch model in the text error correction model, the problems of high training costs and long cycles in the existing technology are solved, and rapid adaptation and efficient error correction are achieved for the added error types. .
Patent Information
- Application Number
- CN202411517633.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2025-02-25
AI Technical Summary
Existing methods need to retrain large-scale language models using a combined training dataset that contains both existing error types and new error types, resulting in high training costs and long training cycles.
The combined training method of the main error correction model and the side-branch model is adopted. The main error correction model is trained based on the training data set of existing error types. The side-branch model is used as a lightweight neural network model and is connected to the output layer of the main error correction model, and is specially processed. Added error type.
While maintaining the ability to correct existing error types, it can quickly adapt to the added error types, improve the overall error correction performance of the text error correction model, and reduce training costs and cycles.
Smart Images

Figure CN119514527A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer technology, and in particular, relates to a text error correction model training method and device, and a text error correction method and device. Background Art
[0002] Text error correction is a fundamental problem in the field of Natural Language Processing (NLP). Its main purpose is to detect errors in the input of original text and correct them based on natural language processing technology.
[0003] At present, large-scale language models are mainly used to detect errors in text correction tasks. When a text correction task with a new error type appears, since the large-scale language model does not use sample data of the text correction task containing the new error type during training, it is necessary to use a combined training data set that contains both existing error types and new error types to retrain the large-scale language model, and adjust all parameters of the large-scale language model to ensure that the large-scale language can also effectively detect the new error types. However, as text correction tasks with new error types continue to emerge, if the entire large-scale language model needs to be retrained every time to adapt to these new error types, it will lead to high training costs and long training cycles. Summary of the invention
[0004] The embodiments of the present application provide a text error correction model training method and device, and a text error correction method and device, which can solve the problem that the existing method needs to use a combined training data set that includes both existing error types and newly added error types to retrain a large-scale language model, resulting in high training costs and long training cycles.
[0005] In a first aspect, an embodiment of the present application provides a method for training a text error correction model, wherein the text error correction model comprises: a main error correction model and a side branch model, wherein the side branch model is a lightweight neural network model connected to an output layer of the main error correction model, and the training method of the text error correction model comprises:
[0006] Acquire a first training data set; the first training data set includes a plurality of first training samples, each of the first training samples includes a first error text of a newly added error type and a first annotated text after correcting the first error text;
[0007] The first erroneous text and the corresponding first annotated text in the first training sample are used as model input samples and model output samples respectively, and the side model is trained to obtain a target text error correction model; wherein, the main error correction model is trained based on a second training data set, and the second training data set includes multiple second training samples, and each of the second training samples includes a second erroneous text of an existing error type and a second annotated text after correcting the second erroneous text.
[0008] In a possible implementation manner of the first aspect, the using the first erroneous text and the corresponding first annotated text in the first training sample as a model input sample and a model output sample respectively to train the side branch model includes:
[0009] Inputting the first erroneous text in the first training sample into the main error correction model, the main error correction model outputting a first decoding feature and at least one intermediate decoding feature;
[0010] Inputting the intermediate decoding feature into the side branch model, and the side branch model outputs a second decoding feature;
[0011] Determining a first predicted text according to the first decoding feature and the second decoding feature;
[0012] Calculating a loss between the first predicted text and the first annotated text;
[0013] The model parameters of the side branch model are iteratively updated according to the loss between the first predicted text and the first annotated text until the side branch model meets a preset first training stop condition.
[0014] In a possible implementation manner of the first aspect, the main error correction model includes: an encoding subnetwork and a decoding subnetwork;
[0015] The encoding subnetwork comprises: N serially connected encoders, where N is greater than 1;
[0016] The decoding sub-network comprises: N decoders connected in series;
[0017] The output end of the last encoder in the encoding sub-network is connected to the input end of the first decoder in the decoding sub-network;
[0018] The step of inputting the first erroneous text in the first training sample into the main error correction model, wherein the main error correction model outputs a first decoding feature and at least one intermediate decoding feature, comprises:
[0019] Inputting the first error text into N serially connected encoders in the encoding subnetwork in sequence to obtain encoding features of the first error text;
[0020] The encoding features of the first erroneous text are sequentially input into the N serially connected decoders in the encoding subnetwork, each decoder correspondingly outputs an intermediate decoding feature, and the intermediate decoding feature correspondingly output by the last decoder is used as the first decoding feature.
[0021] In a possible implementation manner of the first aspect, the side branch model includes: an M-layer LST network, where M is less than N;
[0022] The step of inputting the intermediate decoding feature into the side branch model, wherein the side branch model outputs a second decoding feature, comprises:
[0023] When the input layer of the side branch model is the first layer LST network, the initial vector and the intermediate decoding features output by the NMth layer decoder are input into the first layer LST network to obtain the features output by the first layer LST network;
[0024] The intermediate decoding features output by the N-M+i layer decoder and the features output by the i-th layer LST network are input to the i+1-th layer LST network to obtain the features output by the i+1-th layer LST network, and the features output by the M-th layer LST network are determined as the second decoding features; i is a positive integer from 1 to M-1.
[0025] In a possible implementation manner of the first aspect, determining the first predicted text according to the first decoding feature and the second decoding feature includes:
[0026] Fusing the first decoding feature and the second decoding feature to obtain a first fused feature;
[0027] The first predicted text is determined according to the first fused feature.
[0028] In a second aspect, an embodiment of the present application provides a text error correction method, comprising:
[0029] Get the target text;
[0030] The target text is input into a target text error correction model to obtain a text after the target text is corrected, wherein the target text error correction model is trained using the text error correction model training method described in any one of the first aspects above.
[0031] In a third aspect, an embodiment of the present application provides a training device for a text error correction model, the text error correction model comprising: a main error correction model and a side branch model, the side branch model being a lightweight neural network model connected to an output layer of the main error correction model, the training device for the text error correction model comprising:
[0032] A first training data set acquisition module is used to acquire a first training data set; the first training data set includes a plurality of first training samples, each of which includes a first error text of a newly added error type and a first annotated text after correcting the first error text;
[0033] A training module is used to use the first erroneous text and the corresponding first annotated text in the first training sample as a model input sample and a model output sample respectively, train the side model, and obtain a target text error correction model; wherein, the main error correction model is trained based on a second training data set, and the second training data set includes multiple second training samples, each of the second training samples includes a second erroneous text of an existing error type and a second annotated text after correcting the second erroneous text.
[0034] In a fourth aspect, an embodiment of the present application provides a text error correction device, including:
[0035] A target text acquisition module is used to acquire the target text;
[0036] An input-output module is used to input the target text into a target text error correction model to obtain a text after the target text is corrected, wherein the target text error correction model is trained using the text error correction model training method described in any one of the first aspects above.
[0037] In a fifth aspect, an embodiment of the present application provides a terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the training method of the text error correction model as described in any one of the first aspects above is implemented, or, when the processor executes the computer program, the text error correction method as described in the second aspect above is implemented.
[0038] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the computer program implements the training method of the text error correction model as described in any one of the first aspects above, or, when the computer program is executed by a processor, the computer program implements the text error correction method as described in the second aspect above.
[0039] In the seventh aspect, an embodiment of the present application provides a computer program product, which, when executed on a terminal device, enables the terminal device to implement the training method of a text error correction model as described in any one of the first aspects above, or enables the terminal device to implement the text error correction method as described in the second aspect above.
[0040] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0041] The training method of the text error correction model provided in the first aspect of the embodiment of the present application, when a text error correction task of a new error type appears, it is not necessary to retrain the main error correction model using a combined training data set that includes both existing error types and new error types, but the main error correction model that has been pre-trained is used to process text error correction tasks of multiple known error types, and the text error correction tasks of the new error types are processed by the side branch model. Under the collaborative work of the main error correction model and the side branch model, the text error correction model can more comprehensively cover text errors of all error types, that is, while maintaining the ability to correct existing error types, it can also correct new error types, thereby improving the overall error correction performance of the text error correction model. The text error correction method provided in the second aspect of the embodiment of the present application, whether it is processing text error correction tasks of existing error types or processing text error correction tasks of new error types, can use the target text error correction model to quickly and accurately perform comprehensive error correction on various error types existing in the text.
[0042] It is understood that the beneficial effects of the third aspect, the fifth aspect to the seventh aspect can refer to the relevant description in the first aspect, and will not be repeated here. The beneficial effects of the fourth aspect, the fifth aspect to the seventh aspect can refer to the relevant description in the second aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0044] Figure 1 It is a flowchart of a method for training a text error correction model provided in one embodiment of the present application;
[0045] Figure 2 It is an overall structural block diagram of a text error correction model provided by an embodiment of the present application;
[0046] Figure 3 is a flowchart of the sub-steps of step S102 provided in an embodiment of the present application;
[0047] Figure 4 It is a schematic diagram of the data processing process of the side branch model in the text error correction model provided in one embodiment of the present application during the training process;
[0048] Figure 5 is a flowchart of the sub-steps of step S1021 provided in an embodiment of the present application;
[0049] Figure 6 is a flowchart of the sub-steps of step S1022 provided in an embodiment of the present application;
[0050] Figure 7 is a flowchart of the sub-steps of step S1023 provided in an embodiment of the present application;
[0051] Figure 8 It is a flowchart of a text error correction method provided by an embodiment of the present application;
[0052] Fig. 9 It is a structural schematic diagram of a training device for a text error correction model provided in one embodiment of the present application;
[0053] Fig.10 It is a structural schematic diagram of a text error correction device provided by an embodiment of the present application;
[0054] Fig.11 It is a structural diagram of a terminal device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0055] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0056] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0057] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0058] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0059] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0060] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. appearing in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways.
[0061] At present, large-scale language models are mainly used for error detection in text error correction tasks. When using large-scale language models for error detection in text error correction tasks, it is necessary to obtain training data sets of all text error types and train the large-scale language model based on these training data sets. During the training process, all parameters of the large-scale language model need to be readjusted to ensure that the large-scale language model can effectively detect various error types. However, as new error types of text error correction tasks continue to emerge, if the entire large-scale language model needs to be retrained every time to adapt to these new error types, the training cost and resource investment will be very huge.
[0062] An embodiment of the present application provides a method for training a text error correction model. When a text error correction task with a new error type appears, there is no need to retrain the main error correction model using a combined training data set that includes both existing error types and new error types. Instead, the pre-trained main error correction model is used to process text error correction tasks of multiple known error types, and the side model is used to process text error correction tasks of the new error type. With the coordinated work of the main error correction model and the side model, the text error correction model can more comprehensively cover text errors of all error types, that is, while maintaining the ability to correct existing error types, it can also correct new error types, thereby improving the overall error correction performance of the text error correction model.
[0063] See also Figure 1 , is a flow chart of a method for training a text error correction model provided in an embodiment of the present application. As an example but not a limitation, the method for training a text error correction model may include the following steps S101 and S102.
[0064] Step S101: Acquire a first training data set; the first training data set includes a plurality of first training samples, each of which includes a first error text of a newly added error type and a first annotated text after correcting the first error text.
[0065] Specifically, the text may contain multiple types of errors, including but not limited to phonetic errors, morphological errors, multiple-word errors, missing-word errors, and grammatical errors, etc. These error types may be existing error types that have appeared during the large-scale language model training phase, or they may be newly added error types that have appeared later and have not been encountered by the large-scale language model during training.
[0066] When dealing with text correction tasks with newly added error types, it is crucial to construct a first training data set that includes the newly added error types. Specifically, first collect the first error texts corresponding to the text correction tasks with the newly added error types from multiple channels (such as social media, forums, user feedback, etc.). After collecting multiple first error texts, manually correct the collected first error texts to generate corresponding first annotated texts. The first annotated text is the correct text after the first error texts are corrected. Combine each pair of first error texts and the corresponding first annotated text into a first training sample, collect multiple first training samples, and the first training data set is composed of multiple first training samples.
[0067] Step S102: Use the first erroneous text and the corresponding first annotated text in the first training sample as the model input sample and the model output sample respectively, train the side model, and obtain the target text error correction model; wherein, the main error correction model is trained based on the second training data set, and the second training data set includes multiple second training samples, each second training sample includes a second erroneous text of an existing error type and a second annotated text after correcting the second erroneous text.
[0068] Specifically, the text error correction model of this embodiment includes a main error correction model and a side branch model, wherein the main error correction model is a large-scale language model (such as BERT, GPT, etc.), and the main error correction model is trained with a large amount of text data containing a variety of existing error types, and can capture the complexity and diversity of language, so as to have the ability to identify and correct text errors of a variety of existing error types. The side branch model is a lightweight neural network model connected to the output layer of the main error correction model. The main function of the side branch model is to supplement the main error correction model and specifically handle text errors of new error types that the main error correction model has not been exposed to during the training process. In this embodiment, on the basis of the main error correction model, a lightweight neural network model is trained, which can reduce the training cycle and reduce the training cost, thereby quickly and accurately realizing comprehensive error correction of various error types in the input text to be corrected.
[0069] When training the text error correction model, this embodiment adopts a staged training strategy, first training a main error correction model to handle text error correction tasks of multiple existing error types. Among them, the main error correction model is obtained by training with a second training data set composed of a large number of second training samples (including second error texts of existing error types and second annotated texts after correcting the second error texts). During the training process, by iteratively updating the model parameters of the main error correction model, the main error correction model can gradually learn the characteristics of these existing error types and effective correction methods, so the main error correction model can handle text error correction tasks of multiple existing error types. Once the main error correction model is trained, the model parameters of the main error correction model are fixed, and in the subsequent training of the side model, the model parameters of the main error correction model will be frozen and will no longer change.
[0070] Afterwards, a first training data set composed of multiple first training samples (including a first error text of a newly added error type and a first annotated text after correcting the first error text) is used to train a side branch model in the text error correction model, that is, the first error text in the first training sample is used as an input sample of the text error correction model, and the first annotated text corresponding to the first error text in the first training sample is used as an output sample of the text error correction model to train the side branch model. During the training process, the model parameters of the main error correction model after training are kept unchanged, and the model parameters of the side branch model are continuously updated iteratively until the number of training reaches the maximum number of iterations or the loss change between the first annotated text and the prediction result predicted by the side branch model is lower than a preset threshold. The training of the side branch model is completed. At this time, the trained side branch model learns the corresponding characteristics of the newly added error type and an effective correction method. Therefore, the side branch model can handle the text error correction task of the newly added error type.
[0071] In this embodiment, the number of first training samples in a first training data set of a newly added error type is much smaller than the number of second training samples in a second training data set of multiple existing error types, and the number of model parameters of the side model is much smaller than the number of model parameters of the main error correction model. In a specific example, the number of model parameters of the side model is designed to be 1% of the number of model parameters of the main error correction model.
[0072] It should be noted that designing the number of model parameters of the side model to be 1% of the number of model parameters of the main error correction model is a specific example. This embodiment can adjust the ratio of the number of model parameters of the side model to the number of model parameters of the main error correction model according to actual conditions.
[0073] The text error correction model provided by the embodiment of the present application, wherein the main error correction model is the basic part of the text error correction model, responsible for processing most of the text error correction tasks of known error types, and the side model is used as a supplement to process text error correction tasks of specific, newly added error types. When a text error correction task of a new error type appears, there is no need to retrain the entire error correction model based on a combined training data set of existing error types and new error types. Instead, the pre-trained main error correction model is used to process text error correction tasks of multiple known error types, and the side model is used to process text error correction tasks of new error types. With the coordinated work of the main error correction model and the side model, the text error correction model can more comprehensively cover text errors of all error types, that is, while maintaining the ability to correct existing error types, it can also correct new error types, thereby improving the overall error correction performance of the text error correction model.
[0074] In some embodiments, Figure 2 The overall structural block diagram of the text error correction model provided by the embodiment of the present application is shown as follows: Figure 2 As shown, the text error correction model includes a main error correction model 11 and a side branch model 12. The main error correction model 11 includes an encoding subnetwork and a decoding subnetwork; the encoding subnetwork includes N encoders connected in series (encoder 1, encoder 2, ..., encoder N-1 and encoder N), where N is greater than 1, and the output of each encoder is used as the input of the next encoder. Specifically, encoder 1 first processes the input text to obtain the output of encoder 1, and then passes the output of encoder 1 to encoder 2. Encoder 2 further processes the text based on the output of encoder 1 to obtain the output of encoder 2, and passes the output of encoder 2 to encoder 3. And so on, until encoder N-1 further processes the text based on the output of encoder N-2 to obtain the output of encoder N-1, and passes the output of encoder N-1 to the last encoder N. Encoder N will perform the final text processing based on the output of encoder N-1 to obtain the output of encoder N. At this time, the output of encoder N is the final encoding feature of the input text.
[0075] In this embodiment, through this hierarchical structure, each encoder can extract deeper features based on the previous encoder. This hierarchical feature extraction helps the main error correction model to better understand the input text and generate more accurate output in the subsequent decoding process.
[0076] The decoding subnetwork includes N decoders connected in series (decoder 1, decoder 2, ..., decoder N-1 and decoder N); the output of each decoder serves as the input of the next decoder. The output of the last encoder (encoder N) in the encoding subnetwork is connected to the input of the first decoder (decoder 1) in the decoding subnetwork. Specifically, the final encoding features of the input text output by encoder N are used as the input of decoder 1. Decoder 1 performs decoding processing based on the final encoding features of the input text to obtain the output of decoder 1, and passes the output of decoder 1 to decoder 2. Decoder 2 performs decoding processing based on the output of decoder 1 to obtain the output of decoder 2, and passes the output of decoder 2 to decoder 3. And so on, until decoder N-1 performs decoding processing based on the output of decoder N-2 to obtain the output of decoder N-1, and passes the output of decoder N-1 to the last decoder N. Decoder N will perform the final decoding processing based on the output of decoder N-1 to obtain the output of decoder N. At this time, the output of decoder N is the decoding feature output by the main error correction model 11.
[0077] The side branch model 12 includes: M layers of LST networks (LST network 1, ..., LST network M-1 and LST network M), where M is less than N. When the input layer of the side branch model is the first layer of LST network, LST network M serves as the last layer of LST network of the side branch model 12. At this time, LST network M corresponds to decoder N. Correspondingly, LST network M-1 corresponds to decoder N-1. Similarly, LST network 1 corresponds to decoder N-M+1. The first layer of LST network (LST network 1) of the side branch model receives two inputs: one is the decoding feature output by decoder NM of the main error correction model 11; the other is the initial vector assigned to LST network 1. Similarly, the second layer of LST network (LST network 2) of the side branch model receives two inputs: one is the decoding feature output by decoder N-M+1 of the main error correction model 11; the other is the decoding feature output by LST network 1. By analogy, the M-1th layer LST network (LST network M-1) of the side branch model receives two inputs: one is the decoding features output by the decoder N-2 of the main error correction model 11; the other is the decoding features output by the LST network M-2. The M-th layer LST network (LST network M) of the side branch model receives two inputs: one is the decoding features output by the decoder N-1 of the main error correction model 11; the other is the decoding features output by the LST network M-1. At this time, the output of the LST network M is the decoding features output by the side branch model 12.
[0078] In a specific example, there are multiple methods for obtaining the initial vector assigned to the LST network 1. For example, the initial vector can be determined by a series of random values generated by a random initialization method. After the initial vector is determined, the initial vector is obtained by accessing the random value array created in the random initialization process; or, the initial vector is determined as a zero vector, and the initial vector is obtained by accessing the created array in which all elements are initialized to zero. In addition to the above examples, the initial vector can also be obtained by other methods, and the specific method for obtaining the initial vector is not limited here.
[0079] In some embodiments, Figure 3 FIG. 1 is a flow chart showing the sub-steps of step S102 provided in an embodiment of the present application. Figure 3 As shown, step S102 may further include steps S1021 to S1025.
[0080] Step S1021: inputting a first erroneous text in a first training sample into a main error correction model, and the main error correction model outputs a first decoding feature and at least one intermediate decoding feature.
[0081] In a specific example, Figure 4 A schematic diagram showing the data processing process of the side branch model in the text error correction model provided in the embodiment of the present application during the training process is shown, as shown in FIG. Figure 4 As shown, the main error correction model in the text error correction model is, for example, a T5 model based on the Transformer architecture, including N encoders and N decoders. For example, when N=4, the four encoders are encoder 1, encoder 2, encoder 3 and encoder 4. The four decoders are decoder 1, decoder 2, decoder 3 and decoder 4. Among them, the input end of encoder 1 serves as the input end of the main error correction model, the output end of encoder 1 is connected to the input end of encoder 2, the output end of encoder 2 is connected to the input end of encoder 3, the output end of encoder 3 is connected to the input end of encoder 4, the output end of encoder 4 is connected to the input end of decoder 1, the output end of decoder 1 is connected to the input end of decoder 2, the output end of decoder 2 is connected to the input end of decoder 3, the output end of decoder 3 is connected to the input end of decoder 4, and the output ends of decoder 1, decoder 2, decoder 3 and decoder 4 are all used as the output ends of the main error correction model.
[0082] The first error text in the first training sample is input into the main error correction model, that is, the first error text is used as the input of the encoder 1 of the main error correction model, and after the encoding process of encoders 1 to 4, the final encoding feature corresponding to the first error text output by encoder 4 is obtained, and the final encoding feature of the first error text is used as the input of decoder 1, and after the decoding process of decoders 1 to 4, decoder 1 outputs an intermediate decoding feature, decoder 2 outputs an intermediate decoding feature, decoder 3 outputs an intermediate decoding feature, and decoder 4 outputs a first decoding feature. At this time, the first decoding feature output by decoder 4 is the first decoding feature output by the main error correction model based on the frozen model parameters, and the first decoding feature can be used to perform text error correction of the first error text with existing error types.
[0083] In some embodiments, Figure 5 FIG. 1 is a flow chart showing the sub-steps of step S1021 provided in an embodiment of the present application. Figure 5 As shown, step S1021 may further include step S10211 and step S10212.
[0084] Step S10211: input the first error text into the N serially connected encoders in the encoding subnetwork in sequence to obtain the encoding features of the first error text.
[0085] Specifically, the first error text is converted into a corresponding word representation vector, and a corresponding position encoding feature is added to each word representation vector. Next, the word representation vector and the corresponding position encoding feature corresponding to the first error text are input into encoder 1, and encoder 1 processes the corresponding input to obtain the encoding features output by encoder 1. The encoding features output by encoder 1 are input into encoder 2, and encoder 2 processes the corresponding input to obtain the encoding features output by encoder 2. The encoding features output by encoder 2 are input into encoder 3, and encoder 3 processes the corresponding input to obtain the encoding features output by encoder 3. The encoding features obtained by the output of encoder 3 are input into encoder 4, and encoder 4 processes the corresponding input to obtain the encoding features output by encoder 4. At this time, the encoding features output by encoder 4 contain all word representation vectors and rich contextual relationships of the first error text, that is, the final encoding features of the first error text.
[0086] Step S10212: The encoding features of the first erroneous text are sequentially input into N serially connected decoders in the encoding subnetwork, each decoder outputs an intermediate decoding feature, and the intermediate decoding feature output by the last decoder is used as the first decoding feature.
[0087] Specifically, the encoding feature output by encoder 4 (the final encoding feature of the first error text) is input to decoder 1. Decoder 1 performs decoding processing based on the final encoding feature of the first error text and outputs the corresponding decoding feature, that is, outputs an intermediate decoding feature. The decoding feature output by decoder 1 is used as the input of decoder 2. Decoder 2 performs decoding processing based on the decoding feature output by decoder 1 and outputs the corresponding decoding feature, that is, outputs an intermediate decoding feature. Similarly, the decoding feature output by decoder 2 is used as the input of decoder 3. Decoder 3 performs decoding processing based on the decoding feature output by decoder 2 and outputs the corresponding decoding feature, that is, outputs an intermediate decoding feature. Finally, the decoding feature output by decoder 3 is used as the input of decoder 4. Decoder 4 performs decoding processing based on the decoding feature output by decoder 3 and outputs the corresponding decoding feature, that is, outputs an intermediate decoding feature. Since decoder 4 is the last decoder of the main error correction model, at this time, the intermediate decoding feature output by decoder 4 is used as the first decoding feature.
[0088] Step S1022: input the intermediate decoding feature to the side branch model, and the side branch model outputs the second decoding feature.
[0089] In addition to the main error correction model, the text error correction model also includes a side branch model. The intermediate decoding features output by decoder 1, decoder 2 and decoder 3 can be used as an input of a certain layer of the LST network of the side branch model respectively. Combined with other inputs of the side branch network, a second decoding feature can be obtained. The second decoding feature can be used to perform text error correction on the first erroneous text with newly added error types.
[0090] In some embodiments, Figure 6 FIG. 1 is a flow chart showing the sub-steps of step S1022 provided in an embodiment of the present application. Figure 6 As shown, step S1022 may further include step S10221 and step S10222.
[0091] Step S10221: When the input layer of the side branch model is the first layer LST network, the initial vector and the intermediate decoding features output by the NMth layer decoder are input into the first layer LST network to obtain the features output by the first layer LST network.
[0092] Specifically, when the input layer of the side branch model is the first layer LST network, the initial vector and the intermediate decoding features output by the NMth layer decoder are input into the first layer LST network, and the first layer LST network processes the corresponding input to obtain the decoding features output by the first layer LST network.
[0093] Step S10222: Input the intermediate decoding features output by the N-M+i layer decoder and the features output by the i-th layer LST network into the i+1-th layer LST network to obtain the features output by the i+1-th layer LST network, and determine the features output by the M-th layer LST network as the second decoding features; i is a positive integer from 1 to M-1.
[0094] Specifically, when i=1, the intermediate decoding features output by the N-M+1th layer decoder and the features output by the 1st layer LST network are input to the 2nd layer LST network, and the 2nd layer LST network processes the corresponding input to obtain the decoding features output by the 2nd layer LST network. Similarly, when i=2, the intermediate decoding features output by the N-M+2th layer decoder and the features output by the 2nd layer LST network are input to the 3rd layer LST network, and the 3rd layer LST network processes the corresponding input to obtain the decoding features output by the 3rd layer LST network. Until, when i=M-1, the intermediate decoding features output by the N-1th layer decoder and the features output by the M-1th layer LST network are input to the Mth layer LST network, and the Mth layer LST network processes the corresponding input to obtain the decoding features output by the Mth layer LST network. At this time, the features output by the Mth layer LST network are the second decoding features.
[0095] Continuing with the above example, Figure 4 As shown, the side branch model includes, for example, M layers of LST networks, where M is less than N. For example, when M=3, the 3 layers of LST networks are LST network 1, LST network 2, and LST network 3. The intermediate decoding features are input into the side branch model, that is, the intermediate decoding features and the initial vector output by decoder 1 are input into LST network 1, and LST network 1 processes the corresponding input to obtain the decoding features output by LST network 1. The intermediate decoding features output by decoder 2 and the decoding features output by LST network 1 are input into LST network 2, and LST network 2 processes the corresponding input to obtain the decoding features output by LST network 2. The intermediate decoding features output by decoder 3 and the decoding features output by LST network 2 are input into LST network 3, and LST network 3 processes the corresponding input to obtain the decoding features output by LST network 3. At this time, the decoding features output by LST network 3 are the second decoding features output by the side branch model based on the current model parameters.
[0096] In some embodiments, step S10222 may further include step S102221 and step S102222.
[0097] Step S102221: Concatenate the intermediate decoding features output by the N-M+i layer decoder and the features output by the i-th layer LST network to obtain a concatenated feature vector.
[0098] Step S102222: Perform dimension reduction, feature extraction and dimension increase processing on the concatenated feature vector to obtain the features output by the i+1th layer network.
[0099] In a specific example, for each layer of the LST network, dimensionality reduction processing is required, and feature extraction is performed on the data after dimensionality reduction processing. After feature extraction, dimensionality increase processing is performed so that the features output by each layer of the LST network, when input into the next layer of the LST network layer, are consistent with the dimensions of the intermediate decoding features input into the next layer of the LST network.
[0100] Specifically, for LST network 1, the dimension of the intermediate decoding features output by decoder 1 is kept consistent with the dimension of the initial vector, and features are concatenated to obtain a corresponding concatenated feature vector. Before the corresponding concatenated feature vector is transmitted to LST network 1, LST network 1 first performs dimensionality reduction processing on the corresponding concatenated feature vector, and then performs feature extraction on the corresponding concatenated feature vector after dimensionality reduction processing to obtain the corresponding features; finally, the corresponding features are processed by dimensionality increase to obtain the decoding features output by LST network 1. For LST network 2, the intermediate decoding features output by decoder 2 and the decoding features output by LST network 1 are concatenated to obtain a corresponding concatenated feature vector. Before the corresponding concatenated feature vector is transmitted to LST network 2, LST network 2 first performs dimensionality reduction processing on the corresponding concatenated feature vector, and then performs feature extraction on the corresponding concatenated feature vector after dimensionality reduction processing to obtain the corresponding features; finally, the corresponding features are processed by dimensionality increase to obtain the decoding features output by LST network 2. For LST network 3, the intermediate decoding features output by decoder 3 and the decoding features output by LST network 2 are concatenated to obtain a corresponding concatenated feature vector. When the corresponding concatenated feature vector is transmitted to LST network 3, LST network 3 first performs dimensionality reduction processing on the corresponding concatenated feature vector, and then performs feature extraction on the corresponding concatenated feature vector after dimensionality reduction processing to obtain the corresponding features; finally, the corresponding features are dimensionality increased to obtain the decoding features output by LST network 3. When LST network 3 is the last layer of LST network in the side branch model, the decoding features output by LST network 3 are the second decoding features.
[0101] Step S1023: Determine a first predicted text according to the first decoding feature and the second decoding feature.
[0102] Specifically, there are multiple implementation methods for determining the first predicted text based on the first decoding feature and the second decoding feature. For example, the first decoding feature and the second decoding feature are feature-fused, and the first predicted text is determined based on the fused features after the first decoding feature and the second decoding feature are feature-fused. For another example, the first decoding feature and the second decoding feature are input into a pre-trained text generation model, and the text generation model generates the first predicted text. In addition to the above examples, the first predicted text can also be determined based on the first decoding feature and the second decoding feature in other ways. The specific implementation method for determining the first predicted text based on the first decoding feature and the second decoding feature is not limited here.
[0103] In some embodiments, Figure 7 is a flowchart of the sub-steps of step S1023 provided in an embodiment of the present application, see Figure 7 As shown, step S1023 includes step S10231 and step S10232.
[0104] Step S10231: Fusing the first decoding feature and the second decoding feature to obtain a first fused feature.
[0105] In a specific example, there are multiple methods for implementing feature fusion of the first decoding feature and the second decoding feature, for example, concatenating the first decoding feature and the second decoding feature to obtain the first fusion feature; or adding the first decoding feature and the second decoding feature to obtain the first fusion feature. In addition to the above examples, the first decoding feature and the second decoding feature can also be fused by other methods, and the specific fusion method for fusing the first decoding feature and the second decoding feature is not limited here.
[0106] Step S10232: Determine a first predicted text according to the first fusion feature.
[0107] In a specific example, the first fused feature is input into a fully connected layer, and the fully connected layer generates a first predicted text according to the first fused feature.
[0108] Step S1024: Calculate the loss between the first predicted text and the first annotated text.
[0109] Specifically, after obtaining the first predicted text, the first predicted text is compared with the first annotated text in the first training sample, and the loss between the first predicted text and the first annotated text in the first training sample is calculated, for example, using a cross entropy loss function to calculate the cross entropy loss value between the first predicted text and the first annotated text in the first training sample.
[0110] Step S1025: iteratively update the model parameters of the side branch model according to the loss between the first predicted text and the first annotated text, until the side branch model meets a preset first training stop condition.
[0111] Specifically, according to the calculated cross entropy loss value between the first predicted text and the first annotated text, the cross entropy loss value is back-propagated to each layer of the side branch model through the back propagation algorithm, so as to calculate the gradient of the model parameters of each layer of the side branch model. Then, the model parameters of the side branch model are updated according to these gradients using an optimization algorithm (such as Adam, SGD, etc.). The optimization algorithm adjusts the value of the model parameter to minimize the loss between the first predicted text and the corresponding first annotated text, and the process of step S1022 to step S1025 is repeated multiple times (since the model parameters of the main error correction model are frozen after the training is completed, the process of step S1021 does not need to be repeated) until the side branch model meets the preset first training stop condition. Among them, the first training stop condition includes: when the change in the loss between the first predicted text and the first annotated text is reduced to below a preset threshold, that is, the side branch model has converged and the training stops; or, when the side branch model is being trained, if the training round reaches the preset maximum training round, the training stops.
[0112] Figure 8 The flowchart of the text error correction method provided by an embodiment of the present application is shown. Figure 8 As shown, the text error correction method includes step S201 and step S202.
[0113] Step S201: Obtain target text.
[0114] The target text may contain text errors of various error types, including but not limited to phonetic errors, morphological errors, multiple-word errors, missing-word errors, and grammatical errors, etc. These error types may be existing error types or newly added error types.
[0115] In a specific example, there are many methods for obtaining the target text. For example, the speech can be converted into text through speech recognition technology, and the converted text can be used as the input text to be corrected; or, the text directly input by the user on the computer can be obtained, and the obtained text can be used as the target text; or, the text can be extracted from the scanned document or picture by using optical character recognition (OCR) technology, and the extracted text can be used as the target text. In addition to the above examples, the target text can also be obtained by other methods, and the specific method of obtaining the target text is not limited here.
[0116] Step S202: inputting the target text into the target text error correction model to obtain a text after the target text is corrected, wherein the target text error correction model is trained using the training method of the above text error correction model.
[0117] The text correction method provided in the embodiment of the present application can use the target text correction model to quickly and accurately perform comprehensive correction on various error types existing in the text, whether it is processing a text correction task with existing error types or a text correction task with newly added error types.
[0118] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0119] Corresponding to the training method of the text error correction model described in the above embodiment, Fig. 9 This is a structural block diagram of a training device for a text error correction model provided in an embodiment of the present application. For ease of explanation, only the parts related to the embodiment of the present application are shown.
[0120] Reference Fig. 9 The text error correction model includes: a main error correction model and a side branch model, wherein the side branch model is a lightweight neural network model connected to the output layer of the main error correction model, and the training device of the text error correction model includes:
[0121] The first training data set acquisition module 91 is used to acquire a first training data set; the first training data set includes multiple first training samples, each of which includes a first error text of a newly added error type and a first annotated text after correcting the first error text.
[0122] The training module 92 is used to use the first erroneous text and the corresponding first annotated text in the first training sample as the model input sample and the model output sample respectively, to train the side model and obtain the target text error correction model; wherein the main error correction model is trained based on the second training data set, and the second training data set includes multiple second training samples, each of the second training samples includes a second erroneous text of an existing error type and a second annotated text after correcting the second erroneous text.
[0123] In some embodiments, the training module 92 is further configured to:
[0124] Inputting the first erroneous text in the first training sample into the main error correction model, the main error correction model outputting a first decoding feature and at least one intermediate decoding feature;
[0125] Inputting the intermediate decoding feature into the side branch model, and the side branch model outputs a second decoding feature;
[0126] Determining a first predicted text according to the first decoding feature and the second decoding feature;
[0127] Calculating a loss between the first predicted text and the first annotated text;
[0128] The model parameters of the side branch model are iteratively updated according to the loss between the first predicted text and the first annotated text until the side branch model meets a preset first training stop condition.
[0129] In some embodiments, the main error correction model includes: an encoding subnetwork and a decoding subnetwork;
[0130] The encoding subnetwork comprises: N serially connected encoders, where N is greater than 1;
[0131] The decoding sub-network comprises: N decoders connected in series;
[0132] The output end of the last encoder in the encoding sub-network is connected to the input end of the first decoder in the decoding sub-network;
[0133] The training module 92 is also used to:
[0134] Inputting the first error text into N serially connected encoders in the encoding subnetwork in sequence to obtain encoding features of the first error text;
[0135] The encoding features of the first erroneous text are sequentially input into the N serially connected decoders in the encoding subnetwork, each decoder correspondingly outputs an intermediate decoding feature, and the intermediate decoding feature correspondingly output by the last decoder is used as the first decoding feature.
[0136] In some embodiments, the side branch model includes: an M-layer LST network, where M is less than N;
[0137] The training module 92 is also used to:
[0138] When the input layer of the side branch model is the first layer LST network, the initial vector and the intermediate decoding features output by the NMth layer decoder are input into the first layer LST network to obtain the features output by the first layer LST network.
[0139] The intermediate decoding features output by the N-M+i layer decoder and the features output by the i-th layer LST network are input to the i+1-th layer LST network to obtain the features output by the i+1-th layer LST network, and the features output by the M-th layer LST network are determined as the second decoding features; i is a positive integer from 1 to M-1.
[0140] In some embodiments, the training module 92 is further configured to:
[0141] The first decoding feature and the second decoding feature are fused to obtain a first fused feature.
[0142] The first predicted text is determined according to the first fused feature.
[0143] Corresponding to the text error correction method described in the above embodiment, Fig.10 This is a structural block diagram of a text correction device provided in an embodiment of the present application. For ease of explanation, only the parts related to the embodiment of the present application are shown.
[0144] Reference Fig.10 , the text error correction device comprises:
[0145] The target text acquisition module 101 is used to acquire the target text.
[0146] The error correction module 102 is used to input the target text into a target text error correction model to obtain a text after the target text is corrected, wherein the target text error correction model is trained using the training method of the text error correction model.
[0147] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0148] in addition, Fig. 9 The training device of the text error correction model shown Fig.10 The text error correction device shown can be a software unit, a hardware unit, or a combination of software and hardware units built into an existing terminal device, or can be integrated into the terminal device as an independent hang-up, or can exist as an independent terminal device.
[0149] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0150] Fig.11 Schematic diagram of the structure of the terminal device provided in the embodiment of the present application. Fig.11 As shown, the terminal device of this embodiment includes: at least one processor 110 ( Fig.11 Only one processor is shown in the figure), a memory 111, and a computer program 112 stored in the memory 111 and executable on the at least one processor 110, wherein the processor 110 implements the steps in the above-mentioned training method of any individual text error correction model / text error correction method embodiment when executing the computer program 112.
[0151] The terminal device may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The terminal device may include, but is not limited to, a processor and a memory. Those skilled in the art will understand that Fig.11 It is only an example of a terminal device and does not constitute a limitation on the terminal device. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, it may also include input and output devices, network access devices, etc.
[0152] The processor 110 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0153] In some embodiments, the memory 111 may be an internal storage unit of the terminal device, such as a hard disk or memory of the terminal device. In other embodiments, the memory 111 may also be an external storage device of the terminal device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the terminal device. Further, the memory 111 may also include both an internal storage unit of the terminal device and an external storage device. The memory 111 is used to store an operating system, an application program, a boot loader (Boot Loader), data, and other programs, such as the program code of the computer program, etc. The memory 111 may also be used to temporarily store data that has been output or is to be output.
[0154] 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 can implement the steps in the above-mentioned training method of each text error correction model / text error correction method embodiment.
[0155] An embodiment of the present application provides a computer program product. When the computer program product is run on a terminal device, the terminal device implements the steps in the training method / text correction method embodiment of the above-mentioned text error correction model when executing.
[0156] 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 present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the device / terminal device, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), an electric carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0157] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0158] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0159] In the embodiments provided in the present application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or 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.
[0160] The units described 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.
[0161] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A training method for a text error correction model, characterized in that: The text error correction model includes: a main error correction model and a side branch model, wherein the side branch model is a lightweight neural network model connected to the output layer of the main error correction model. The training method of the text error correction model includes: Acquire a first training data set; the first training data set includes a plurality of first training samples, each of the first training samples includes a first error text of a newly added error type and a first annotated text after correcting the first error text; The first erroneous text and the corresponding first annotated text in the first training sample are used as model input samples and model output samples respectively, and the side model is trained to obtain a target text error correction model; wherein, the main error correction model is trained based on a second training data set, and the second training data set includes multiple second training samples, and each of the second training samples includes a second erroneous text of an existing error type and a second annotated text after correcting the second erroneous text.
2. The training method of the text error correction model according to claim 1, characterized in that: The using the first erroneous text and the corresponding first annotated text in the first training sample as a model input sample and a model output sample respectively to train the side branch model includes: Inputting the first erroneous text in the first training sample into the main error correction model, the main error correction model outputting a first decoding feature and at least one intermediate decoding feature; Inputting the intermediate decoding feature into the side branch model, and the side branch model outputs a second decoding feature; Determining a first predicted text according to the first decoding feature and the second decoding feature; Calculating a loss between the first predicted text and the first annotated text; The model parameters of the side branch model are iteratively updated according to the loss between the first predicted text and the first annotated text until the side branch model meets a preset first training stop condition.
3. The training method of the text error correction model according to claim 2, characterized in that: The main error correction model includes: an encoding subnetwork and a decoding subnetwork; The encoding subnetwork comprises: N serially connected encoders, where N is greater than 1; The decoding sub-network comprises: N decoders connected in series; The output end of the last encoder in the encoding subnetwork is connected to the input end of the first decoder in the decoding subnetwork; The step of inputting the first erroneous text in the first training sample into the main error correction model, wherein the main error correction model outputs a first decoding feature and at least one intermediate decoding feature, comprises: Inputting the first error text into N serially connected encoders in the encoding subnetwork in sequence to obtain encoding features of the first error text; The encoding features of the first erroneous text are sequentially input into the N serially connected decoders in the encoding subnetwork, each decoder correspondingly outputs an intermediate decoding feature, and the intermediate decoding feature correspondingly output by the last decoder is used as the first decoding feature.
4. The training method of the text error correction model according to claim 2, characterized in that: The side branch model includes: an M-layer LST network, where M is less than N; The step of inputting the intermediate decoding feature into the side branch model, wherein the side branch model outputs a second decoding feature, comprises: When the input layer of the side branch model is the first layer LST network, the initial vector and the intermediate decoding features output by the NMth layer decoder are input into the first layer LST network to obtain the features output by the first layer LST network; The intermediate decoding features output by the N-M+i layer decoder and the features output by the i-th layer LST network are input to the i+1-th layer LST network to obtain the features output by the i+1-th layer LST network, and the features output by the M-th layer LST network are determined as the second decoding features; i is a positive integer from 1 to M-1.
5. The training method of the text error correction model according to claim 2, characterized in that: The determining a first predicted text according to the first decoding feature and the second decoding feature includes: Fusing the first decoding feature and the second decoding feature to obtain a first fused feature; The first predicted text is determined according to the first fused feature.
6. A text error correction method, characterized in that: include: Get the target text; The target text is input into a target text error correction model to obtain a text after the target text is corrected, wherein the target text error correction model is trained using the text error correction model training method as described in any one of claims 1-5.
7. A training device for a text error correction model, characterized in that: The text error correction model includes: a main error correction model and a side branch model, wherein the side branch model is a lightweight neural network model connected to the output layer of the main error correction model, and the training device of the text error correction model includes: A first training data set acquisition module is used to acquire a first training data set; the first training data set includes a plurality of first training samples, each of which includes a first error text of a newly added error type and a first annotated text after correcting the first error text; A training module is used to use the first erroneous text and the corresponding first annotated text in the first training sample as a model input sample and a model output sample respectively, train the side model, and obtain a target text error correction model; wherein, the main error correction model is trained based on a second training data set, and the second training data set includes multiple second training samples, each of the second training samples includes a second erroneous text of an existing error type and a second annotated text after correcting the second erroneous text.
8. A text error correction device, characterized in that: include: A target text acquisition module is used to acquire the target text; An input-output module is used to input the target text into a target text error correction model to obtain a text after the target text is corrected, wherein the target text error correction model is trained using the training method of the text error correction model described in any one of claims 1-5.
9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, it implements the training method of the text error correction model as described in any one of claims 1 to 5, or, when the processor executes the computer program, it implements the text error correction method as described in claim 6.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, it implements the training method of the text error correction model as described in any one of claims 1 to 5, or, when the computer program is executed by a processor, it implements the text error correction method as described in claim 6.