Text error correction model training method and device, text error correction method and device

By using a combination of semantic marking and semantic marking training text combination in the text error correction model, the language model is pre-trained and fine-tuned, and the problem of low accuracy of text error correction in special business areas is solved, and the goal is achieved Efficient error correction in the field.

CN114861636BActive Publication Date: 2024-12-03NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210506361.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-10
Publication Date
2024-12-03
Estimated Expiration
2042-05-10

AI Technical Summary

Technical Problem

The existing text error correction model is difficult to adapt to complex locale environments in special business areas, resulting in a decrease in error correction accuracy.

Method used

The language model is pre-trained using the first training text without semantic marking, and fine-tuning training is carried out in combination with the second training text with semantic marking under the target field. The model parameters are adjusted through interactive assistive training to improve the text correction of the model in the target field. Wrong ability.

Benefits of technology

Without losing generalization error correction capabilities, quickly adapt to complex language environments, improve text error correction accuracy in the target field, and improve the accuracy and operation efficiency of the output results of the target service objects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114861636B_ABST
    Figure CN114861636B_ABST
Patent Text Reader

Abstract

The present application provides a training method and device for a text error correction model, a text error correction method and device, and the training method includes: first using general text data to perform basic training on the language model, then using proprietary text data in the target field to fine-tune the language model, and then, by means of data interaction with the target service object, using the more mature target service object in the target field to perform interactive auxiliary training on the text error correction model. In this way, the present application can train the model to quickly adapt to complex and unique language environments without losing the generalized text error correction capability, thereby improving the text error correction accuracy of the model in the target field. Correspondingly, the text error correction model trained in the present application can perform text error correction processing on the text data involved in the application process of the target service object, which is beneficial to improving the operating efficiency of the target service object and the accuracy of the output results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of deep learning technology, and more specifically, to a text error correction model training method and device, and a text error correction method and device. Background Art

[0002] With the development of artificial intelligence technology, automated text correction technology has also emerged in various industries and achieved remarkable results. However, with the emergence of cultural diversity, different business fields have also derived language expressions with their own characteristics. For example, in the field of games, players often use "homophonic puns" to use seemingly wrong text expressions to achieve a humorous language effect without losing the characteristics of the game field.

[0003] From the above content, it can be seen that due to the contradiction between the generalization of language expression in general fields and the specificity in special business fields, the traditional text correction model that was originally used simply to correct typos is no longer applicable to text correction tasks in special business fields. Summary of the invention

[0004] In view of this, the purpose of the present application is to provide a text correction model training method and device, a text correction method and device, so as to train the model to quickly adapt to more complex and unique language environments without losing the generalized text correction ability, thereby improving the model's text correction accuracy in the target field.

[0005] In a first aspect, an embodiment of the present application provides a training method for a text error correction model, wherein the text error correction model is used to provide text error correction services for a target service object in a target field; wherein the target service object belongs to a mature algorithm model that has converged in the target field; the training method comprises:

[0006] Pre-training a language model using a first training text without semantic tags to obtain a first language representation model; wherein the first training text includes specific text data in the target domain and general text data outside the target domain;

[0007] The first language representation model is trained using a semantically labeled second training text in the target domain to obtain a second language representation model capable of identifying target text features; wherein the target text features are used to represent semantic features and / or text expression features that are unique to text data in the target domain;

[0008] Inputting the third training text input or output by the target service object during the training process into the second language representation model, and obtaining a corrected training text output by the second language representation model after performing text error correction processing on the third training text;

[0009] According to the pre-correction output result obtained by the target service object based on the third training text and the post-correction output result obtained by the target service object based on the corrected training text, the positive deviation / negative deviation of the model output result of the target service object before and after correction is obtained, and the model parameters of the second language representation model are adjusted according to the positive deviation / negative deviation to obtain a text error correction model including the adjusted model parameters.

[0010] In an optional implementation, the pre-training of the language model using the first training text without semantic tags to obtain the first language representation model includes:

[0011] By random sampling, masking a first target number of segmented words in the first training text is performed to obtain a first masked training text including the first target number of masked words; wherein the first target number is determined according to a sampling ratio of the random sampling and the number of segmented words included in the first training text;

[0012] Inputting the first masked training text into the language model to obtain a first masked prediction text output by the language model including a prediction result of a first target number of masked words;

[0013] The model parameters of the language model are adjusted by using the cross entropy loss between the first masked prediction text and the first training text that is not masked, until the language model reaches convergence, and the language model that reaches convergence is used as the first language representation model.

[0014] In an optional implementation, the pre-training of the language model using the first training text without semantic tags to obtain the first language representation model further includes:

[0015] According to a first preset sampling ratio, a second target number of segmented words belonging to the specific text data in the first training text are masked to obtain a second masked training text including the second target number of masked words; wherein the second target number is determined according to the first preset sampling ratio and the number of segmented words belonging to the specific text data in the first training text;

[0016] Inputting the second masked training text into the language model to obtain a second masked prediction text output by the language model including a prediction result of a second target number of masked words;

[0017] The model parameters of the language model are adjusted by using the cross entropy loss between the second masked prediction text and the first training text that is not masked, until the language model reaches convergence, and the language model that has reached convergence is used as the first language representation model.

[0018] In an optional embodiment, the training of the first language representation model using the semantically labeled second training text in the target domain at least includes: performing coarse-grained training and / or fine-grained training on the first language representation model using the semantically labeled second training text in the target domain; wherein the coarse-grained training is used to train the first language representation model to classify different sentences under the same semantic concept in the second training text according to different text expressions corresponding to the same semantic concept in the target domain; and the fine-grained training is used to train the first language representation model to identify the text expression of each sentence in the target domain according to the word segmentation sequence labeling results of each sentence in the second training text in the target domain.

[0019] In an optional implementation, the coarse-grained training is performed on the first language representation model by the following method:

[0020] For any two sentences in the second training text, the original versions of the two sentences after removing the existing semantic tags are input into the first language representation model, and the first language representation model is used to perform classification prediction on whether the two sentences correspond to the same semantic concept in the target domain, thereby obtaining classification prediction results of the two sentences;

[0021] Determine the true classification results of the arbitrary two sentences according to the semantic tags already present in the second training text; wherein the true classification results are used to indicate whether the arbitrary two sentences correspond to the same semantic concept in the target domain;

[0022] The model parameters of the first language representation model are adjusted by using the cross entropy loss between the classification prediction result and the true classification result until the first language representation model reaches convergence.

[0023] In an optional implementation, the fine-grained training is performed on the first language representation model by the following method:

[0024] For each sentence in the second training text, the original version of the sentence after removing the existing semantic tags is input into the first language representation model, and the sentence components of the sentence in the target domain are analyzed by the first language representation model to obtain a sentence analysis result of the sentence in the target domain; wherein the sentence components at least include: a first target participle belonging to an entity defined in the target domain, and a second target participle capable of representing different semantic concepts in the target domain;

[0025] According to the multiple entities defined in the target domain and the semantic tags already in the sentence, multiple word segments included in the sentence are sequence-labeled to obtain a word segmentation sequence labeling result of the sentence;

[0026] The model parameters of the first language representation model are adjusted by using the cross entropy loss between the sentence analysis result and the word segmentation sequence labeling result until the first language representation model reaches convergence.

[0027] In an optional implementation, the step of inputting the third training text input or output by the target service object during the training process into the second language representation model to obtain a corrected training text output by the second language representation model after performing text error correction processing on the third training text, comprises:

[0028] For each sentence in the third training text, input the sentence into the second language representation model to obtain a first output result of the second language representation model for the sentence;

[0029] In the case where it is detected that there is a difference between the first output result and the sentence, determining that the second language representation model has performed the text error correction processing on the sentence, and using the first output result as the corrected training text;

[0030] When it is detected that the first output result is the same as the sentence, the next sentence is obtained from the third training text, and the above processing steps for the sentence are repeated until the corrected training text is obtained.

[0031] In an optional implementation, after obtaining the corrected training text output by the second language representation model after performing text error correction processing on the third training text, the training method further includes:

[0032] When the third training text belongs to the text data input by the target service object during the training process, the third training text is input into the target service object, and the output is output to obtain the output result before correction;

[0033] The corrected training text is input into the target service object, and the corrected output result is output.

[0034] In an optional implementation, the step of inputting the third training text into the target service object and outputting the output result before correction includes:

[0035] Inputting the third training text into the target service object, predicting the output category of the third training text through the target service object, and obtaining the output result before correction; wherein the output result before correction is used to represent the probability that the output category of the third training text belongs to each preset category;

[0036] The step of inputting the corrected training text into the target service object and outputting the corrected output result comprises:

[0037] The corrected training text is input into the target service object, and the output category of the corrected training text is predicted by the target service object to obtain the corrected output result; wherein the corrected output result is used to characterize the probability that the output category of the corrected training text belongs to each preset category.

[0038] In an optional implementation manner, the obtaining of the positive deviation / negative deviation of the model output result of the target service object before and after the correction includes:

[0039] Calculate, according to the first deviation calculation strategy, a first deviation of the model output result of the target service object before and after the correction;

[0040] Based on the first deviation, it is determined whether the first deviation belongs to the positive deviation or the negative deviation.

[0041] In an optional implementation, calculating the first deviation of the model output result of the target service object before and after the correction according to the first deviation calculation strategy includes:

[0042] The probability deviation value of the output result after correction and the output result before correction in the same preset category is calculated, and the calculated result is used as the first deviation.

[0043] In an optional implementation, after obtaining the corrected training text output by the second language representation model after performing text error correction processing on the third training text, the training method further includes:

[0044] When the third training text belongs to the text data output by the target service object during the training process, the third training text is used as the output result before correction; and the corrected training text is used as the output result after correction.

[0045] In an optional implementation manner, the obtaining of the positive deviation / negative deviation of the model output result of the target service object before and after the correction includes:

[0046] Calculate the second deviation of the model output result of the target service object before and after the correction according to the second deviation calculation strategy;

[0047] Based on the second deviation, it is determined whether the second deviation belongs to the positive deviation or the negative deviation.

[0048] In an optional implementation, the calculating, according to the second deviation calculation strategy, the second deviation of the model output result of the target service object before and after the correction includes:

[0049] Obtaining a standard text recognition result of the target input data; wherein the target input data is used to represent the model input data of the target service object when the target service object outputs the third training text during the training process;

[0050] Calculating a text recognition deviation value between the third training text and the standard text recognition result, and using the calculation result as a first text recognition deviation value;

[0051] Calculating a text recognition deviation value between the corrected training text and the standard text recognition result, and using the calculation result as a second text recognition deviation value;

[0052] The difference between the first text recognition deviation value and the second text recognition deviation value is calculated, and the calculation result is used as the second deviation.

[0053] In an optional implementation, adjusting the model parameters of the second language representation model according to the positive deviation / negative deviation to obtain a text error correction model including the adjusted model parameters includes:

[0054] In each training cycle of the second language representation model, obtaining a target positive deviation / negative deviation obtained by the target second language representation model trained based on the training cycle;

[0055] According to the target positive deviation / negative deviation, the model parameters of the target second language representation model are adjusted, and when the target second language representation model meets the training cutoff condition, the text error correction model including the adjusted model parameters is obtained.

[0056] In an optional implementation, the target second language representation model in each training cycle is determined by the following method:

[0057] When reaching each training cycle of the second language representation model, obtaining the second language representation model trained in the previous training cycle, and generating a mirror image second language representation model that was not trained in the previous training cycle;

[0058] In the training cycle, the second language representation model trained in the previous training cycle and the mirror image second language representation model that was not trained in the previous training cycle are synchronously trained to obtain an optimized second language representation model and an optimized mirror image second language representation model trained in the training cycle, respectively;

[0059] Obtaining a first training deviation obtained based on the optimized second language representation model and a second training deviation obtained based on the optimized mirrored second language representation model in the training cycle; wherein the first training deviation is used to characterize the deviation and value of multiple positive deviations / negative deviations obtained based on the optimized second language representation model in the training cycle; and the second training deviation is used to characterize the deviation and value of multiple positive deviations / negative deviations obtained based on the optimized mirrored second language representation model in the training cycle;

[0060] If the first training deviation is less than the second training deviation, using the optimized mirrored second language representation model to replace the optimized second language representation model as the target second language representation model for the training cycle;

[0061] If the first training deviation is greater than the second training deviation, the optimized second language representation model is used as the target second language representation model of the training cycle; at the same time, the optimized mirror second language representation model is used as the mirror second language representation model that is not trained in the training cycle.

[0062] In an optional implementation, after obtaining the text error correction model including the adjusted model parameters, the training method further includes:

[0063] Inputting the test text input or output by the target service object during the test into the text error correction model, and obtaining a corrected test text output by the text error correction model after the test text has been subjected to text error correction processing;

[0064] According to the first test output result obtained by the target service object based on the test text and the second test output result obtained by the target service object based on the corrected test text, obtain the test deviation of the test output result of the target service object before and after the correction; wherein the test deviation includes a positive test deviation belonging to a positive number and a negative test deviation belonging to a negative number;

[0065] The model training effect of the text error correction model is determined based on the test deviation generated before and after each correction.

[0066] In a second aspect, an embodiment of the present application further provides a text error correction method, which is applied to a pre-trained text error correction model; the text error correction model is used to provide text error correction services for target service objects in a target field; wherein the target service objects belong to a mature algorithm model that has converged in the target field; the text error correction method comprises:

[0067] Inputting the text to be corrected that needs to be corrected by the target service object during the application process into a pre-trained text correction model, correcting the target text errors included in the text to be corrected by the text correction model, and obtaining a corrected text for the text to be corrected output by the text correction model; wherein the target text errors are determined according to the semantic features and / or text expression features specific to the target domain;

[0068] The text to be corrected input or output by the target service object during the application process is replaced with the corrected text.

[0069] In an optional implementation, the text error correction model is obtained by training according to the training method in any of the optional implementations of the first aspect above.

[0070] In a third aspect, an embodiment of the present application provides a training device for a text error correction model, wherein the text error correction model is used to provide text error correction services for a target service object in a target field; wherein the target service object belongs to a mature algorithm model that has converged in the target field; the training device comprises:

[0071] A first training module, used to pre-train the language model using a first training text without semantic tags to obtain a first language representation model; wherein the first training text includes specific text data in the target domain and general text data outside the target domain;

[0072] A second training module is used to train the first language representation model using a second training text that has been semantically marked in the target domain to obtain a second language representation model that has the ability to recognize target text features; wherein the target text features are used to represent the semantic features and / or text expression features that are unique to the text data in the target domain;

[0073] A first processing module, configured to input the third training text input or output by the target service object during the training process into the second language representation model, and obtain a corrected training text output by the second language representation model after performing text error correction processing on the third training text;

[0074] A parameter adjustment module is used to obtain the positive deviation / negative deviation of the model output result of the target service object before and after correction based on the pre-correction output result obtained by the target service object based on the third training text and the post-correction output result obtained by the target service object based on the corrected training text, and adjust the model parameters of the second language representation model according to the positive deviation / negative deviation to obtain a text error correction model including the adjusted model parameters.

[0075] In a fourth aspect, an embodiment of the present application provides a text error correction device, which is applied to a pre-trained text error correction model; the text error correction model is used to provide text error correction services for target service objects in a target field; wherein the target service objects belong to a mature algorithm model that has converged in the target field; the text error correction device includes:

[0076] A text error correction module is used to input the text to be corrected that needs to be corrected by the target service object during the application process into a pre-trained text error correction model, and correct the target text errors included in the text to be corrected by the text error correction model to obtain a corrected text for the text to be corrected output by the text error correction model; wherein the target text errors are determined according to the semantic features and / or text expression features specific to the target domain;

[0077] The text replacement module is used to replace the text to be corrected input or output by the target service object during the application process with the corrected text.

[0078] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the above-mentioned methods for training a text error correction model when executing the computer program.

[0079] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned methods for training a text error correction model are executed.

[0080] In a seventh aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the steps of the above-mentioned text error correction method when executing the computer program.

[0081] In an eighth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned text error correction methods are executed.

[0082] The technical solution provided by the embodiments of the present application may have the following beneficial effects:

[0083] The present application provides a method and device for training a text error correction model, a method and device for text error correction, which first uses general text data in an open field to perform basic training on a language model, and then uses proprietary text data in a target field to fine-tune the language model, so that the trained language model has the ability to recognize specific text features in the target field; then, by interacting with the converged target service object, a relatively mature target service object in the target field is used as a teacher model to perform interactive auxiliary training on the text error correction model in training. In this way, on the one hand, the training model can quickly adapt to a more complex and unique language environment without losing the generalized text error correction ability, thereby improving the text error correction accuracy of the model in the target field; on the other hand, correspondingly, after the text error correction model is trained, the text error correction model can be used to perform text error correction processing on the text data involved in the application process of the target service object, which is conducive to improving the accuracy of the output results of the target service object and the operating efficiency of the target service object.

[0084] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0085] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0086] Figure 1 A flow chart of a method for training a text error correction model provided in an embodiment of the present application is shown;

[0087] Figure 2 A schematic diagram of a process flow of a first pre-training method provided in an embodiment of the present application is shown;

[0088] Figure 3 A schematic diagram of a second pre-training method provided in an embodiment of the present application is shown;

[0089] Figure 4 A schematic diagram of a process flow of a coarse-grained training method provided in an embodiment of the present application is shown;

[0090] Figure 5 A schematic diagram of a process flow of a fine-grained training method provided in an embodiment of the present application is shown;

[0091] Figure 6 A flow chart of a method for determining whether text error correction processing has occurred provided in an embodiment of the present application is shown;

[0092] Figure 7 A schematic flow chart of a method for calculating a first deviation provided in an embodiment of the present application is shown;

[0093] Figure 8 A schematic flow chart of a method for calculating a second deviation provided in an embodiment of the present application is shown;

[0094] Fig. 9 A flow chart of a method for adjusting model parameters of a second language representation model provided in an embodiment of the present application is shown;

[0095] Fig.10 A flow chart of a method for determining a target second language representation model in each training cycle provided by an embodiment of the present application is shown;

[0096] Fig.11 A flow chart of a method for testing a text error correction model provided in an embodiment of the present application is shown;

[0097] Fig.12 A flowchart of a text error correction method provided by an embodiment of the present application is shown;

[0098] Fig.13 A schematic diagram of the structure of a training device for a text error correction model provided in an embodiment of the present application is shown;

[0099] Fig.14 A schematic diagram of the structure of a text error correction device provided in an embodiment of the present application is shown;

[0100] Fig.15 A schematic diagram of the structure of an electronic device 1500 provided in an embodiment of the present application;

[0101] Fig.16 A schematic diagram of the structure of another electronic device 1600 provided in an embodiment of the present application. DETAILED DESCRIPTION

[0102] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.

[0103] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0104] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.

[0105] Considering the contradiction between the generalization of language expression in general fields and the specificity in special business fields in the existing technology, the traditional text correction model that was originally used to correct typos is no longer applicable to text correction tasks in special business fields.

[0106] Based on this, the embodiment of the present application provides a training method and device for a text error correction model, a text error correction method and device, first using general text data in an open field to perform basic training on the language model, and then using proprietary text data in a target field to fine-tune the language model, so that the trained language model has the ability to recognize specific text features in the target field; then, by interacting with the converged target service object, a more mature target service object in the target field is used as a teacher model to perform interactive auxiliary training on the text error correction model in training. In this way, on the one hand, the training model can quickly adapt to a more complex and unique language environment without losing the generalized text error correction ability, thereby improving the text error correction accuracy of the model in the target field; on the other hand, correspondingly, after the text error correction model is trained, the text error correction model can be used to perform text error correction processing on the text data involved in the application process of the target service object, which is conducive to improving the accuracy of the output results of the target service object and the operating efficiency of the target service object.

[0107] The following is a detailed introduction to a text error correction model training method and device, and a text error correction method and device provided in an embodiment of the present application.

[0108] Reference Figure 1 As shown, Figure 1 A flow chart of a training method for a text error correction model provided in an embodiment of the present application is shown, wherein the text error correction model is used to provide text error correction services for target service objects in a target field; the target service objects belong to a mature algorithm model that has converged in the target field; the training method includes steps S101-S104; specifically:

[0109] S101, pre-training a language model using a first training text without semantic tags to obtain a first language representation model.

[0110] S102, training the first language representation model using a semantically marked second training text in the target domain to obtain a second language representation model capable of recognizing features of the target text.

[0111] S103, inputting the third training text input or output by the target service object during the training process into the second language representation model, and obtaining a corrected training text output by the second language representation model after performing text error correction processing on the third training text.

[0112] S104, according to the pre-correction output result obtained by the target service object based on the third training text and the post-correction output result obtained by the target service object based on the corrected training text, obtain the positive deviation / negative deviation of the model output result of the target service object before and after the correction, and adjust the model parameters of the second language representation model according to the positive deviation / negative deviation to obtain a text error correction model including the adjusted model parameters.

[0113] The training method of a text error correction model provided in an embodiment of the present application first uses general text data in an open field to perform basic training on the language model, and then uses proprietary text data in a target field to fine-tune the language model, so that the trained language model has the ability to recognize specific text features in the target field; then, by interacting with the converged target service object, a more mature target service object in the target field is used as a teacher model to perform interactive auxiliary training on the text error correction model in training. Through the above training method, the present application can train the model to quickly adapt to more complex and unique language environments without losing the generalized text error correction ability, thereby improving the model's text error correction accuracy in the target field.

[0114] The following is an exemplary description of each step in the training method of the above-mentioned text error correction model provided in the embodiment of the present application:

[0115] S101, pre-training a language model using a first training text without semantic tags to obtain a first language representation model.

[0116] Here, the first training text includes specific text data under the target domain and general text data outside the target domain; wherein the target domain is determined according to the specific business scenario of the target service object. For example, when the target service object is a speech recognition model in a game system, the target domain is the game domain.

[0117] Specifically, the above-mentioned general text data is used to represent text data in other general fields besides the target field; the general field is used to refer to all business scenarios where the text data may be applied when the specific business scenarios to which the text data is applied are not limited. For example, if the target field is the game field, the general text data can be various types of text data that can be obtained from other fields such as the education field, the media field, the culture and sports field, etc.

[0118] Here, the "unsemantic tags" in the first training text are used to represent: no distinction is made between specific text data and other general text data in the first training text; the purpose of the above pre-training is to use general text data (i.e., the first training text without semantic tags) in an open domain (equivalent to including both target domains and non-target domains) to perform basic training on the language model, so that the language model obtained after training (i.e., the first language representation model) can predict the probability of occurrence of each word in the semantic environment represented by different contextual contents according to different contextual contents in the text data (i.e., obtain the first language representation model with basic text perception ability).

[0119] Specifically, as an optional embodiment, when obtaining the first training text, the text data collected in the general field (including both the above-mentioned specific text data and the above-mentioned general text data) can also be preprocessed for a round of sensitive word removal (such as removing some known stop words, industry sensitive words, malicious words with abusive nature, etc.) to obtain a first training text with a more standardized format, reduce the difficulty of model training for pre-training the language model, and improve the model training efficiency of the language model.

[0120] S102, training the first language representation model using a semantically marked second training text in the target domain to obtain a second language representation model capable of recognizing features of the target text.

[0121] In an embodiment of the present application, the "semantically marked" in the second training text is used to represent: for each word segment in the second training text, if the word segment has unique target semantics and / or belongs to a proper noun in the target domain when it appears in the target domain, the target semantics and / or the corresponding noun concept definition in the target domain possessed by the word segment is marked.

[0122] Specifically, the purpose of training the first language representation model using the second training text in the above step S102 is: after the first language representation model has basic text perception ability, the first language representation model is fine-tuned using proprietary text data in the target domain (i.e., the semantically labeled second training text in the target domain), so that the second language representation model obtained after the fine-tuning training can predict the relationship between sentences of different sentences in the target domain, as well as the sentence components of the same sentence in the target domain (i.e., a second language representation model with target text feature recognition ability is obtained).

[0123] Here, the target text features are used to characterize the unique semantic features and / or literal expression features of text data in the target domain; among them, the semantic features are equivalent to the second language representation model predicting the inter-sentence relationships of different sentences in the target domain (such as whether the semantics corresponding to two sentences in the target domain are the same); the literal expression features are equivalent to the second language representation model predicting the sentence components of the same sentence in the target domain (such as which word segment in the sentence belongs to the entity word defined in the target domain, and which word segment belongs to the proper noun explaining the same semantic concept in the target domain, etc.).

[0124] Specifically, the above semantic features can at least include the following two types of features:

[0125] (1) The semantic features of specific text data in the target domain;

[0126] For example, taking the game domain as the target domain, "Soul Gear" is specific text data that only appears in the game domain, and its semantic feature is "a virtual equipment in the game".

[0127] (2) The special semantic features corresponding to the same text data when it appears in the target domain;

[0128] For example, still taking the game domain as the target domain, the special semantic feature corresponding to "Sun Shangxiang" when it appears in the game domain is "a game character", but when "Sun Shangxiang" appears in other general domains except the game domain, its general corresponding semantic is "a historical figure".

[0129] Specifically, the above literal expression features can also at least include the following two types of features:

[0130] (1) The correct literal expression of specific text data in the target domain;

[0131] For example, taking the specific text data "Soul Gear" in the above game domain as an example, "Soul Gear" is the correct literal expression of specific text data in the game domain, while "Jade Soul" is the incorrect literal expression of specific text data in the game domain.

[0132] (2) The special literal expression corresponding to the same text data when it appears in the target domain;

[0133] For example, still taking the game domain as the target domain, "mei zhi" belongs to the incorrect literal expression of "mei zi" in the general domain, but "mei zhi" belongs to a characteristic term for female players / female game characters in the game domain.

[0134] S103, inputting the third training text input or output by the target service object during the training process into the second language representation model, and obtaining a corrected training text output by the second language representation model after performing text error correction processing on the third training text.

[0135] Here, unlike traditional language models (such as natural language models) that train models through the data (i.e., model training data)-algorithm (i.e., trained model) method, the present application is based on the actual application needs of the trained text correction model (i.e., providing text correction services in the target field for the target service object), without the need to reconstruct the model training data set, through the algorithm (i.e., target service object)-data (i.e., the third training text input or output by the target service object during the training process)-algorithm (i.e., the trained second language representation model), using the more mature and converged target service object in the target field as a teacher model, to perform interactive auxiliary training on the text correction model in training (i.e., the second language representation model), which solves the back propagation limitations of the traditional natural language model at the interactive level due to discrete sampling, and can improve the stability of its gradient optimization while helping the model to converge quickly.

[0136] It should be noted that in step S103, the third training text essentially belongs to the text type data involved in the target service object's own training process, that is, the third training text may be the input data of the target service object (for example, if the target service object is a text classification model, the third training text is the input data of the target service object); it may also be the output data of the target service object (for example, if the target service object is a speech recognition model, the input data of the target service object is speech data, and the third training text is the text recognition result output by the target service object for the input speech data); it may also include both the input data and the output data of the target service object (for example, if the target service object is a question-and-answer model, the input data and output data of the target service object are both text type data, and in this case, the third training text is all the training data that appears in the training process of the target service object).

[0137] Specifically, in step S103, the third training text is equivalent to a sentence set consisting of each sentence input or output by the target service object during the training process; the third training text is input into the second language representation model one by one in the form of one sentence at a time; for the currently input target sentence, the second language representation model may have performed text correction processing on it (that is, the model output result is different from the currently input target sentence), or may not have performed text correction processing on it (that is, the model output result is the same as the currently input target sentence).

[0138] It should be noted that the "corrected training text" in the above step S103 is the model output result obtained after the currently input target sentence in the third training text is subjected to text error correction processing by the second language representation model, that is, the "corrected training text" is the model output result of the second language representation model when the model output result is different from the currently input target sentence.

[0139] S104, according to the pre-correction output result obtained by the target service object based on the third training text and the post-correction output result obtained by the target service object based on the corrected training text, obtain the positive deviation / negative deviation of the model output result of the target service object before and after the correction, and adjust the model parameters of the second language representation model according to the positive deviation / negative deviation to obtain a text error correction model including the adjusted model parameters.

[0140] In the embodiment of the present application, in the actual application process of the target service object, according to whether the text data belongs to the input data of the target service object or the output data of the target service object, the service object type to which the target service object belongs can be divided into the following three cases, specifically:

[0141] 1. The first case: the service object type to which the target service object belongs is a "prior type", that is, the work task of the target service object is to perform data processing on the currently input text data.

[0142] For example, for target service objects such as text classification, knowledge extraction, sentiment analysis, and search engines that use text data as input data, text data is the input data of the target service object, that is, the text correction model is used to provide text correction services for the input data of the target service object.

[0143] Specifically, when the service object type to which the target service object belongs is "prior type", each sentence in the third training text belongs to the input data of the target service object. At this time, for each sentence in the third training text, the pre-correction output result obtained by the target service object based on the sentence is the model output result obtained by the target service object based on the sentence as input; the post-correction output result obtained by the target service object based on the corrected training text of the sentence is the model output result obtained by the target service object based on the corrected training text of the sentence as input.

[0144] 2. The second case: The service object type to which the target service object belongs is "two-way verification type", that is, the work task of the target service object may be: to process the currently input text data, or: to predict and generate corresponding text data based on the currently input target data.

[0145] As an exemplary explanation, the target service object belonging to the "two-way verification type" is mainly the dialogue service system under the target field. In the dialogue service system, the dialogue service system needs to recognize the text data / voice data input by the user, and also needs to predict and generate reply text data corresponding to the input data based on the recognition result of the input data; that is, the text correction model is used to perform text correction services for the input data and / or output data of the target service object. At this time, the third training text includes both input sentences belonging to the input data of the target service object and output sentences belonging to the output data of the target service object.

[0146] Specifically, when the service object type to which the target service object belongs is "two-way verification type", for each sentence in the third training text, if the sentence belongs to the input data of the target service object, the output result before correction and the output result after correction are the same as the first case above, and the repetitions will not be repeated here.

[0147] Specifically, when the service object type to which the target service object belongs is a "two-way verification type", for each sentence in the third training text, if the sentence belongs to the output data of the target service object, the above-mentioned output result before correction is the sentence in the third training text, and the above-mentioned output result after correction is the corrected training text output after the sentence is processed by the second language representation model for text error correction.

[0148] 3. The third case: the service object type to which the target service object belongs is "posterior type", that is, the working task of the target service object is to predict and generate corresponding text data based on the currently input target data.

[0149] For example, for target service objects with text data as output data, such as speech and text recognition and image OCR (Optical Character Recognition) recognition, the text data is the output data of the target service object, that is, the text correction model is used to perform text correction services for the output data of the target service object. At this time, each sentence in the third training text belongs to the output data of the target service object.

[0150] Specifically, when the service object type to which the target service object belongs is "posteriori type", each sentence in the third training text belongs to the output data of the target service object. At this time, the output result before correction and the output result after correction are the same as the case where the sentence belongs to the output data of the target service object in the second case mentioned above, and the repetitions will not be repeated here.

[0151] Through the specific description of the above three situations, it can be seen that "the model output result of the target service object changes from the output result before correction to the output result after correction" is equivalent to the change in the model output result of the target service object after the text correction model provides text correction service for the target service object; "the positive deviation of the model output result of the target service object before and after correction" is equivalent to the text correction service provided by the text correction model generating positive gain for the target service object (such as improving the accuracy of the model output result of the target service object, etc.); "the negative deviation of the model output result of the target service object before and after correction" is equivalent to the text correction service provided by the text correction model generating negative impact on the target service object (such as reducing the accuracy of the model output result of the target service object, etc.).

[0152] Regarding the above-mentioned method of obtaining positive deviation / negative deviation, it should be noted that in addition to the conventional method of obtaining positive deviation / negative deviation through difference, different deviation acquisition methods can also be selected according to the specific application characteristics of the target service object. For example, taking the target service object as knowledge extraction, in the text correction service in the question and answer field, the confidence of the downstream sequence annotation model of the target service object can be used to provide the corresponding reward coefficient (i.e. positive deviation) / penalty coefficient (i.e. negative deviation) for the text correction model in training; the embodiments of the present application do not impose any limitation on this.

[0153] Based on this, the present application simulates each text correction behavior that occurs during the model training process (equivalent to each text correction process performed by the second language representation model). When the occurrence of the text correction behavior has a positive impact on the model output result of the target service object, the calculated positive deviation is used as the reward adjustment parameter of the model to positively adjust the model parameters of the second language representation model; when the occurrence of the text correction behavior has a negative impact on the model output result of the target service object, the calculated negative deviation is used as the penalty adjustment parameter of the model to negatively adjust the model parameters of the second language representation model. In this way, the learning behavior of the model is controlled by the above-mentioned reward and punishment adjustment mechanism that is targeted at the text correction task in the target field, to replace the traditional model training method that relies on the marked "annotated samples" to define the model learning direction, which is conducive to reducing the model training process. The degree of dependence on the "annotated samples", even if the number of "annotated samples" is insufficient, will not affect the training effect of the text correction model in the present application, which helps to help the model converge quickly and make the trained text correction model more stable.

[0154] The specific implementation process of each of the above steps in the embodiment of the present application is described in detail below:

[0155] Regarding the specific implementation process of the above-mentioned step S101, it should be noted that there are many optional methods for pre-training language models using non-semantically labeled text data in general fields. This application does not impose any limitation on the specific pre-training method in step S101.

[0156] Here, the "masked prediction" method in the commonly used BERT (Bidirectional Encoder Representations from Transformers, a self-encoding language model) model is used as an optional embodiment of the pre-training method in this application. Regarding how to select the masked segmented words to be predicted in the first training text, this application embodiment provides the following two different optional implementation plans, specifically:

[0157] In an alternative embodiment, Figure 2 As shown, Figure 2 The flowchart of the first pre-training method provided in the embodiment of the present application is shown, wherein when executing step S101, the method includes steps S201-S203; specifically:

[0158] S201 , masking a first target number of word segments in the first training text by random sampling to obtain a first masked training text including the first target number of masked words.

[0159] In an embodiment of the present application, the trained text correction model is used to provide text correction services for target service objects in the target field. Considering that different types of target service objects may have different training requirements for text correction models, for example, some target service objects prefer to reduce the construction operation of training data during the training of the text correction model (that is, the training requirements tend to reduce the amount of data processing / reduce training costs), while some target service objects prefer to improve the training effect of the text correction model (that is, they do not care about the amount of data processing / training costs in the training process). At this time, in order to meet the different training requirements of different target service objects for text correction models, when pre-training the language model, you can either randomly sample the to-be-predicted segmented words that need to be masked, or give priority to professional vocabulary / characteristic vocabulary in the target field as the to-be-predicted segmented words that need to be masked.

[0160] It should be noted that, based on the above analysis of the to-be-predicted segmented words, it can be seen that the embodiment of the present application does not impose any limitation on whether or not the to-be-predicted segmented words need to be set with selection rules / selection criteria.

[0161] Specifically, the first pre-training method described in steps S201-S203 is equivalent to a preferred implementation method for pre-training a language model when the target service object's training requirements for the text error correction model tend to reduce the amount of data processing / reduce training costs.

[0162] Here, in step S201, the first target number is determined based on the sampling ratio of the random sampling and the number of segmented words included in the first training text; for example, if the first training text includes 100 segmented words in total, where the sampling ratio of random sampling is 10%, then it can be determined that the first target number is 10 segmented words, that is, according to the random sampling method, 10 segmented words are randomly selected from the 100 segmented words included in the first training text for masking, and a first masked training text including 10 masked segmented words is obtained.

[0163] S202: Input the first masked training text into the language model to obtain a first masked prediction text output by the language model that includes prediction results of a first target number of masked words.

[0164] Specifically, taking the number of masked words in the first masked prediction text (i.e., the first target number) as n as an example, for each masked word i, according to the position of the masked word i in the first masked prediction text, the language model can determine the context content of the masked word i from the first masked prediction text (e.g., the context content can be the sentence I where the masked word i is located, the previous sentence H of sentence I, and the next sentence J of sentence I); the language model is trained to perform word segmentation prediction on each masked word i according to the context content of the masked word i, and obtain the word segmentation prediction result p of each masked word i. ic ; Thus, the word segmentation prediction result p including each masked word i ic The predicted text is used as the first masked predicted text; wherein the word segmentation prediction result p ic It represents the predicted probability that the masked word i belongs to the c-type segmentation.

[0165] It should be noted that the specific number of categories of c in the above-mentioned c-category word segmentation depends on the number of word segmentation types included in the word segmentation prediction table. The embodiment of the present application does not impose any limitation on the specific number of categories of c in the c-category word segmentation.

[0166] S203, adjusting the model parameters of the language model by using the cross entropy loss between the first masked prediction text and the first training text that is not masked, until the language model reaches convergence, and using the language model that has reached convergence as the first language representation model.

[0167] Specifically, in combination with the above step S202, it can be known that the first masked prediction text includes the word segmentation prediction result of each masked word, and the first training text that is not masked includes the real word segmentation classification result of each masked word (equivalent to the real classification result determined from the above word segmentation prediction table based on the unmasked real word segmentation). Therefore, for each masked word in the first masked prediction text, the word segmentation prediction result of the masked word in the first masked prediction text and the real word segmentation classification result of the masked word in the first training text are brought into the cross entropy loss function to obtain the model training loss of the language model, and thus, the model parameters in the language model are adjusted based on the model training loss obtained from each training to obtain the converged first language representation model.

[0168] In the embodiment of the present application, considering that the number of word segmentation types included in the word segmentation prediction table used in the mask prediction process (i.e., the specific number of categories of c in the above-mentioned c-category word segmentation) is usually greater than 2 categories, the cross entropy loss function in step S203 is preferably a cross entropy loss function under a multi-classification task, specifically:

[0169]

[0170] Wherein, n is the total number of masked words in the first masked prediction text, that is, n is the first target number, and i is the i-th masked word in the first masked prediction text;

[0171] N is the number of word types included in the word prediction table, and c is the cth type of word included in the word prediction table;

[0172] p ic is the word segmentation prediction result of the i-th masked word;

[0173] y ic is a symbolic function (0 or 1). If the i-th masked word is a c-th type of participle, then y ic The value is 1; if the i-th masked word is not the c-th type of participle, then y ic The value is 0;

[0174] L 1 It is the cross entropy loss function used when the language model is pre-trained according to the method described in steps S201-S203.

[0175] In another alternative embodiment, Figure 3 As shown, Figure 3 A flow chart of a second pre-training method provided in an embodiment of the present application is shown, wherein when executing step S101, the method includes steps S301-S303; specifically:

[0176] S301 , masking a second target number of word segments belonging to the specific text data in the first training text according to a first preset sampling ratio, to obtain a second masked training text including the second target number of masked words.

[0177] Specifically, the second pre-training method described in steps S301-S303 is equivalent to a preferred implementation method for pre-training the language model when the target service object's training demand for the text correction model tends to improve the training effect of the text correction model / improve the accuracy of the training results.

[0178] Here, in step S301, the second target number is determined based on the first preset sampling ratio and the number of segmented words belonging to the specific text data in the first training text; for example, if the first training text includes a total of 100 segmented words, of which 40 segmented words belong to the specific text data under the target field, and the first preset sampling ratio is 20%, then it can be determined that the second target number is 8 segmented words, that is, according to the random sampling method, 8 segmented words are randomly selected from the 40 segmented words belonging to the specific text data in the first training text for masking, and these 8 masked segmented words are used as the masked words to be predicted.

[0179] S302: Input the second masked training text into the language model to obtain a second masked prediction text output by the language model that includes prediction results of a second target number of masked words.

[0180] S303: Using the cross entropy loss between the second masked prediction text and the first training text that is not masked, adjust the model parameters of the language model until the language model converges, and use the language model that has converged as the first language representation model.

[0181] Here, the implementation of steps S302-S303 is the same as that of steps S202-S203, and the repeated parts are not repeated here.

[0182] Regarding the specific implementation process of the above step S102, based on the analysis content of the above step S102, it can be known that the training purpose of training the first language representation model using the second training text in step S102 can be subdivided into the following two types, specifically:

[0183] Training objectives 1. To enable the second language representation model obtained after fine-tuning training to predict the relationship between sentences in different sentences in the target domain;

[0184] Training objective 2: To enable the second language representation model obtained after fine-tuning training to predict the sentence components of the same sentence in the target domain.

[0185] Based on this, in order to achieve the above two training objectives, in an embodiment of the present application, as an optional embodiment, the training of the first language representation model using the second training text in step S102 at least includes: using the semantically marked second training text in the target domain to perform coarse-grained training and / or fine-grained training on the first language representation model; wherein the coarse-grained training is used to train the first language representation model to classify different sentences under the same semantic concept in the second training text according to different text expressions corresponding to the same semantic concept in the target domain (i.e., the coarse-grained training is used to achieve the above training objective 1); the fine-grained training is used to train the first language representation model to identify the text expression of each sentence in the target domain according to the word segmentation sequence labeling result of each sentence in the second training text in the target domain (i.e., the fine-grained training is used to achieve the above training objective 2).

[0186] For the specific completion process of the above training purpose 1, in an optional implementation scheme, as Figure 4 As shown, Figure 4 A flow chart of a coarse-grained training method provided in an embodiment of the present application is shown, wherein when executing step S102, the method includes steps S401-S403; specifically:

[0187] S401, for any two sentences in the second training text, the original versions of the any two sentences after removing the existing semantic tags are input into the first language representation model, and the first language representation model is used to perform classification prediction on whether the any two sentences correspond to the same semantic concept in the target domain, so as to obtain classification prediction results for the any two sentences.

[0188] Regarding the second training text here, it should be noted that, similar to whether it is necessary to set selection rules / selection criteria for the masked word to be predicted in step S201, in an embodiment of the present application, in order to meet the different training needs of different target service objects for the text error correction model, the second training text can also be determined in different ways according to different training needs.

[0189] Specifically, when the target service object prefers to reduce the construction operation of training data during the training process of the text correction model (that is, the training requirements tend to reduce the amount of data processing / reduce training costs), since the first training text also includes word segmentation belonging to specific text data in the target field, the first training text can be directly used as the second training text.

[0190] Correspondingly, when the target service object is more inclined to improve the training effect of the text error correction model (that is, it is not concerned about the data processing volume / training cost in the training process), the second training text can be reconstructed directly according to the specific text data in the target field; or, on the basis of the first training text, a certain number of professional vocabulary belonging to the above-mentioned specific text data can be supplemented, and the supplemented first training text can be used as the second training text, so as to meet the training needs of the target service object who is more inclined to improve the training effect of the text error correction model by increasing the proportion of specific text data in the second training text.

[0191] Here, in step S401, the classification prediction result is used to characterize the predicted value of whether any two sentences correspond to the same semantic concept in the target domain; that is, the classification prediction method in step S401 is equivalent to a binary classification prediction of whether the two input sentences correspond to the same semantic concept in the target domain.

[0192] S402: Determine true classification results of the arbitrary two sentences according to the semantic tags already present in the second training text for the arbitrary two sentences.

[0193] Here, the actual classification result is used to characterize whether the arbitrary two sentences correspond to the same semantic concept in the target domain.

[0194] In an embodiment of the present application, after obtaining the second training text, as an optional embodiment, multiple semantic concept tags included in the target domain can be obtained from the knowledge graph and / or encyclopedia knowledge base under the target domain, and then each sentence in the second training text is marked with the obtained multiple semantic concept tags. If a word with a semantic tag that matches the semantic concept tag appears in the sentence, the semantic concept tag is used as the semantic concept tag of the sentence; if there is no word that matches any semantic concept tag in the sentence, the semantic concept tag of the sentence can be determined as other / unmarked (equivalent to the statement being irrelevant to the target domain and having a small contribution to model training), thereby determining the true classification results of any two sentences based on each sentence after the above-mentioned semantic concept tagging.

[0195] S403: Adjust model parameters of the first language representation model by using the cross entropy loss between the classification prediction result and the true classification result until the first language representation model reaches convergence.

[0196] Here, based on the analysis of step S401 above, it can be seen that the classification prediction method in step S401 is equivalent to a binary classification prediction of whether the two input sentences correspond to the same semantic concept in the target domain; therefore, the cross entropy loss function in step S403 can use the cross entropy loss function under the binary classification task, specifically:

[0197]

[0198] Wherein, m is the total number of inputs of the first language representation model to the said two arbitrary sentences (which is also equivalent to the total number of predictions of a round of binary classification prediction task), that is, the actual value of m can be determined according to the total number of sentences included in the second training text;

[0199] j is the jth input to the first language representation model, and is also the jth prediction of the first language representation model in a round of binary classification prediction task;

[0200] p j is the classification prediction result of the two sentences in the jth prediction, where p j The value of represents the probability that two sentences correspond to the same semantic concept in the target domain in the jth prediction;

[0201] y j is a symbolic function (0 or 1). If the true classification results of the two sentences in the jth prediction are the same semantic concept in the corresponding target domain, then y j The value is 1; if the true classification results of the two sentences in the jth prediction are different semantic concepts in the corresponding target domain, then y j The value is 0;

[0202] L 2 It is the cross entropy loss function used when the first language representation model is coarse-grainedly trained according to the method described in steps S401-S403.

[0203] For the specific completion process of the above training purpose 2, in an optional implementation scheme, as Figure 5 As shown, Figure 5 A flow chart of a fine-grained training method provided in an embodiment of the present application is shown, wherein when executing step S102, the method includes steps S501-S503; specifically:

[0204] S501, for each sentence in the second training text, the original version of the sentence after removing the existing semantic tags is input into the first language representation model, and the sentence components of the sentence in the target domain are analyzed by the first language representation model to obtain a sentence analysis result of the sentence in the target domain.

[0205] Here, the sentence components include at least: a first target participle belonging to an entity defined in the target domain, and a second target participle capable of representing different semantic concepts in the target domain.

[0206] Specifically, based on the fact that the sentence components include both entities and semantic concepts, it is necessary to explain the semantic concept labeling in the above step S402. In order to further improve the training effect of the second language representation model, as an optional embodiment, for the two sentences input in the j-th prediction, after determining the true classification results y of the two sentences, j When , it can be further limited that if the two sentences in the jth prediction include both the segmentation corresponding to the same semantic concept tag and the segmentation with the same entity attribute, then the true classification result y is determined j The value is 1; otherwise, even if the two sentences include participles corresponding to the same semantic concept tag, but the entity attributes corresponding to the participles belonging to the entity type in the two sentences are different, the true classification results y of the two sentences are still determined. j The value is 0, which means that the two statements are not statements under the same semantic concept.

[0207] In an embodiment of the present application, the above-mentioned first target segmentation word and the above-mentioned second target segmentation word can both be determined using the knowledge graph under the target domain; for example, taking the knowledge graph K in the game field as an example, in the knowledge graph K, entity-type segmentations that are often used as sentence subjects, such as game characters, game types, and game names, will appear as entity nodes S in the knowledge graph K, and concept-type segmentations that are often used as sentence objects, such as game equipment, game props, and character skills, and have special definitions in the game field will appear as concept nodes G in the knowledge graph K. The edge between each entity node S and the concept node G in the knowledge graph K is used to characterize the association relationship between the entity node S and the concept node G.

[0208] S502: perform sequence tagging on multiple word segments included in the sentence according to multiple entities defined in the target domain and the semantic tags already in the sentence, to obtain a word segmentation sequence tagging result of the sentence.

[0209] Specifically, when sequence marking a sentence, as an optional embodiment, the first target participle and the second target participle included in the sentence can be marked separately according to the definitions of the first target participle and the second target participle, so as to obtain the participle sequence marking result of the sentence.

[0210] Exemplary illustration, taking the game field as the target field as an example. If the text form of statement A is "[Great天狗][of][Soul Equipment][should][use][what]", where, from the knowledge graph K in the game field, it is determined that "Great天狗" belongs to the entity node S1 in the knowledge graph K, and "Soul Equipment" belongs to the concept node G1 in the knowledge graph K. The edge between the entity node S1 and the concept node G1 indicates that the concept node G1 and the entity node S1 belong to the same game application; then it can be determined that the token sequence marking result A1 of statement A is "[entity][0][category][0][0][0]", where entity (entity) is the entity marking belonging to the first target tokenization, category (category) is the concept marking belonging to the second target tokenization, and 0 indicates other text that does not need to be recognized.

[0211] S503. Using the cross-entropy loss between the statement analysis result and the token sequence marking result, adjust the model parameters of the first language representation model until the first language representation model converges.

[0212] Specifically, when obtaining the above statement analysis result through sentence component analysis, the first language representation model involves identifying and predicting multiple tokens included in the statement. Therefore, the cross-entropy loss calculation method in step S503 is similar to the cross-entropy loss calculation method in the multi-classification task in step S203. The form of the cross-entropy loss function in step S503 can refer to the formula form of the cross-entropy loss function L 1 in step S203, and the repeated parts will not be elaborated here.

[0213] Exemplary illustration, still taking statement A in the above example as an example. If the statement analysis result A2 of statement A is "[category][0][category][0][0][0]", then taking the cross-entropy loss function L 1 in step S203 as an example, taking "[Great天狗]" and "[Soul Equipment]" in statement A as 2 masked words respectively, taking the marking result in statement analysis result A2 as the first masked prediction text, taking the token sequence marking result A1 as the first training text without mask masking, and determining the value of the sign function y ic according to the marking result difference between the token sequence marking result A1 and the statement analysis result A2, so as to calculate the cross-entropy loss between the token sequence marking result A1 and the statement analysis result A2, and fine-tune the model parameters of the first language representation model until the first language representation model converges.

[0214] Regarding the specific implementation process of the above step S103, based on the analysis content of the above step S103, it can be known that the third training text is input into the second language representation model one by one in the form of one sentence and one sentence; for the currently input target sentence, how to determine whether the second language representation model has performed text error correction processing on the target sentence, the embodiment of the present application provides the following optional implementation scheme, specifically:

[0215] like Figure 6 As shown, Figure 6 A flow chart of a method for determining whether text error correction processing has occurred provided by an embodiment of the present application is shown, wherein when executing step S103, the method includes steps S601-S603; specifically:

[0216] S601 : For each sentence in the third training text, input the sentence into the second language representation model to obtain a first output result of the second language representation model for the sentence.

[0217] S602: When it is detected that there is a difference between the first output result and the sentence, determine that the second language representation model has performed the text error correction processing on the sentence, and use the first output result as the corrected training text.

[0218] S603, when it is detected that the first output result is the same as the sentence, the next sentence is obtained from the third training text, and the above processing steps for the sentence are repeated until the corrected training text is obtained.

[0219] For example, based on the above steps S601-S603, the game field is still taken as the target field as an example. If the sentence a currently input in the third training text is "The image of the game character Daji is a cute girl", at this time, if the first output result a1 of the second language representation model for sentence a is "The image of the game character Daji is a cute girl", that is, the first output result a1 is the same as sentence a, then it is determined that the second language representation model has not performed text error correction processing on sentence a. At this time, the next sentence b is obtained from the third training text as the input of the second language representation model, and the judgment continues; if the first output result a1 of the second language representation model for sentence a is "The image of the game character Daji is a cute girl", that is, the first output result a1 is different from sentence a, then it is determined that the second language representation model has performed text error correction processing on sentence a. At this time, the corrected training text a2 is obtained as "The image of the game character Daji is a cute girl", and step S104 is executed using the corrected training text a2 and sentence a in the third training text.

[0220] With respect to the specific implementation process of the above-mentioned step S104, in the embodiment of the present application, combined with the analysis content at the above-mentioned step S104, it can be known that the service object type to which the target service object belongs is divided into three cases: "a priori type", "bidirectional verification type" and "post-hoc type". With respect to these three specific cases, on the basis of the above-mentioned steps S601-S603, for the third training text (equivalent to a specific sentence in the third training text) that is currently determined to have been subjected to text correction processing by the second language representation model (i.e., the simulated text correction model actually provides text correction services for the target service object), it can be determined that the third training text in step S104 (i.e., the third training text that is currently determined to have been subjected to text correction processing by the second language representation model) can only be the input text data / output text data of the target service object, that is, the text correction model is equivalent to performing text correction processing on the input text data / output text data of the target service object.

[0221] Based on this, the following describes in detail how to obtain the positive deviation / negative deviation of the model output result of the target service object before and after the correction, depending on whether the text error correction model performs text error correction processing on the input text data of the target service object or on the output text data of the target service object in the above two cases:

[0222] 1. When the third training text is text data input by the target service object during the training process:

[0223] At this time, the third training text is input into the target service object, and the output result before correction can be output; the corrected training text is input into the target service object, and the output result after correction can be output; that is, the output result before correction is: the target service object takes the third training text as input, and the model output result is output; the output result after correction is: the target service object takes the corrected training text as input, and the model output result is output.

[0224] It should be noted that the third training text is input into the second language representation model one by one in the form of one sentence at a time. Therefore, the third training text is the text data input by the target service object during the training process, that is, the target sentence in the third training text currently input into the second language representation model belongs to the input data of the target service object; the corrected training text is the corrected training sentence output by the second language representation model after performing text error correction processing on the input target sentence.

[0225] Here, as an optional embodiment, the first deviation of the model output result of the target service object before and after correction can be calculated according to the first deviation calculation strategy; based on the first deviation, it is determined whether the first deviation belongs to the positive deviation or the negative deviation.

[0226] The specific calculation process for the first deviation is as follows: Figure 7 As shown, Figure 7 A schematic flow chart of a method for calculating a first deviation provided in an embodiment of the present application is shown, wherein the method includes steps S701-S703; specifically:

[0227] S701: Input the third training text into the target service object, and predict the output category of the third training text through the target service object to obtain the output result before correction.

[0228] Here, the output result before correction is used to represent the probability that the output category of the third training text belongs to each preset category.

[0229] Specifically, in the embodiment of the present application, taking the target service object as the text classification model in the "prior type" as an example, the third training text currently determined to be subjected to text error correction processing by the second language representation model is sentence a, and the corrected training text output after sentence a is subjected to text error correction processing by the second language representation model is corrected training sentence a2; at this time, sentence a is input into the text classification model as the target service object, and the output results before correction obtained may be of the following two types:

[0230] Type 1: the text output category to which sentence a belongs is more obvious in the output result before correction, that is, the probability value of sentence a belonging to a certain preset category is significantly higher than the probability value of sentence a belonging to other preset categories, or the probability value of sentence a belonging to a certain preset category is greater than or equal to 50%.

[0231] By way of example, at this time, the output result R1 before correction can be: the probability that sentence a belongs to the first preset category is 70%, the probability that it belongs to the second preset category is 5%, the probability that it belongs to the third preset category is 5%, the probability that it belongs to the fourth preset category is 10%, and the probability that it belongs to the fifth preset category is 10%.

[0232] Type 2: The text output category to which sentence a belongs is not obvious in the output result before correction, that is, the probability distribution result of sentence a belonging to each preset category is average.

[0233] By way of example, at this time, the output result r1 before correction can be: the probability that sentence a belongs to the first preset category is 15%, the probability that it belongs to the second preset category is 15%, the probability that it belongs to the third preset category is 20%, the probability that it belongs to the fourth preset category is 25%, and the probability that it belongs to the fifth preset category is 25%.

[0234] S702: input the corrected training text into the target service object, and predict the output category of the corrected training text through the target service object to obtain the corrected output result.

[0235] Here, the corrected output result is used to represent the probability that the output category of the corrected training text belongs to each preset category.

[0236] Specifically, the implementation of step S702 is the same as that of the above step S701, and the possible types of the output results after correction are similar to the possible types of the output results before correction, and the repeated parts are not repeated here.

[0237] S703, calculating a probability deviation value of the output result after correction and the output result before correction being in the same preset category, and using the calculated result as the first deviation.

[0238] Here, the two different types of output results before correction shown in the above step S701 are exemplarily described as follows:

[0239] (1) When the output result before correction belongs to type 1:

[0240] Here, as an optional embodiment, the target preset category corresponding to the highest probability value can be determined from the output results before correction as the specific preset category for comparing the model output results of the target service object before and after correction, and then the first deviation between the output result after correction and the output result before correction is calculated under the target preset category.

[0241] For example, take the output result R1 before correction as an example. The output result R1 before correction is: the probability that sentence a belongs to the first preset category is 70%, the probability that it belongs to the second preset category is 5%, the probability that it belongs to the third preset category is 5%, the probability that it belongs to the fourth preset category is 10%, and the probability that it belongs to the fifth preset category is 10%; if the output result R2 after correction is: the probability that the corrected training sentence a2 belongs to the first preset category is 90%, the probability that it belongs to the second preset category is 2%, the probability that it belongs to the third preset category is 3%, the probability that it belongs to the fourth preset category is 4%, and the probability that it belongs to the fifth preset category is 1%; then the numerical change caused by the occurrence of the text error correction processing of the highest probability value of the preset category to which the output result R1 before correction belongs can be directly used as the first deviation; at this time, the first deviation is calculated to be: 90%-70%=20%, that is, the first deviation is a positive deviation with a value of 20%.

[0242] (2) When the output result before correction belongs to type 2:

[0243] Here, as another optional embodiment, a preset probability threshold (such as 20%) can be used to screen out multiple probability values ​​in the output results before correction / output results after correction that are higher than the probability threshold, and then the average value of these screened probability values ​​can be calculated, and the difference between the average values ​​of the two output results before and after correction can be used as the above-mentioned first deviation.

[0244] For example, a preset probability threshold of 20% is used as an example. If the output result r1 before correction is: the probability of sentence a belonging to the first preset category is 15%, the probability of belonging to the second preset category is 15%, the probability of belonging to the third preset category is 20%, the probability of belonging to the fourth preset category is 25%, and the probability of belonging to the fifth preset category is 25%; then the probability values ​​higher than the probability threshold in the output result r1 before correction are: 20%, 25%, 25%;

[0245] If the corrected output result r2 is: the probability that the corrected training sentence a2 belongs to the first preset category is 5%, the probability that it belongs to the second preset category is 5%, the probability that it belongs to the third preset category is 15%, the probability that it belongs to the fourth preset category is 50%, and the probability that it belongs to the fifth preset category is 25%; then the probability values ​​in the corrected output result r2 that are higher than the probability threshold are: 50%, 25%;

[0246] At this time, according to the optional embodiment of the above type 2, the first deviation can be calculated as:

[0247]

[0248] Here, the difference in the calculation method of the first deviation under the above two types needs to be explained:

[0249] In the type, the output category of sentence a before correction in the third training sample is more obvious in the output result before correction, that is, even if sentence a is not subjected to text correction processing, the target service object can still determine the specific text classification result of sentence a. At this time, the first deviation is a positive deviation with a value of 20%, which can be understood as: the text correction service provided by the text correction model contributes 20% to the target service object's obtaining of the exact text classification result (equivalent to improving the accuracy of the output result of the target service object's text classification for sentence a).

[0250] Under type two, the output category of sentence a before correction in the third training sample is not obvious in the output result before correction, that is, if sentence a is not subjected to text correction processing, the target service object cannot obtain an exact text classification result for sentence a. At this time, the first deviation belongs to a positive deviation with a value of 14.17%, which can be understood as: the text correction service provided by the text correction model contributes 14.17% to the target service object's ability to obtain an exact text classification result.

[0251] Here, when the first deviation is a negative deviation, it is equivalent to changing the "contribution" in the above analysis into the reverse "loss", that is, the negative deviation is used to characterize that the text correction service provided by the text correction model will have a negative impact on the model output results of the target service object. The repetition will not be repeated here.

[0252] 2. When the third training text is text data output by the target service object during the training process:

[0253] At this time, the third training text is used as the output result before correction; the corrected training text is used as the output result after correction, that is, the output result before correction is the third training text; the output result after correction is the corrected training text.

[0254] Here, as an optional embodiment, the second deviation of the model output result of the target service object before and after correction can be calculated according to the second deviation calculation strategy; based on the second deviation, it is determined whether the second deviation belongs to the positive deviation or the negative deviation; wherein the second deviation calculation strategy may be different from the above-mentioned first deviation calculation strategy.

[0255] The specific calculation process for the second deviation is as follows: Figure 8 As shown, Figure 8 A schematic flow chart of a method for calculating a second deviation provided in an embodiment of the present application is shown, wherein the method includes steps S801-S804; specifically:

[0256] S801, obtaining standard text recognition results of target input data.

[0257] Here, the target input data is used to represent the model input data of the target service object when the target service object outputs the third training text during the training process.

[0258] It should be noted that, since the second deviation is equivalent to being calculated when the third training text is the output text data of the target service object, the target input data may be non-text type data.

[0259] For example, taking the target service object as an image recognition model, the target input data is image B, and sentence b1 in the third training text is the text recognition prediction result obtained after the target service object performs image text recognition on image B; at this time, according to the reference sample data used by the target service object in the training process, the standard text recognition result b of image B can be obtained from the reference sample data.

[0260] S802, calculating a text recognition deviation value between the third training text and the standard text recognition result, and using the calculation result as a first text recognition deviation value.

[0261] For example, still taking the above example, the stroke edit distance d1 between sentence b1 in the third training text and the standard text recognition result b (equivalent to the text difference between sentence b1 and the standard text recognition result b) is calculated, and the stroke edit distance d1 is used as the first text recognition deviation value. At this time, the smaller the stroke edit distance d1, the higher the similarity between sentence b1 and the standard text recognition result b (equivalent to the smaller the difference), and the more accurate the model output result of the target service object.

[0262] S803, calculating a text recognition deviation value between the corrected training text and the standard text recognition result, and using the calculation result as a second text recognition deviation.

[0263] For example, taking the above example, if the corrected training text obtained after sentence b1 is corrected by the second language representation model is the corrected training sentence b2, then the stroke editing distance d2 between the corrected training sentence b2 and the standard text recognition result b is calculated, and the stroke editing distance d2 is used as the second text recognition deviation value.

[0264] S804: Calculate the difference between the first text recognition deviation value and the second text recognition deviation value, and use the calculation result as the second deviation.

[0265] For example, taking the above example, the difference d between the stroke edit distance d1 and the stroke edit distance d2 is calculated, and the calculation result of the difference d is used as the second deviation; at this time, if the calculation result of the difference d is a negative number (equivalent to that after the text correction processing, the text difference between the text recognition prediction result output by the target service object and the standard text recognition result b has increased), it means that the second deviation is a negative deviation, that is, the text correction service provided by the text correction model will have a negative impact on the model output result of the target service object.

[0266] If the calculated result of the difference d is a positive number (equivalent to the fact that after the text correction processing, the text difference between the text recognition prediction result output by the target service object and the standard text recognition result b is reduced), it means that the second deviation is a positive deviation, that is, the text correction service provided by the text correction model is beneficial to improving the image text recognition accuracy of the target service object for image B.

[0267] With respect to the specific implementation process of the above step S104, regarding how to adjust the model parameters of the second language representation model according to the positive deviation / negative deviation, the present application embodiment provides the following optional implementation scheme, specifically:

[0268] like Fig. 9 As shown, Fig. 9 A flow chart of a method for adjusting model parameters of a second language representation model provided in an embodiment of the present application is shown, wherein when executing step S104, the method includes steps S901-S902; specifically:

[0269] S901 , in each training cycle of the second language representation model, obtaining a target positive deviation / negative deviation obtained by a target second language representation model trained based on the training cycle.

[0270] Specifically, in the above step S103, the third training text is equivalent to a sentence set consisting of each sentence input or output by the target service object during the training process; the third training text is input into the second language representation model one by one in the form of one sentence; based on this, as an optional embodiment, the training cycle in the above step S901 can be determined according to the data utilization rate of the second language representation model under training for the third training text; for example, if the data utilization rate of the third training text is 10% as a training cycle, then it is equivalent to that if the model traverses the sentences in the third training text once during the training process, a total of 10 training cycles are required; if the data utilization rate of the third training text is 20% as a training cycle, then it is equivalent to that if the model traverses the sentences in the third training text once during the training process, a total of 5 training cycles are required.

[0271] In an embodiment of the present application, a mirror model of a second language representation model can be saved and maintained every other training cycle, so that the second language representation model trained in the previous training cycle and the mirror model that was not trained in the previous training cycle are synchronously trained in each training cycle, so that according to the deviation and value accumulated by the second language representation model in the current training cycle (i.e., the sum of positive deviation and negative deviation) and the deviation and value accumulated by the mirror model, the model with the highest deviation and value (equivalent to the best training effect in the current training cycle) is selected as the target second language representation model that needs to adjust the model parameters in the current training cycle, and the model parameters of the target second language representation model are adjusted according to each target positive deviation / negative deviation obtained by the target second language representation model in the current training cycle.

[0272] S902, adjusting the model parameters of the target second language representation model according to the target positive deviation / negative deviation, and obtaining the text error correction model including the adjusted model parameters when the target second language representation model meets a training cutoff condition.

[0273] In an embodiment of the present application, the above target positive deviation / negative deviation may be substituted into the model loss function of the target second language representation model as a loss control variable to adjust the model parameters of the target second language representation model.

[0274] Specifically, as an optional embodiment, the model loss function of the target second language representation model may be in the form of a function as shown in the following formula:

[0275]

[0276] Among them, J(θ) is the target second language representation model G θ The original model loss function during the training process can be taken as the commonly used least squares loss function;

[0277] ▽ θ It means to take the derivative of the multiplication function;

[0278] s x ~G θ (Y 1:t-1 ) represents the target word s that is currently being corrected x The output probability of the t-th position in the third training text, that is, the output probability that the text error correction process occurs at the t-th position in the third training text;

[0279] represents the expected value of the above output probability;

[0280] logG θ(Y 1:T ) represents the target second language representation model G θ During the training process, for each currently processed segmentation in the third training text, the corrected target segmentation s is calculated based on the context content of the segmentation from time 1 to time T. x The entropy of the target word s that is currently being corrected x probability distribution in the third training text;

[0281] D φ is the loss control variable, that is, each target positive deviation / negative deviation obtained by the target second language representation model based on each training sentence in the third training text during the current training cycle;

[0282] ε is the adjustment parameter of the loss control variable, which is used to adjust the weight of the above loss control variable in the model loss function.

[0283] In an alternative embodiment, Fig.10 As shown, Fig.10 A flow chart of a method for determining a target second language representation model in each training cycle provided by an embodiment of the present application is shown, wherein before executing the model parameter adjustment method shown in steps S901-S902 in each training cycle, the method includes steps S1001-S1005; specifically:

[0284] S1001, when reaching each training cycle of the second language representation model, obtaining the second language representation model trained in the previous training cycle, and generating a mirror image second language representation model that was not trained in the previous training cycle.

[0285] Here, it should be noted that if the current training cycle is the first training cycle of the second language representation model, then only the second language representation model in the training process can be obtained as the target second language representation model that needs to adjust the model parameters in the current training cycle, that is, in the first training cycle, it can be regarded as that there is no mirror model that has not been trained in the previous training cycle.

[0286] S1002, in this training cycle, synchronously train the second language representation model trained in the previous training cycle and the mirror second language representation model that was not trained in the previous training cycle, to obtain an optimized second language representation model and an optimized mirror second language representation model trained in this training cycle, respectively.

[0287] Here, with respect to the specific implementation of step S1002, in the current training cycle, with respect to the target sentence currently input into the second language representation model / mirror second language representation model in the third training text, if the target sentence belongs to the input text data of the target service object, the first deviation calculation method shown in the aforementioned steps S701-S703 can be referred to to calculate the positive deviation / negative deviation of the second language representation model / mirror second language representation model for the target sentence; if the target sentence belongs to the output text data of the target service object, the second deviation calculation method shown in the aforementioned steps S801-S804 can be referred to to calculate the positive deviation / negative deviation of the second language representation model / mirror second language representation model for the target sentence; the repeated parts will not be repeated here.

[0288] S1003: Obtain a first training deviation obtained based on the optimized second language representation model and a second training deviation obtained based on the optimized mirrored second language representation model in the training cycle.

[0289] Here, the first training deviation is used to characterize the deviation and value of multiple positive deviations / negative deviations obtained based on the optimized second language representation model during the training cycle; the second training deviation is used to characterize the deviation and value of multiple positive deviations / negative deviations obtained based on the optimized mirrored second language representation model during the training cycle.

[0290] S1004: If the first training deviation is less than the second training deviation, use the optimized mirrored second language representation model to replace the optimized second language representation model as the target second language representation model for the training cycle.

[0291] S1005: If the first training deviation is greater than the second training deviation, the optimized second language representation model is used as the target second language representation model of the training cycle; and at the same time, the optimized mirror second language representation model is used as the mirror second language representation model that is not trained in the training cycle.

[0292] Specifically, with respect to the above-mentioned steps S1004 and S1005, the embodiment of the present application selects the model with the highest deviation and value (equivalent to the best training effect in the current training cycle) as the target second language representation model for which model parameters need to be adjusted in the current training cycle before executing the model parameter adjustment method shown in steps S901 and S902 in each training cycle, based on the deviation and value accumulated by the second language representation model in the current training cycle (i.e., the first training deviation) and the deviation and value accumulated by the mirror model (i.e., the second training deviation).

[0293] Based on the model parameter adjustment method described in the above steps S901 and S902, the present application simulates each text error correction process during the model training process. When the occurrence of the text error correction process has a positive impact on the output result of the target service object, the calculated positive deviation is used as the reward-type adjustment parameter of the model to positively adjust the model parameters of the target second language representation model; when the occurrence of the text error correction process has a negative impact on the model output result of the target service object, the calculated negative deviation is used as the penalty-type adjustment parameter of the model to negatively adjust the model parameters of the target second language representation model.

[0294] In this way, by controlling the learning behavior of the model through the above-mentioned reward and punishment adjustment mechanism that is targeted at text error correction tasks in the target field, the present application can replace the traditional model training method that relies on marked "annotated samples" to define the model learning direction, which is beneficial to reducing the model training process's dependence on "annotated samples"; on this basis, based on the target second language representation model determination method shown in the above steps S1001-S1005, the present application also selects the model with the largest total reward (equivalent to the maximum positive value of the deviation sum) in a training cycle as the target optimization model for actually adjusting model parameters in the current training cycle based on the sum of the positive and negative deviations accumulated by the model in each training cycle, which is beneficial to successively accelerate the convergence process of the model.

[0295] To sum up, even if the number of “annotated samples” is insufficient, it will not affect the training effect of the text error correction model in this application, which will help the model to converge quickly and make the trained text error correction model more stable.

[0296] In the embodiment of the present application, based on the testing concept similar to the training concept in the above steps, through the data interaction with the target service object, in addition to the third training text, the text error correction model can also obtain the test text data involved in the test process of the target service object from the target service object in the same way, so as to evaluate the training effect of the text error correction model by using the test text data, specifically:

[0297] like Fig.11 As shown, Fig.11 A flow chart of a method for testing a text error correction model provided by an embodiment of the present application is shown, wherein after executing step S104, the method further includes steps S1101-S1103; specifically:

[0298] S1101, inputting the test text input or output by the target service object during the test into the text error correction model, and obtaining the corrected test text output by the text error correction model after the test text is subjected to text error correction processing.

[0299] It should be noted that the execution method of step S1101 is the same as that of step S103. Please refer to the relevant explanation content of the aforementioned step S103, and the repeated parts will not be repeated here.

[0300] S1102, obtaining a test deviation of the test output result of the target service object before and after correction according to a first test output result obtained by the target service object based on the test text and a second test output result obtained by the target service object based on the corrected test text.

[0301] Here, the test deviation includes a positive test deviation which is a positive number and a negative test deviation which is a negative number.

[0302] It should be noted that each time the test deviation generated before and after correction is calculated in step S1102, if the test sentence in the current test text belongs to the input text data of the target service object, the above-mentioned test deviation can be calculated in the manner of calculating the first deviation in the aforementioned step; if the test sentence in the current test text belongs to the output text data of the target service object, the above-mentioned test deviation can be calculated in the manner of calculating the second deviation in the aforementioned step; the repetitions will not be repeated here.

[0303] S1103, determining the model training effect of the text error correction model according to the test deviation generated before and after each correction.

[0304] Specifically, the sum of the test deviations obtained by the text error correction model during the test process can be calculated based on the test deviations generated before and after each correction, so as to evaluate the model training effect of the text error correction model based on the test deviation sum.

[0305] It should be noted that, in the training process of the text error correction model, after calculating the positive deviation / negative deviation obtained in each training process, it is necessary to adjust and optimize the model parameters in the text error correction model based on the calculated positive deviation / negative deviation according to the method shown in steps S901-S902. However, unlike the training method of the text error correction model, in the testing process of the model, it is not necessary to adjust the model parameters in the trained text error correction model, that is, when executing step S1103, it does not involve the model optimization process in the above steps S901-S902. It is only necessary to record the test deviation obtained each time, and use the sum of each test deviation to evaluate the training effect of the text error correction model.

[0306] Through the training method of the above-mentioned text error correction model provided by the embodiment of the present application, the present application first uses the general text data in the open field to perform basic training on the language model, and then uses the proprietary text data in the target field to fine-tune the language model, so that the trained language model has the ability to recognize specific text features in the target field; then, through data interaction with the converged target service object, the more mature target service object in the target field is used as a teacher model to perform interactive auxiliary training on the text error correction model in training. Through the above-mentioned training method, the present application can train the model to quickly adapt to more complex and unique language environments without losing the generalized text error correction ability, thereby improving the model's text error correction accuracy in the target field.

[0307] In the embodiment of the present application, after the text error correction model is trained, the process of the application stage of the text error correction model is as follows:

[0308] like Fig.12 As shown, Fig.12 A flow chart of a text error correction method provided by an embodiment of the present application is shown, wherein the text error correction method is applied to a pre-trained text error correction model; the text error correction model is used to provide text error correction services for target service objects in a target field; wherein the target service objects belong to a mature algorithm model that has converged in the target field; the text error correction method also includes steps S1201-S1202; specifically:

[0309] S1201, inputting the text to be corrected that needs to be corrected by the target service object during the application process into a pre-trained text correction model, correcting the target text errors included in the text to be corrected by the text correction model, and obtaining the corrected text for the text to be corrected output by the text correction model.

[0310] It should be noted that the text error correction model is obtained after being trained according to the above steps S101-S104 and tested according to the above steps S1101-S1103; for the specific training process and the specific testing process of the text error correction model, you can refer to the specific implementation process of the above steps, and the repetitions will not be repeated here.

[0311] Combined with the analysis content of the above steps, it can be known that the service object type to which the target service object belongs is divided into three types: "a priori type", "bidirectional verification type" and "post-hoc type". The following is about how to determine the text to be corrected under these three specific types. The embodiment of the present application also provides the following optional implementation schemes, specifically:

[0312] (1) For the case where the target service object belongs to the "a priori type":

[0313] At this time, the text error correction model is used to provide text error correction services for the input text data of the target service object. Based on this, as an optional embodiment, when the target service object belongs to the "a priori type", the input text data of the target service object can be directly obtained from the target service object as the text to be corrected that needs to be processed for text error correction.

[0314] (2) For the case where the target service object belongs to the "two-way verification type":

[0315] At this time, the text error correction model is used to provide text error correction services for the input text data and / or output text data of the target service object. Based on this, as an optional embodiment, when the target service object belongs to the "two-way verification type", according to the current specific application requirements of the target service object, the text data that matches the current specific application requirements of the target service object can be obtained from the input text data and / or output text data of the target service object as the text to be corrected that needs to be processed for text error correction.

[0316] (3) For the case where the target service object belongs to the "a posteriori type":

[0317] At this time, the text error correction model is used to provide text error correction services for the output text data of the target service object. Based on this, as an optional embodiment, when the target service object belongs to the "a posteriori type", the output text data of the target service object can be directly obtained from the target service object as the text to be corrected that needs to be processed for text error correction:

[0318] Specifically, the text error correction model is used to correct the target text errors included in the text to be corrected; among them, the target text errors are determined according to the specific semantic features and / or text expression features in the target field. For example, if the target field is the game field, then the text expression "mei zhi" in the game field belongs to the specific text expression method and does not require text error correction; if the target field is the education field, then the text expression "mei zhi" in the education field belongs to a text expression error and requires text error correction.

[0319] S1202, replace the text to be corrected input or output by the target service object during the application process with the corrected text.

[0320] It should be noted that there are differences between the corrected text and the text to be corrected, that is, the text error correction model has performed text error correction processing on the text to be corrected, which can be understood in the following 3 ways. Among them, the following 3 ways of understanding are also equivalent to the core error correction concept of performing text error correction services in the target field. Specifically:

[0321] (1) Correct errors for conventional text errors such as basic "semantic errors" and "writing errors".

[0322] Exemplarily, still taking the target field as the game field, when "Great天狗" appears in the text data to be corrected in the form of a conventional text error like "大天够", it belongs to the situation where the text correction model in this application needs to perform text correction processing.

[0323] (2) Although it is not a conventional text error such as a typo, but some text expressions in the text are relatively complex and lengthy, and the characteristic text expressions in the target field can be used for replacement to make the replaced text more concise and better reflect the text characteristics of the target field.

[0324] Exemplarily, still taking the target field as the game field, if the text to be corrected is "The game character f in game X that can help teammate players timely replenish the character's life attribute value", then according to the established characteristic text expression in the game field that collectively refers to game characters with the skill of "being able to help teammate players timely replenish the character's life attribute value" as "healer-type" game characters, the text to be corrected "The game character f in game X that can help teammate players timely replenish the character's life attribute value" can be corrected to "The healer-type game character f in game X", which also belongs to the situation where the text correction model in this application needs to perform text correction processing.

[0325] (3) On the basis of (2), for the original characteristic text expressions in the text, due to the contradiction between the conventional expression of words in the general field and the characteristic text expression, the original characteristic text expressions in the text will not be wrongly corrected.

[0326] Exemplarily, still taking the target field as the game field, if the text to be corrected is "The healer-type game character f in game X", for the existing text correction model, since "奶" and "妈" generally belong to sensitive words that need to be corrected when they appear simultaneously, the existing text correction model will perform text correction processing on this text data to be corrected; in contrast, this situation is exactly the situation where the trained text correction model in this application does not need to perform text correction processing.

[0327] Through the above text correction method provided by the embodiments of this application, after training the text correction model, this application can use the text correction model to perform text correction processing on the text data involved in the application process of the target service object, which is beneficial to improving the accuracy of the output result of the target service object model and the operation efficiency of the target service object.

[0328] Based on the same inventive concept, the embodiments of the present application also provide a training device for a text error correction model corresponding to the training method for the text error correction model in the above embodiments. Since the principle of solving the problem by the training device in the embodiments of the present application is similar to the training method in the above embodiments of the present application, the implementation of the training device can refer to the implementation of the above-mentioned training method, and the repeated parts will not be repeated.

[0329] Reference Fig.13 As shown, Fig.13 A structural schematic diagram of a training device for a text error correction model provided in an embodiment of the present application is shown; wherein the text error correction model is used to provide text error correction services for target service objects in a target domain; the target service objects belong to a mature algorithm model that has converged in the target domain; the training device includes:

[0330] A first training module 1301 is used to pre-train a language model using a first training text without semantic tags to obtain a first language representation model; wherein the first training text includes specific text data in the target domain and general text data outside the target domain;

[0331] The second training module 1302 is used to train the first language representation model using the second training text with semantic marking in the target domain to obtain a second language representation model with target text feature recognition capability; wherein the target text feature is used to represent the semantic features and / or text expression features that are unique to the text data in the target domain;

[0332] The first processing module 1303 is used to input the third training text input or output by the target service object during the training process into the second language representation model, and obtain the corrected training text output by the second language representation model after performing text error correction processing on the third training text;

[0333] The parameter adjustment module 1304 is used to obtain the positive deviation / negative deviation of the model output result of the target service object before and after correction based on the pre-correction output result obtained by the target service object based on the third training text and the post-correction output result obtained by the target service object based on the corrected training text, and adjust the model parameters of the second language representation model according to the positive deviation / negative deviation to obtain a text error correction model including the adjusted model parameters.

[0334] In an optional implementation, the first training module 1301 is specifically configured to:

[0335] By random sampling, masking a first target number of segmented words in the first training text is performed to obtain a first masked training text including the first target number of masked words; wherein the first target number is determined according to a sampling ratio of the random sampling and the number of segmented words included in the first training text;

[0336] Inputting the first masked training text into the language model to obtain a first masked prediction text output by the language model including a prediction result of a first target number of masked words;

[0337] The model parameters of the language model are adjusted by using the cross entropy loss between the first masked prediction text and the first training text that is not masked, until the language model reaches convergence, and the language model that reaches convergence is used as the first language representation model.

[0338] In an optional implementation, the first training module 1301 is specifically configured to:

[0339] According to a first preset sampling ratio, a second target number of segmented words belonging to the specific text data in the first training text are masked to obtain a second masked training text including the second target number of masked words; wherein the second target number is determined according to the first preset sampling ratio and the number of segmented words belonging to the specific text data in the first training text;

[0340] Inputting the second masked training text into the language model to obtain a second masked prediction text output by the language model including a prediction result of a second target number of masked words;

[0341] The model parameters of the language model are adjusted by using the cross entropy loss between the second masked prediction text and the first training text that is not masked, until the language model reaches convergence, and the language model that has reached convergence is used as the first language representation model.

[0342] In an optional embodiment, the training of the first language representation model using the semantically labeled second training text in the target domain at least includes: performing coarse-grained training and / or fine-grained training on the first language representation model using the semantically labeled second training text in the target domain; wherein the coarse-grained training is used to train the first language representation model to classify different sentences under the same semantic concept in the second training text according to different text expressions corresponding to the same semantic concept in the target domain; and the fine-grained training is used to train the first language representation model to identify the text expression of each sentence in the target domain according to the word segmentation sequence labeling results of each sentence in the second training text in the target domain.

[0343] In an optional implementation, the second training module 1302 is configured to perform the coarse-grained training on the first language representation model by:

[0344] For any two sentences in the second training text, the original versions of the two sentences after removing the existing semantic tags are input into the first language representation model, and the first language representation model is used to perform classification prediction on whether the two sentences correspond to the same semantic concept in the target domain, thereby obtaining classification prediction results of the two sentences;

[0345] Determine the true classification results of the arbitrary two sentences according to the semantic tags already present in the second training text; wherein the true classification results are used to indicate whether the arbitrary two sentences correspond to the same semantic concept in the target domain;

[0346] The model parameters of the first language representation model are adjusted by using the cross entropy loss between the classification prediction result and the true classification result until the first language representation model reaches convergence.

[0347] In an optional implementation, the second training module 1302 is configured to perform the fine-grained training on the first language representation model by:

[0348] For each sentence in the second training text, the original version of the sentence after removing the existing semantic tags is input into the first language representation model, and the sentence components of the sentence in the target domain are analyzed by the first language representation model to obtain a sentence analysis result of the sentence in the target domain; wherein the sentence components at least include: a first target participle belonging to an entity defined in the target domain, and a second target participle capable of representing different semantic concepts in the target domain;

[0349] According to the multiple entities defined in the target domain and the semantic tags already in the sentence, multiple word segments included in the sentence are sequence-labeled to obtain a word segmentation sequence labeling result of the sentence;

[0350] The model parameters of the first language representation model are adjusted by using the cross entropy loss between the sentence analysis result and the word segmentation sequence labeling result until the first language representation model reaches convergence.

[0351] In an optional implementation manner, the first processing module 1303 is specifically configured to:

[0352] For each sentence in the third training text, input the sentence into the second language representation model to obtain a first output result of the second language representation model for the sentence;

[0353] In the case where it is detected that there is a difference between the first output result and the sentence, determining that the second language representation model has performed the text error correction processing on the sentence, and using the first output result as the corrected training text;

[0354] When it is detected that the first output result is the same as the sentence, the next sentence is obtained from the third training text, and the above processing steps for the sentence are repeated until the corrected training text is obtained.

[0355] In an optional implementation, the parameter adjustment module 1304 is used to:

[0356] When the third training text belongs to the text data input by the target service object during the training process, the third training text is input into the target service object, and the output is output to obtain the output result before correction;

[0357] The corrected training text is input into the target service object, and the corrected output result is output.

[0358] In an optional implementation, when the third training text is input into the target service object and the output result before correction is obtained, the parameter adjustment module 1304 is used to:

[0359] Inputting the third training text into the target service object, predicting the output category of the third training text through the target service object, and obtaining the output result before correction; wherein the output result before correction is used to represent the probability that the output category of the third training text belongs to each preset category;

[0360] When the corrected training text is input into the target service object and the corrected output result is output, the parameter adjustment module 1304 is used to:

[0361] The corrected training text is input into the target service object, and the output category of the corrected training text is predicted by the target service object to obtain the corrected output result; wherein the corrected output result is used to characterize the probability that the output category of the corrected training text belongs to each preset category.

[0362] In an optional implementation, when obtaining the positive deviation / negative deviation of the model output result of the target service object before and after correction, the parameter adjustment module 1304 is used to:

[0363] Calculate, according to the first deviation calculation strategy, a first deviation of the model output result of the target service object before and after the correction;

[0364] Based on the first deviation, it is determined whether the first deviation belongs to the positive deviation or the negative deviation.

[0365] In an optional implementation, when calculating the first deviation of the model output result of the target service object before and after the correction according to the first deviation calculation strategy, the parameter adjustment module 1304 is used to:

[0366] The probability deviation value of the output result after correction and the output result before correction in the same preset category is calculated, and the calculated result is used as the first deviation.

[0367] In an optional implementation, the parameter adjustment module 1304 is further configured to:

[0368] When the third training text belongs to the text data output by the target service object during the training process, the third training text is used as the output result before correction; and the corrected training text is used as the output result after correction.

[0369] In an optional implementation, when obtaining the positive deviation / negative deviation of the model output result of the target service object before and after correction, the parameter adjustment module 1304 is further used to:

[0370] Calculate the second deviation of the model output result of the target service object before and after the correction according to the second deviation calculation strategy;

[0371] Based on the second deviation, it is determined whether the second deviation belongs to the positive deviation or the negative deviation.

[0372] In an optional implementation, when calculating the second deviation of the model output result of the target service object before and after the correction according to the second deviation calculation strategy, the parameter adjustment module 1304 is specifically used to:

[0373] Obtaining a standard text recognition result of the target input data; wherein the target input data is used to represent the model input data of the target service object when the target service object outputs the third training text during the training process;

[0374] Calculating a text recognition deviation value between the third training text and the standard text recognition result, and using the calculation result as a first text recognition deviation value;

[0375] Calculating a text recognition deviation value between the corrected training text and the standard text recognition result, and using the calculation result as a second text recognition deviation value;

[0376] The difference between the first text recognition deviation value and the second text recognition deviation value is calculated, and the calculation result is used as the second deviation.

[0377] In an optional implementation, when the model parameters of the second language representation model are adjusted according to the positive deviation / negative deviation to obtain a text error correction model including the adjusted model parameters, the parameter adjustment module 1304 is specifically used to:

[0378] In each training cycle of the second language representation model, obtaining a target positive deviation / negative deviation obtained by the target second language representation model trained based on the training cycle;

[0379] According to the target positive deviation / negative deviation, the model parameters of the target second language representation model are adjusted, and when the target second language representation model meets the training cutoff condition, the text error correction model including the adjusted model parameters is obtained.

[0380] In an optional implementation, the parameter adjustment module 1304 is further configured to determine the target second language representation model in each training cycle by the following method:

[0381] When reaching each training cycle of the second language representation model, obtaining the second language representation model trained in the previous training cycle, and generating a mirror image second language representation model that was not trained in the previous training cycle;

[0382] In the training cycle, the second language representation model trained in the previous training cycle and the mirror image second language representation model that was not trained in the previous training cycle are synchronously trained to obtain an optimized second language representation model and an optimized mirror image second language representation model trained in the training cycle, respectively;

[0383] Obtaining a first training deviation obtained based on the optimized second language representation model and a second training deviation obtained based on the optimized mirrored second language representation model in the training cycle; wherein the first training deviation is used to characterize the deviation and value of multiple positive deviations / negative deviations obtained based on the optimized second language representation model in the training cycle; and the second training deviation is used to characterize the deviation and value of multiple positive deviations / negative deviations obtained based on the optimized mirrored second language representation model in the training cycle;

[0384] If the first training deviation is less than the second training deviation, using the optimized mirrored second language representation model to replace the optimized second language representation model as the target second language representation model for the training cycle;

[0385] If the first training deviation is greater than the second training deviation, the optimized second language representation model is used as the target second language representation model of the training cycle; at the same time, the optimized mirror second language representation model is used as the mirror second language representation model that is not trained in the training cycle.

[0386] In an optional embodiment, the training device further includes:

[0387] A first testing module, used for inputting the test text input or output by the target service object during the test into the text error correction model, and obtaining a corrected test text output by the text error correction model after the test text is subjected to text error correction processing;

[0388] A second test module is used to obtain a test deviation of the test output result of the target service object before and after correction according to a first test output result obtained by the target service object based on the test text and a second test output result obtained by the target service object based on the corrected test text; wherein the test deviation includes a positive test deviation belonging to a positive number and a negative test deviation belonging to a negative number;

[0389] The third testing module is used to determine the model training effect of the text error correction model according to the test deviation generated before and after each correction.

[0390] Through the training device of the above-mentioned text error correction model provided by the embodiment of the present application, the present application first uses the general text data in the open field to perform basic training on the language model, and then uses the proprietary text data in the target field to fine-tune the language model, so that the trained language model has the ability to recognize specific text features in the target field; then, through data interaction with the converged target service object, the more mature target service object in the target field is used as a teacher model to perform interactive auxiliary training on the text error correction model in training. Through the above-mentioned training device, the present application can train the model to quickly adapt to more complex and unique language environments without losing the generalized text error correction ability, thereby improving the model's text error correction accuracy in the target field.

[0391] Based on the same inventive concept, a text correction device corresponding to the text correction method in the above embodiment is also provided in the embodiment of the present application. Since the principle of solving the problem by the text correction device in the embodiment of the present application is similar to the text correction method in the above embodiment of the present application, the implementation of the text correction device can refer to the implementation of the above-mentioned text correction method, and the repeated parts will not be repeated.

[0392] Reference Fig.14 As shown, Fig.14 A structural schematic diagram of a text error correction device provided by an embodiment of the present application is shown; wherein the text error correction device is applied to a pre-trained text error correction model; the text error correction model is used to provide text error correction services for target service objects in a target field; the target service objects belong to a mature algorithm model that has converged in the target field; the text error correction device includes:

[0393] The text error correction module 1401 is used to input the text to be corrected that needs to be corrected by the target service object during the application process into a pre-trained text error correction model, and correct the target text errors included in the text to be corrected by the text error correction model to obtain the corrected text for the text to be corrected output by the text error correction model; wherein the target text errors are determined according to the semantic features and / or text expression features specific to the target domain;

[0394] The text replacement module 1402 is used to replace the text to be corrected input or output by the target service object during the application process with the corrected text.

[0395] In an optional implementation, the text error correction model is obtained by training according to the training method in any of the optional implementations described in the above embodiments; the repetitions are not repeated here.

[0396] Through the above-mentioned text correction device provided by the embodiment of the present application, after training the text correction model, the present application can use the text correction model to perform text correction processing on the text data involved in the application process of the target service object, which is beneficial to improving the accuracy of the output results of the target service object model and the operating efficiency of the target service object.

[0397] like Fig.15 As shown, an embodiment of the present application provides an electronic device 1500 for executing the steps of any of the above-mentioned methods for training a text error correction model in the present application. The device includes a first memory 1501, a first processor 1502, and a computer program stored in the first memory 1501 and executable on the first processor 1502, wherein the first processor 1502 implements the steps of any of the above-mentioned methods for training a text error correction model when executing the computer program.

[0398] Specifically, the above-mentioned first memory 1501 and the first processor 1502 can be general-purpose memories and processors, which are not specifically limited here. When the first processor 1502 runs the computer program stored in the first memory 1501, it can execute the steps of any of the above-mentioned text error correction model training methods.

[0399] Corresponding to the training method of the text error correction model in the present application, an embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned training methods for the text error correction model are executed.

[0400] Specifically, the storage medium can be a general storage medium, such as a mobile disk, a hard disk, etc. When the computer program on the storage medium is run, it can execute the steps of any of the above-mentioned text error correction model training methods.

[0401] like Fig.16 As shown, an embodiment of the present application provides another electronic device 1600 for executing the steps of any of the text error correction methods described above in the present application, the device includes a second memory 1601, a second processor 1602, and a computer program stored in the second memory 1601 and executable on the second processor 1602, wherein the second processor 1602 implements the steps of any of the text error correction methods described above when executing the computer program.

[0402] Specifically, the second memory 1601 and the second processor 1602 may be general-purpose memories and processors, which are not specifically limited here. When the second processor 1602 runs the computer program stored in the second memory 1601, it can execute any of the steps of the text error correction method described above.

[0403] Corresponding to the text error correction method in the present application, an embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned text error correction methods are executed.

[0404] Specifically, the storage medium can be a general storage medium, such as a mobile disk, a hard disk, etc. When the computer program on the storage medium is executed, the steps of any of the above-mentioned text error correction methods can be executed.

[0405] In the embodiments provided in the present application, it should be understood that the disclosed systems and methods can be implemented in other ways. The system embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, 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 communication interfaces, indirect coupling or communication connection of systems or units, which can be electrical, mechanical or other forms.

[0406] 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.

[0407] In addition, each functional unit in the embodiments provided in 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.

[0408] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0409] It should be noted that similar numbers and letters represent similar items in the following figures. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are only used to distinguish the description and are not to be understood as indicating or implying relative importance.

[0410] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application. They should all be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A training method for a text error correction model, It is characterized in that The text error correction model is used to provide text error correction services for target service objects in a target field; wherein the target service objects belong to a mature algorithm model that has converged in the target field; and the training method includes: Pre-training a language model using a first training text without semantic tags to obtain a first language representation model; wherein the first training text includes specific text data in the target domain and general text data outside the target domain; The first language representation model is trained using a semantically labeled second training text in the target domain to obtain a second language representation model capable of identifying target text features; wherein the target text features are used to represent semantic features and / or text expression features that are unique to text data in the target domain; Inputting the third training text input or output by the target service object during the training process into the second language representation model, and obtaining a corrected training text output by the second language representation model after performing text error correction processing on the third training text; According to the pre-correction output result obtained by the target service object based on the third training text and the post-correction output result obtained by the target service object based on the corrected training text, the positive deviation / negative deviation of the model output result of the target service object before and after correction is obtained, and the model parameters of the second language representation model are adjusted according to the positive deviation / negative deviation to obtain a text error correction model including the adjusted model parameters.

2. The training method according to claim 1, It is characterized in that The method of pre-training a language model using a first training text without semantic tags to obtain a first language representation model includes: By random sampling, masking a first target number of segmented words in the first training text is performed to obtain a first masked training text including the first target number of masked words; wherein the first target number is determined according to a sampling ratio of the random sampling and the number of segmented words included in the first training text; Inputting the first masked training text into the language model to obtain a first masked prediction text output by the language model including a prediction result of a first target number of masked words; The model parameters of the language model are adjusted by using the cross entropy loss between the first masked prediction text and the first training text that is not masked, until the language model reaches convergence, and the language model that reaches convergence is used as the first language representation model.

3. The training method according to claim 1, It is characterized in that The method of pre-training the language model using the first training text without semantic tags to obtain the first language representation model also includes: According to a first preset sampling ratio, a second target number of segmented words belonging to the specific text data in the first training text are masked to obtain a second masked training text including the second target number of masked words; wherein the second target number is determined according to the first preset sampling ratio and the number of segmented words belonging to the specific text data in the first training text; Inputting the second masked training text into the language model to obtain a second masked prediction text output by the language model including a prediction result of a second target number of masked words; The model parameters of the language model are adjusted by using the cross entropy loss between the second masked prediction text and the first training text that is not masked, until the language model reaches convergence, and the language model that has reached convergence is used as the first language representation model.

4. The training method according to claim 1, It is characterized in that The training of the first language representation model using the semantically labeled second training text in the target domain at least includes: performing coarse-grained training and / or fine-grained training on the first language representation model using the semantically labeled second training text in the target domain; wherein the coarse-grained training is used to train the first language representation model to classify different sentences under the same semantic concept in the second training text according to different text expressions corresponding to the same semantic concept in the target domain; and the fine-grained training is used to train the first language representation model to identify the text expression of each sentence in the target domain according to the word segmentation sequence labeling result of each sentence in the second training text in the target domain.

5. The training method according to claim 4, It is characterized in that The coarse-grained training is performed on the first language representation model by the following method: For any two sentences in the second training text, the original versions of the two sentences after removing the existing semantic tags are input into the first language representation model, and the first language representation model is used to perform classification prediction on whether the two sentences correspond to the same semantic concept in the target domain, thereby obtaining classification prediction results of the two sentences; Determine the true classification results of the arbitrary two sentences according to the semantic tags already present in the second training text; wherein the true classification results are used to indicate whether the arbitrary two sentences correspond to the same semantic concept in the target domain; The model parameters of the first language representation model are adjusted by using the cross entropy loss between the classification prediction result and the true classification result until the first language representation model reaches convergence.

6. The training method according to claim 4, It is characterized in that The fine-grained training is performed on the first language representation model by the following method: For each sentence in the second training text, the original version of the sentence after removing the existing semantic tags is input into the first language representation model, and the sentence components of the sentence in the target domain are analyzed by the first language representation model to obtain a sentence analysis result of the sentence in the target domain; wherein the sentence components at least include: a first target participle belonging to an entity defined in the target domain, and a second target participle capable of representing different semantic concepts in the target domain; According to the multiple entities defined in the target domain and the semantic tags already in the sentence, multiple word segments included in the sentence are sequence-labeled to obtain a word segmentation sequence labeling result of the sentence; The model parameters of the first language representation model are adjusted by using the cross entropy loss between the sentence analysis result and the word segmentation sequence labeling result until the first language representation model reaches convergence.

7. The training method according to claim 1, It is characterized in that The step of inputting the third training text input or output by the target service object during the training process into the second language representation model to obtain a corrected training text output by the second language representation model after performing text error correction processing on the third training text, comprises: For each sentence in the third training text, input the sentence into the second language representation model to obtain a first output result of the second language representation model for the sentence; In the case where it is detected that there is a difference between the first output result and the sentence, determining that the second language representation model has performed the text error correction processing on the sentence, and using the first output result as the corrected training text; When it is detected that the first output result is the same as the sentence, the next sentence is obtained from the third training text, and the above processing steps for the sentence are repeated until the corrected training text is obtained.

8. The training method according to claim 1, It is characterized in that After obtaining the corrected training text output by the second language representation model after performing text error correction processing on the third training text, the training method further includes: When the third training text belongs to the text data input by the target service object during the training process, the third training text is input into the target service object, and the output is output to obtain the output result before correction; The corrected training text is input into the target service object, and the corrected output result is output.

9. The training method according to claim 8, It is characterized in that The step of inputting the third training text into the target service object and outputting the output result before correction includes: Inputting the third training text into the target service object, predicting the output category of the third training text through the target service object, and obtaining the output result before correction; wherein the output result before correction is used to represent the probability that the output category of the third training text belongs to each preset category; The step of inputting the corrected training text into the target service object and outputting the corrected output result comprises: The corrected training text is input into the target service object, and the output category of the corrected training text is predicted by the target service object to obtain the corrected output result; wherein the corrected output result is used to characterize the probability that the output category of the corrected training text belongs to each preset category.

10. The training method according to claim 9, It is characterized in that The obtaining of the positive deviation / negative deviation of the model output result of the target service object before and after the correction includes: Calculate, according to the first deviation calculation strategy, a first deviation of the model output result of the target service object before and after the correction; Based on the first deviation, it is determined whether the first deviation belongs to the positive deviation or the negative deviation.

11. The training method according to claim 10, It is characterized in that The step of calculating the first deviation of the model output result of the target service object before and after the correction according to the first deviation calculation strategy includes: The probability deviation value of the output result after correction and the output result before correction in the same preset category is calculated, and the calculated result is used as the first deviation.

12. The training method according to claim 1, It is characterized in that After obtaining the corrected training text output by the second language representation model after performing text error correction processing on the third training text, the training method further includes: When the third training text belongs to the text data output by the target service object during the training process, the third training text is used as the output result before correction; and the corrected training text is used as the output result after correction.

13. The training method according to claim 12, It is characterized in that The obtaining of the positive deviation / negative deviation of the model output result of the target service object before and after the correction includes: Calculate the second deviation of the model output result of the target service object before and after the correction according to the second deviation calculation strategy; Based on the second deviation, it is determined whether the second deviation belongs to the positive deviation or the negative deviation.

14. The training method according to claim 13, It is characterized in that The step of calculating the second deviation of the model output result of the target service object before and after the correction according to the second deviation calculation strategy includes: Obtaining a standard text recognition result of the target input data; wherein the target input data is used to represent the model input data of the target service object when the target service object outputs the third training text during the training process; Calculating a text recognition deviation value between the third training text and the standard text recognition result, and using the calculation result as a first text recognition deviation value; Calculating a text recognition deviation value between the corrected training text and the standard text recognition result, and using the calculation result as a second text recognition deviation value; The difference between the first text recognition deviation value and the second text recognition deviation value is calculated, and the calculation result is used as the second deviation.

15. The training method according to claim 1, It is characterized in that The step of adjusting the model parameters of the second language representation model according to the positive deviation / negative deviation to obtain a text error correction model including the adjusted model parameters includes: In each training cycle of the second language representation model, obtaining a target positive deviation / negative deviation obtained by the target second language representation model trained based on the training cycle; According to the target positive deviation / negative deviation, the model parameters of the target second language representation model are adjusted, and when the target second language representation model meets the training cutoff condition, the text error correction model including the adjusted model parameters is obtained.

16. The training method according to claim 15, It is characterized in that The target second language representation model for each training cycle is determined by the following method: When reaching each training cycle of the second language representation model, obtaining the second language representation model trained in the previous training cycle, and generating a mirror image second language representation model that was not trained in the previous training cycle; In the training cycle, the second language representation model trained in the previous training cycle and the mirror image second language representation model that was not trained in the previous training cycle are synchronously trained to obtain an optimized second language representation model and an optimized mirror image second language representation model trained in the training cycle, respectively; Obtaining a first training deviation obtained based on the optimized second language representation model and a second training deviation obtained based on the optimized mirrored second language representation model in the training cycle; wherein the first training deviation is used to characterize the deviation and value of multiple positive deviations / negative deviations obtained based on the optimized second language representation model in the training cycle; and the second training deviation is used to characterize the deviation and value of multiple positive deviations / negative deviations obtained based on the optimized mirrored second language representation model in the training cycle; If the first training deviation is less than the second training deviation, using the optimized mirrored second language representation model to replace the optimized second language representation model as the target second language representation model for the training cycle; If the first training deviation is greater than the second training deviation, the optimized second language representation model is used as the target second language representation model of the training cycle; at the same time, the optimized mirror second language representation model is used as the mirror second language representation model that is not trained in the training cycle.

17. The training method according to claim 1, It is characterized in that After obtaining the text error correction model including the adjusted model parameters, the training method further includes: Inputting the test text input or output by the target service object during the test into the text error correction model, and obtaining a corrected test text output by the text error correction model after the test text has been subjected to text error correction processing; According to the first test output result obtained by the target service object based on the test text and the second test output result obtained by the target service object based on the corrected test text, obtain the test deviation of the test output result of the target service object before and after the correction; wherein the test deviation includes a positive test deviation belonging to a positive number and a negative test deviation belonging to a negative number; The model training effect of the text error correction model is determined based on the test deviation generated before and after each correction.

18. A text error correction method, It is characterized in that The text error correction method is applied to a pre-trained text error correction model; the text error correction model is used to provide text error correction services for target service objects in a target field; wherein the target service objects belong to a mature algorithm model that has converged in the target field; the text error correction method includes: The text to be corrected that needs to be corrected by the target service object during the application process is input into a pre-trained text correction model, and the target text errors included in the text to be corrected are corrected by the text correction model to obtain a corrected text for the text to be corrected output by the text correction model; wherein the target text errors are determined according to the semantic features and / or text expression features specific to the target domain; and the text correction model is obtained after training according to any one of the training methods described in claims 1 to 17; The text to be corrected input or output by the target service object during the application process is replaced with the corrected text.

19. A training device for a text error correction model, It is characterized in that The text error correction model is used to provide text error correction services for target service objects in a target field; wherein the target service objects belong to a mature algorithm model that has converged in the target field; and the training device comprises: A first training module, used to pre-train the language model using a first training text without semantic tags to obtain a first language representation model; wherein the first training text includes specific text data in the target domain and general text data outside the target domain; A second training module is used to train the first language representation model using a second training text that has been semantically marked in the target domain to obtain a second language representation model that has the ability to recognize target text features; wherein the target text features are used to represent the semantic features and / or text expression features that are unique to the text data in the target domain; A first processing module, configured to input the third training text input or output by the target service object during the training process into the second language representation model, and obtain a corrected training text output by the second language representation model after performing text error correction processing on the third training text; A parameter adjustment module is used to obtain the positive deviation / negative deviation of the model output result of the target service object before and after correction based on the pre-correction output result obtained by the target service object based on the third training text and the post-correction output result obtained by the target service object based on the corrected training text, and adjust the model parameters of the second language representation model according to the positive deviation / negative deviation to obtain a text error correction model including the adjusted model parameters.

20. A text error correction device, It is characterized in that The text error correction device is applied to a pre-trained text error correction model; the text error correction model is used to provide text error correction services for target service objects in a target field; wherein the target service objects belong to a mature algorithm model that has converged in the target field; the text error correction device includes: A text correction module, used for inputting the text to be corrected that needs to be corrected by the target service object during the application process into a pre-trained text correction model, and correcting the target text errors included in the text to be corrected by the text correction model to obtain a corrected text for the text to be corrected output by the text correction model; wherein the target text errors are determined according to the semantic features and / or text expression features specific to the target domain; and the text correction model is obtained after training according to any one of the training methods described in claims 1 to 17; The text replacement module is used to replace the text to be corrected input or output by the target service object during the application process with the corrected text.

21. An electronic device, It is characterized in that include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the training method as described in any one of claims 1 to 17 are performed.

22. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, executes the steps of the training method as described in any one of claims 1 to 17.

23. An electronic device, It is characterized in that include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the text error correction method as described in claim 18 are performed.

24. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, executes the steps of the text error correction method as claimed in claim 18.

Citation Information

Patent Citations

  • Text information processing method, system and device and computer readable storage medium

    CN111460827A

  • End-to-end Chinese speech text error correction method and device and storage medium

    CN114444479A