Text error correction method and device, equipment, storage medium and program product
By correcting unnecessary content after preliminary error correction of the text, and utilizing natural language processing models and correction models, the problem of insufficient text error correction accuracy in the existing technology is solved, achieving higher error correction accuracy and fluency.
Patent Information
- Application Number
- CN202410331286.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-19
- Publication Date
- 2025-09-23
AI Technical Summary
Existing text correction technologies are insufficient in accuracy, especially in machine translation and speech recognition scenarios, and it is difficult to effectively reduce unnecessary correction content.
By obtaining the text to be corrected and performing preliminary corrections, the unnecessary correction content is corrected. By using the natural language processing model and the correction model, combined with the initial prompt information and format information, the correction results are gradually optimized to reduce unnecessary modifications.
It improves the accuracy of text correction, reduces the proportion of unnecessary correction content, and improves the reliability and fluency of correction results.
Smart Images

Figure CN120687583A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a text error correction method, apparatus, device, storage medium, and program product. Background Art
[0002] With the development of computer technology, text error correction (i.e., detecting and correcting errors in text) is increasingly required in more and more scenarios. For example, in machine translation, translated text needs to be corrected, while in speech recognition, recognized text needs to be corrected. Currently, the accuracy of text error correction still needs to be improved. Summary of the Invention
[0003] The present invention provides a method, apparatus, device, storage medium, and program product for text error correction, which can be used to improve the accuracy of text error correction. The technical solution is as follows:
[0004] In one aspect, an embodiment of the present application provides a text error correction method, the method comprising:
[0005] Obtaining a first text to be corrected;
[0006] Correcting the first text to obtain a second text;
[0007] Correcting non-essential error-correction content in the second text to obtain a third text, wherein the non-essential error-correction content includes at least one of the first content or the second content, the first content being obtained by replacing original words in the first text with the same meaning, and the second content being obtained by modifying the original semantics of the first text;
[0008] An error correction result of the first text is obtained based on the third text.
[0009] In another aspect, a text error correction device is provided, comprising:
[0010] A first acquisition module, configured to acquire a first text to be corrected;
[0011] an error correction module, configured to correct errors in the first text to obtain a second text;
[0012] a correction module, configured to correct non-essential error correction content in the second text to obtain a third text, wherein the non-essential error correction content includes at least one of the first content or the second content, the first content being obtained by replacing original words in the first text with the same meaning, and the second content being obtained by modifying the original semantics of the first text;
[0013] The second acquisition module is configured to acquire an error correction result of the first text based on the third text.
[0014] In one possible implementation, the non-essential error correction content includes a first content and a second content, and the correction module is used to correct the first content based on the first text and the second text to obtain a first correction result, and obtain a preliminarily corrected second text based on the first correction result; based on the first text and the preliminarily corrected second text, correct the second content in the preliminarily corrected second text to obtain a second correction result, and obtain the third text based on the second correction result.
[0015] In one possible implementation, the correction module is used to correct the first content based on the first text, the second text and the first prompt information through a natural language processing model to obtain the first correction result; the first prompt information is used to prompt the natural language processing model to correct the first content through natural language.
[0016] In one possible implementation, the correction module is used to correct the first content based on the first text and the second text through a first correction model to obtain the first correction result, and the number of model parameters of the first correction model is less than the number of model parameters of the natural language processing model; wherein, the first correction model is trained based on a first sample text pair and a first label, the first sample text pair includes a first sample text and a second sample text, the first label is a text obtained by performing a standardized correction on the third content in the second sample text, and the third content is obtained by replacing words in the first sample text with the same meaning.
[0017] In one possible implementation, the correction module is used to correct the second content in the preliminarily corrected second text based on the first text, the preliminarily corrected second text and the second prompt information through a natural language processing model to obtain the second correction result; the second prompt information is used to prompt the natural language processing model through natural language to correct the second content in the preliminarily corrected second text.
[0018] In one possible implementation, the second content includes entity replacement content and other semantic modification content except the entity replacement content, and the entity replacement content is obtained by replacing the entity in the first text; the correction module is used to correct the entity replacement content in the preliminarily corrected second text based on the first text, the preliminarily corrected second text and the third prompt information through a natural language processing model to obtain a third correction result, and obtain a re-corrected second text based on the third correction result; the third prompt information is used to prompt the natural language processing model to correct the entity replacement content in the preliminarily corrected second text through natural language; the natural language processing model is used to correct the other semantic modification content in the re-corrected second text except the entity replacement content based on the first text, the re-corrected second text and the fourth prompt information to obtain the second correction result; the fourth prompt information is used to prompt the natural language processing model to correct the other semantic modification content in the re-corrected second text except the entity replacement content through natural language.
[0019] In one possible implementation, the correction module is used to correct the second content in the preliminarily corrected second text based on the first text and the preliminarily corrected second text through a second correction model to obtain the second correction result; the number of model parameters of the second correction model is less than the number of model parameters of the natural language processing model; wherein, the second correction model is trained based on a second sample text pair and a second label, the second sample text pair includes a third sample text and a fourth sample text, the second label is a text obtained after standardized correction of the fourth content in the fourth sample text, and the fourth content is obtained by modifying the semantics of the third sample text.
[0020] In one possible implementation, the apparatus further includes:
[0021] The training module is used to train an initial error correction model based on the first text and the error correction result of the first text to obtain a target error correction model, and the target error correction model is used to correct the text to be corrected.
[0022] In one possible implementation, the second text is obtained by correcting the first text through a natural language processing model; the number of model parameters of the initial error correction model is less than the number of model parameters of the natural language processing model; or, the initial error correction model is the natural language processing model.
[0023] In one possible implementation, the error correction module is used to correct the first text based on the first text and initial prompt information through a natural language processing model to obtain the second text; wherein the initial prompt information is used to prompt the natural language processing model to correct the first text through natural language; the initial prompt information includes at least one of the first constraint information, the second constraint information or the third constraint information; the first constraint information is used to constrain the error correction type, the second constraint information is used to constrain the error correction principle, and the third constraint information is used to constrain the expression method of the text obtained after error correction.
[0024] In a possible implementation, the second acquisition module is configured to manually correct the third text, and use the text obtained after the manual correction as the error correction result of the first text.
[0025] On the other hand, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor so that the computer device implements any of the above-mentioned text error correction methods.
[0026] On the other hand, a computer-readable storage medium is provided, in which at least one computer program is stored. The at least one computer program is loaded and executed by a processor to enable a computer to implement any of the above-mentioned text error correction methods.
[0027] On the other hand, a computer program or computer program product is also provided, wherein the computer program or computer program product comprises computer instructions, and the computer instructions are loaded and executed by a processor to enable a computer to implement any of the above-mentioned text error correction methods.
[0028] The technical solutions provided by the embodiments of the present application bring at least the following beneficial effects:
[0029] The technical solution provided in the embodiments of this application, after obtaining a second text obtained by correcting a first text, corrects any unnecessary correction content in the second text, and then obtains a correction result for the first text based on the corrected text. This approach can reduce unnecessary correction content in the correction result, increase the proportion of content that actually needs correction in the actual correction content, and thus improve the accuracy of the correction result, thereby improving the accuracy of the text correction. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0031] Figure 1 Schematic diagram of an implementation environment of a text error correction method provided in an embodiment of the present application;
[0032] Figure 2 This is a flowchart of a text error correction method provided by an embodiment of the present application;
[0033] Figure 3 This is a schematic diagram of initial input information provided by an embodiment of the present application;
[0034] Figure 4 is a schematic diagram of first input information provided in an embodiment of the present application;
[0035] Figure 5 is a schematic diagram of second input information provided in an embodiment of the present application;
[0036] Figure 6 is a schematic diagram of a third input information provided in an embodiment of the present application;
[0037] Figure 7 is a schematic diagram of a fourth input information provided in an embodiment of the present application;
[0038] Figure 8 This is a flowchart of another text error correction method provided by an embodiment of the present application;
[0039] Figure 9 This is a schematic diagram of a text error correction process provided by an embodiment of the present application;
[0040] Figure 10 is a schematic diagram of a text error correction device provided in an embodiment of the present application;
[0041] Figure 11 This is a schematic diagram of the structure of a terminal provided in an embodiment of the present application;
[0042] Figure 12 This is a structural diagram of a server provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0044] Artificial Intelligence (AI) refers to the theories, methods, techniques, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, to perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that seeks to understand the essence of intelligence and produce new intelligent machines that can respond in a manner similar to human intelligence. AI also studies the design principles and implementation methods of various intelligent machines, enabling them to possess the capabilities of perception, reasoning, and decision-making.
[0045] Artificial intelligence (AI) technology is a comprehensive discipline encompassing a wide range of fields, encompassing both hardware and software technologies. Foundational AI technologies generally include sensors, specialized AI chips, cloud computing, distributed storage, big data processing, pre-trained models, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0046] Among them, the pre-training model (PTM), also known as the cornerstone model (or basic model) or large model, refers to a deep neural network (DNN) with a large number of parameters. It is trained on massive amounts of unlabeled data. The function approximation capability of the large-parameter DNN is used to enable the PTM to extract common features from the data. Through fine-tuning (Fine Tune), parameter-efficient fine tuning (Parameter-Efficient Fine Tuning, PEFT), prompt-tuning (a fine-tuning method), and other technologies, it can be widely applied to downstream tasks in various major directions of artificial intelligence. Therefore, the pre-training model can achieve ideal results in few-shot or zero-shot scenarios. Based on the data modality they process, PTMs can be categorized into language models (ELMO, BERT, GPT), vision models (swin-transformer, ViT, V-MOE), speech models (VALL-E), and multimodal models (ViBERT, CLIP, Flamingo, Gato). Multimodal models are those that represent features from two or more data modalities. Pretrained models are important tools for outputting AI-generated content (AIGC) and can also serve as a universal interface for connecting multiple task-specific models.
[0047] The application of pre-trained models involves model compression and quantization. Model compression and quantization refers to using compression and quantization techniques to reduce model size and accelerate model inference, thereby reducing the model's storage and computational costs. Model compression typically includes pruning, low-rank decomposition, and knowledge distillation. Model quantization converts floating-point parameters in the model to fixed-point or integer parameters, thereby reducing model size and accelerating model inference.
[0048] The solution provided in the embodiments of the present application relates to natural language processing (NLP) technology and machine learning (ML) technology in artificial intelligence.
[0049] Natural language processing is an important field in computer science and artificial intelligence. It studies various theories and methods that enable effective communication between humans and computers using natural language. Natural language processing involves natural language, the language people use in daily life, and is closely related to linguistics research; it also involves computer science and mathematics. Pre-training models, an important technology for model training in the field of artificial intelligence, are developed from large language models (LLMs) in the field of NLP. After fine-tuning, large language models can be widely used in downstream tasks. Natural language processing technologies generally include text processing (such as text error correction), semantic understanding, machine translation, robot question answering, knowledge graphs, and other technologies.
[0050] Text error correction involves detecting and correcting errors in text, including spelling errors, grammatical errors, punctuation errors, and vocabulary errors. The goal of text error correction is to make text more accurate, fluent, and easy to understand. This task has widespread application in many scenarios, such as text editing, machine translation, speech recognition, and search engines.
[0051] Large Language Models (LLMs), also known as Large Language Models (LLMs), are AI models designed to understand and generate human language. They are trained on large amounts of text data and can perform a wide range of tasks, including text summarization, text translation, sentiment analysis, and text error correction. LLMs are characterized by their massive scale, containing billions or even hundreds of billions of parameters, which enables them to learn complex patterns in language data.
[0052] Machine learning is a multidisciplinary field that encompasses probability theory, statistics, approximation theory, convex analysis, and algorithmic complexity theory. It specifically studies how computers simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is at the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications span all areas of artificial intelligence. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and learning through demonstration. Pretrained models are the latest development in deep learning, integrating these techniques.
[0053] Figure 1 A schematic diagram of an implementation environment of the text error correction method provided by an embodiment of the present application is shown. The implementation environment may include: a computer device 11.
[0054] The computer device 11 is capable of obtaining a first text to be corrected, and then obtaining a correction result for the first text based on the text correction method provided in an embodiment of the present application. Specifically, after obtaining the first text to be corrected, the computer device 11 first corrects the first text to obtain a corrected second text, then corrects unnecessary correction content in the second text to obtain a corrected third text, and then obtains the correction result for the first text based on the third text.
[0055] The computer device 11 can be a terminal or a server, which is not limited in the embodiments of the present application. For example, the terminal can be any electronic product that can interact with the user through one or more methods such as a keyboard, touchpad, touch screen, remote control, voice interaction or handwriting device, such as a PC (Personal Computer), a mobile phone, a smart phone, a PDA (Personal Digital Assistant), a wearable device, a PPC (Pocket PC), a tablet computer, a smart car machine, a smart TV, a smart speaker, a car terminal, etc. The server can be a single server, a server cluster consisting of multiple servers, or a cloud computing service center.
[0056] Those skilled in the art should understand that the above-mentioned computer device 11 is only an example, and other existing or future terminals or servers that are applicable to this application should also be included in the scope of protection of this application and are included here by reference.
[0057] The present invention provides a text error correction method, which can be applied to the above Figure 1 The implementation environment shown in FIG. Take the method applied to a computer device as an example. Figure 2As shown, the text error correction method provided in the embodiment of the present application may include the following steps 201 to 204.
[0058] In step 201, a first text to be corrected is obtained.
[0059] In the embodiment of the present application, the text to be corrected is referred to as the first text. The text to be corrected refers to the text to be checked for errors (such as grammatical errors, spelling errors, logical errors, punctuation errors, vocabulary errors, etc.) and to be corrected if errors exist.
[0060] Exemplarily, the method of obtaining the first text includes but is not limited to: using a text that needs to be corrected extracted from any text correction scenario as the first text, using any text extracted from a text database as the first text, using a text uploaded by a user as the first text, etc.
[0061] A text correction scenario refers to a scenario where text needs to be corrected. For example, text correction scenarios include but are not limited to text editing scenarios, machine translation scenarios, speech recognition scenarios, search engine scenarios, etc. In the text editing scenario, the text that needs to be corrected refers to the text edited by a computer device (referred to as edited text); in the machine translation scenario, the text that needs to be corrected refers to the text translated by a machine (referred to as translated text); in the speech recognition scenario, the text that needs to be corrected refers to the text obtained by speech recognition (referred to as speech recognition text); in the search engine scenario, the text that needs to be corrected can refer to the text entered by the user into the search engine (referred to as input text) or the text searched by the search engine (referred to as search text).
[0062] In step 202, error correction is performed on the first text to obtain a second text.
[0063] In the embodiment of the present application, the text obtained after error correction of the first text is referred to as the second text. Error correction of the first text means checking the first text for errors (such as grammatical errors, spelling errors, logical errors, punctuation errors, vocabulary usage errors, etc.), and correcting the errors in the first text if errors exist.
[0064] The method for correcting the first text can be flexibly selected according to the needs, and the embodiment of the present application does not limit this. In an exemplary embodiment, the first text can be corrected by any model with text correction capability.
[0065] For example, a model with text correction capabilities can be a model trained through supervised training based on training text and standard correction text corresponding to the training text. The standard correction text corresponding to the training text is the supervisory label during the supervised training process, and the standard correction text corresponding to the training text can refer to the text obtained by manually correcting the training text. In this case, when a first text is input into the model with text correction capabilities, the model with text correction capabilities will correct the first text and output a second text.
[0066] For example, a model capable of text error correction may also refer to a natural language processing model. A natural language processing model refers to a model used to process tasks related to natural language, where natural language refers to the language people use daily. For example, the natural language processing model may refer to a large language model (LLM) to improve the reliability of error correction on the first text.
[0067] In one possible implementation, when the model capable of text correction is a natural language processing model, the process of correcting the first text to obtain the second text may include: using the natural language processing model to correct the first text based on the first text and initial prompt information to obtain the second text. The initial prompt information is used to prompt the natural language processing model to correct the first text using natural language. In other words, the first text and the initial prompt information are input into the natural language processing model, so that the natural language processing model, prompted by the initial prompt information, corrects the first text and outputs the second text.
[0068] Natural language processing models can handle a variety of natural language-related tasks. Therefore, when using a natural language processing model to correct a first text, in addition to inputting the first text to be corrected, initial prompt information is also input. This initial prompt information reminds the natural language processing model that the current task to be processed is to correct the first text, thereby helping the natural language processing model better understand the input intent, thereby improving the reliability of the natural language processing model's correction of the first text. In addition, since there are currently many high-performance natural language processing models, using a natural language processing model to correct the first text can also avoid training a separate correction model, saving model training costs.
[0069] The content of the initial prompt information can be flexibly set according to needs, as long as it is information described in natural language that can prompt the natural language processing model to correct the first text. In an exemplary embodiment, the initial prompt information may include natural language that clearly prompts the natural language processing model to correct the first text, so as to provide a more intuitive prompt to the natural language processing model. In some embodiments, the initial prompt information includes at least one of the first constraint information, the second constraint information, or the third constraint information.
[0070] The first constraint information is used to constrain the error correction type, which is used to indicate which error types in the first text need to be corrected. The error correction type can be flexibly set according to needs, and the embodiment of the present application does not limit this. For example, the error correction type can include at least one of grammatical errors, spelling errors, logical errors, punctuation errors, and vocabulary usage errors. The second constraint information is used to constrain the error correction principle, which is used to indicate what principles need to be followed in the overall process of correcting the first text. The error correction principle can be flexibly set according to needs, and the embodiment of the present application does not limit this. For example, the error correction principle can include at least one of the minimum modification principle and the faithfulness to original meaning principle. Among them, faithfulness to original meaning means to keep the semantics of the first text unchanged as much as possible, and the semantics of the first text refers to the ideological content or meaning contained in the first text. The third constraint information is used to constrain the expression of the text obtained after error correction. The expression can be flexibly set according to needs, and the embodiment of the present application is not limited to this. For example, the expression can include at least one of more fluent and more authentic, where fluent can be understood as smooth and authentic can be understood as in line with the expression habits of people whose native language is the first text.
[0071] In some embodiments, the initial prompt information may further include initial formatting information, which is used to constrain the format of the result output by the natural language processing model after error correction of the first text. The initial formatting information can be flexibly set as needed, as long as the result output according to the initial formatting information includes the second text.
[0072] For example, the first text and the initial prompt information are used as the initial input information. For example, the initial prompt information includes the first constraint information, the second constraint information and the third constraint information. The initial input information can be as follows: Figure 3 As shown. Figure 3In the initial input information shown, the specific content of [input sentence] is the first text, and the other content except the specific content of [input sentence] is the initial prompt information. The initial prompt information includes natural language that clearly prompts the natural language processing model to correct the first text: "You are a text review expert, please correct the [input sentence] according to [requirements]", and also includes the specific content of [requirements] and the specific content of [format].
[0073] The first constraint in the initial prompt is "Fix all grammatical and spelling errors in [input sentence]" in the specific content of [Requirement]. The second constraint is "Follow the principle of faithfulness to the original meaning and minimal changes, and modify [input sentence] to conform to grammatical standards." The third constraint is "Modify [input sentence] to be more fluent and authentic, in line with native speaker usage." The initial format is also the specific content of [Format].
[0074] For example, the process of correcting the first text by the natural language processing model can be called the process of using the prompt technology to let the natural language processing model (such as LLM) correct the first text, and the second text obtained after the natural language processing model corrects the error can be called the crawling result of the natural language processing model. Figure 3 In the initial input information shown, the initial prompt information emphasizes the two principles of faithfulness to the original meaning, minimal changes, and greater fluency and authenticity. This enables the natural language processing model to modify the first text of the original input into a sentence that conforms to grammatical norms, and minimizes semantic changes and unnecessary modifications at this stage, thereby improving error correction performance.
[0075] In step 203, the non-essential error correction content in the second text is corrected to obtain a third text, where the non-essential error correction content includes at least one of the first content or the second content. The first content is obtained by replacing the original words in the first text with the same meaning, and the second content is obtained by modifying the original semantics of the first text.
[0076] In an embodiment of the present application, after correcting the first text to obtain the second text, the second text is not directly used as the correction result of the first text. Instead, the unnecessary correction content in the second text is corrected, and then the correction result of the first text is obtained based on the text obtained after correction. Based on this, it is possible to reduce unnecessary modified content in the correction result, increase the proportion of content that actually needs to be corrected in the actual correction content, that is, improve the accuracy of the correction result, and then improve the accuracy of text correction.
[0077] Non-essential error correction content refers to content in the error correction content of the second text that does not actually need to be corrected. The error correction content in the second text refers to the content in the second text obtained by correcting the first text. Which content is non-essential error correction content can be set based on experience or flexibly set according to the application scenario. This embodiment of the application does not limit this. Exemplarily, non-essential error correction content includes at least one of the first content or the second content.
[0078] The first content refers to the content in the second text obtained by replacing the original words in the first text with the same meaning. Exemplarily, the replacement with the same meaning may include but is not limited to synonym replacement and replacement with the same statement. For example, synonym replacement may refer to replacing "immediately" with "right away", and replacement with the same statement may refer to replacing "slowly changing" with "gradually changing". Since the meaning of the original words in the first content and the first text are the same, there is actually no need for error correction, so the first content can be used as a non-essential error correction content. In some embodiments, the first content can also be referred to as the same meaning replacement content.
[0079] The second content refers to the content in the second text obtained by modifying the original semantics of the first text. The original semantics of the first text refers to the ideological content or meaning contained in the first text. Since the original purpose of correcting the first text is to correct basic errors such as grammatical errors and spelling errors in the first text, and it is not desirable to change the original semantics of the first text, the second content does not actually need to be modified, and thus the second content can be regarded as non-essential modified content. In some embodiments, the second content can also be referred to as semantically modified content.
[0080] In some embodiments, the second content can be divided into entity replacement content and other semantic modification content except entity replacement content. Among them, entity replacement content is the content in the second text obtained by replacing the entity in the first text. Entity is an objectively existing and distinguishable thing. For example, an entity can refer to a person, such as a teacher, a student, etc., and an entity can also refer to an object, such as a book, a warehouse, etc. Under normal circumstances, if the entities in two texts are different, the semantics of the two texts will be different. Therefore, entity replacement content is regarded as a kind of content that changes the original semantics of the first text.
[0081] The non-essential error correction content includes at least one of the first content or the second content, that is, there are three cases of non-essential error correction content. Next, the implementation methods of step 203 are introduced respectively in combination with the three cases of non-essential error correction content. It should be noted that the correction of the non-essential error correction content in the second text in step 203 can be understood as proofreading whether there is non-essential error correction content in the second text, and when there is non-essential error correction content in the second text, correcting the non-essential modification content in the second text. That is to say, there may be non-essential modification content in the second text, or there may not be non-essential modification content. In some embodiments, correcting the first content in the second text can refer to restoring the first content in the second text to the original words in the first text; correcting the second content in the second text can refer to restoring the second content in the second text to the words corresponding to the original semantics of the first text. In some embodiments, if there is non-essential error correction content in the second text, it can be considered that the second text has an over-correction problem.
[0082] Case 1: The non-essential error correction content includes the first content and the second content.
[0083] In one possible implementation, in this case 1, the implementation of step 203 may include steps 2031 to 2034.
[0084] Step 2031: Based on the first text and the second text, correct the first content to obtain a first correction result.
[0085] The first text is used to provide data support for verifying whether the first content exists in the second text. In an exemplary embodiment, step 2031 can be performed using a model. That is, the model corrects the first content based on the first text and the second text to obtain a first correction result. The model can be a natural language processing model or a first correction model.
[0086] Among them, the number of model parameters of the first correction model is less than the number of model parameters of the natural language processing model. The first correction model has the ability to use one of the two input texts as a benchmark and correct the content in the other text obtained by replacing the words in the benchmark text with the same meaning.
[0087] In an exemplary embodiment, the first correction model is trained based on a first sample text pair and a first label. The first sample text pair includes a first sample text and a second sample text. The first label is a text obtained by performing a standardized correction on a third content in the second sample text. The third content is obtained by replacing words in the first sample text with the same meaning.
[0088] The first sample text may be any text, the second sample text may refer to a text including content (i.e., third content) obtained by replacing words in the first sample text with the same meaning, and the first label is obtained by performing standardization correction on the third content in the second sample text. Standardization correction may refer to correction by a text correction expert, that is, the first label is a text obtained by a text correction expert correcting the third content in the second sample text obtained by replacing words in the first sample text with the same meaning. The first label has high accuracy and can provide strong supervision for the training process of the first correction model.
[0089] In an exemplary embodiment, the process of obtaining the first correction model includes: inputting a first sample text pair into a first initial model, obtaining a first predicted correction result output by the first initial model, updating the model parameters of the first initial model based on the difference between the first predicted correction result and the first label, until a first training termination condition is satisfied, and using the model obtained when the first training termination condition is satisfied as the first correction model. The first training termination condition may mean that the number of updates to the model parameters of the first initial model reaches a first number threshold, or that the difference between the first predicted correction result and the first label is less than a first difference threshold, etc.
[0090] In one possible implementation, in the process of executing step 2031 using the natural language processing model, in addition to providing the first text and the second text, first prompt information is also required. That is, the implementation of step 2031 includes: using the natural language processing model to correct the first content based on the first text, the second text, and the first prompt information, to obtain a first correction result. The first prompt information is used to prompt the natural language processing model to correct the first content through natural language.
[0091] The natural language processing model can handle a variety of tasks related to natural language. Therefore, when using the natural language processing model to correct the first content in the second text, in addition to inputting the first text and the second text, a first prompt message is also input. The first prompt message is used to prompt the natural language processing model through natural language that the current task to be processed is the task of correcting the first content in the second text, thereby helping the natural language processing model better understand the intent of the input, thereby improving the reliability of the natural language processing model in correcting the first content in the second text. In addition, since there are currently many natural language processing models with good performance, correcting the first content in the second text through the natural language processing model can also avoid training a separate correction model, saving model training costs.
[0092] The content of the first prompt information can be flexibly set as needed, as long as it is information described in natural language that can prompt the natural language processing model to correct the first content in the second text. In an exemplary embodiment, the first prompt information may include natural language that explicitly prompts the natural language processing model to correct the first content in the second text, thereby providing a more intuitive prompt to the natural language processing model.
[0093] In some embodiments, the first prompt information may further include information for placing more detailed constraints on the natural language processing model's correction of the first content in the second text (e.g., constraining the types of identical substitutions to be corrected, constraining different processing flows for when the first content exists in the second text and when it does not exist, etc.). In some embodiments, the first prompt information may further include first format information, which is used to constrain the format of the result output by the natural language processing model after correcting the first content in the second text.
[0094] For example, the first text, the second text and the first prompt information are used as the first input information. The first input information can be as follows: Figure 4 As shown. Figure 4 In the first input information shown, the specific content of [Sentence 1] is the first text, the specific content of [Sentence 2] is the second text, and the other content except the specific content of [Sentence 1] and the specific content of [Sentence 2] is the first prompt information. The first prompt information includes natural language that clearly prompts the natural language processing model to correct the content of the second text that replaces the same meaning (that is, the first content): "Please analyze whether [Sentence 2] replaces [Sentence 1] with the same meaning, such as synonym replacement, same statement replacement, and give an explanation." The first prompt information also includes information that constrains different processing flows for the presence of the first content and the absence of the first content in the second text (that is, Figure 4 In addition, the first prompt information also includes the specific content of [Format], and the specific content of [Format] is the first format information.
[0095] For example, the process of correcting the first content in the second text by the natural language processing model can be called the process of using the prompt technology to let the natural language processing model (such as LLM) correct the replacement content with the same meaning. Figure 3In the first input information shown, by specifying in the first prompt that the natural language processing model should identify equivalent replacements in the second text (e.g., synonyms and equivalent expressions), and providing specific examples, this allows the natural language processing model to remove unnecessary corrections. Furthermore, constraints on expression can be added to the first prompt to ensure that the correction process maintains the smoothness and naturalness of the resulting revisions.
[0096] In one possible implementation, during the execution of step 2031 using the first correction model, only the first text and the second text need be provided. That is, the implementation of step 2031 includes: using the first correction model to correct the first content based on the first text and the second text, thereby obtaining a first correction result. After the first text and the second text are input into the first correction model, the first correction model corrects the first content in the second text based on the first text, and then outputs the first correction result. Because the number of model parameters of the first correction model is smaller than the number of model parameters of the natural language processing model, the computational complexity of correcting the first content in the second text using the first correction model is relatively small, which is beneficial for improving the efficiency of correcting the first content in the second text and saving computing resources.
[0097] Step 2032: Obtain a preliminarily corrected second text based on the first correction result.
[0098] The preliminarily corrected second text refers to a text obtained by correcting the first content in the second text.
[0099] In an exemplary embodiment, the first correction result includes a first text output result, and a method for obtaining a preliminarily corrected second text based on the first correction result may include: if the first text output result includes text, using the text in the first text output result as the preliminarily corrected second text; and if the first text output result is an empty string (i.e., does not include text), using the second text as the preliminarily corrected second text. The first text output result being an empty string occurs when the first content does not exist in the second text.
[0100] It should be noted that, in addition to the first text output result, the first correction result may also include other results, which is not limited in this application. For example, in addition to the first text output result, the first correction result may also include proofreading conclusions and explanatory information. The proofreading conclusion is used to indicate whether the first content exists in the second text, that is, to indicate whether there is replacement content with the same meaning in the second text. The explanatory information is used to indicate which first contents exist in the second text. The form of the explanatory information can be flexibly set according to demand. For example, the form of the explanatory information can be a form that clearly indicates which original words in the first text are replaced by which words with the same meaning in the second text.
[0101] Step 2033: Based on the first text and the preliminarily corrected second text, correct the second content in the preliminarily corrected second text to obtain a second correction result.
[0102] The first text is used to provide data support for proofreading whether there is a second content in the preliminarily corrected second text. In an exemplary embodiment, the above step 2033 can be performed by a model, that is, the second content in the preliminarily corrected second text is corrected by the model based on the first text and the preliminarily corrected second text to obtain a second correction result. It should be noted that, since the preliminarily corrected second text is a text obtained after only correcting the first content in the second text, the embodiment of the present application believes that the second content in the second text after the preliminarily correction is the same as the second content in the second text, and the correction of the second content in the second text is achieved by correcting the second content in the preliminarily corrected second text.
[0103] The model used in step 2033 can be a natural language processing model or a second correction model. The second correction model has fewer model parameters than the natural language processing model, and the second correction model is capable of using one of the two input texts as a reference and correcting the content of the other text by modifying the semantics of the reference text.
[0104] In an exemplary embodiment, the second correction model is trained based on a second sample text pair and a second label. The second sample text pair includes a third sample text and a fourth sample text. The second label is a text obtained by performing standardized correction on the fourth content in the fourth sample text. The fourth content is obtained by modifying the semantics of the third sample text.
[0105] The third sample text may be any text, the fourth sample text may refer to a text including content (i.e., fourth content) obtained by modifying the semantics of the third sample text, and the second label is obtained by performing standardization correction on the fourth content in the fourth sample text. Standardization correction may refer to correction by a text correction expert. In other words, the second label is the text obtained by a text correction expert correcting the fourth content in the fourth sample text obtained by modifying the semantics of the third sample text. The second label has high accuracy and can provide strong supervision for the training process of the second correction model.
[0106] In an exemplary embodiment, the process of obtaining the second correction model includes: inputting the second sample text pair into the second initial model, obtaining a second predicted correction result output by the second initial model, and updating the model parameters of the second initial model based on the difference between the second predicted correction result and the second label until a second training termination condition is satisfied, and using the model obtained when the second training termination condition is satisfied as the second correction model. The second training termination condition may be that the number of updates to the model parameters of the second initial model reaches a second number threshold, or that the difference between the second predicted correction result and the second label is less than a second difference threshold, etc.
[0107] In one possible implementation, the implementation of step 2033 using a natural language processing model may include but is not limited to the following methods 1 and 2:
[0108] Method 1: Correct the second content in the preliminarily corrected second text through a natural language processing model based on the first text, the preliminarily corrected second text and the second prompt information to obtain a second correction result; the second prompt information is used to prompt the natural language processing model through natural language to correct the second content in the preliminarily corrected second text.
[0109] The natural language processing model can handle a variety of tasks related to natural language. Therefore, when using the natural language processing model to correct the second content in the preliminarily corrected second text, in addition to inputting the first text and the preliminarily corrected second text, a second prompt message is also input to use the second prompt message to prompt the natural language processing model through natural language that the task currently to be processed is the task of correcting the second content in the preliminarily corrected second text, thereby helping the natural language processing model to better understand the intention of the input, thereby improving the reliability of the natural language processing model in correcting the second content in the preliminarily corrected second text. In addition, since there are currently many natural language processing models with good performance, correcting the second content in the preliminarily corrected second text through the natural language processing model can also avoid training a separate correction model, saving model training costs. Moreover, the correction of the second content can be achieved through a prompt message, which is conducive to improving the correction efficiency of the second content.
[0110] The content of the second prompt information can be flexibly set as needed, as long as it is information described in natural language that can prompt the natural language processing model to correct the second content in the preliminarily corrected second text. In an exemplary embodiment, the second prompt information may include natural language that explicitly prompts the natural language processing model to correct the second content in the preliminarily corrected second text, thereby providing a more intuitive prompt to the natural language processing model.
[0111] In some embodiments, the second prompt information may further include information for placing more detailed constraints on the natural language processing model's correction of the second content in the preliminarily corrected second text (e.g., constraining the type of semantic modification to be corrected, constraining different processing flows for when the second content exists in the preliminarily corrected second text and when the second content does not exist, etc.). In some instances, the second prompt information may further include second format information, which is used to constrain the format of the result output by the natural language processing model after correcting the second content in the preliminarily corrected second text.
[0112] For example, the first text, the preliminarily corrected second text and the second prompt information are used as the second input information. The second input information can be as follows: Figure 5 As shown. Figure 5In the second input information shown, the specific content of [Sentence 1] is the first text, the specific content of [Sentence 2] is the preliminarily corrected second text, and the other content besides the specific content of [Sentence 1] and the specific content of [Sentence 2] is the second prompt information. The second prompt information includes natural language that clearly prompts the natural language processing model to correct the replacement content with the same meaning (i.e., the first content) in the second text: "Please analyze whether [Sentence 2] has changed the meaning of [Sentence 1] and provide an explanation using natural language." The second prompt information also includes information that constrains the different processing flows for the presence and absence of the second content in the preliminarily corrected second text: "If there is a semantic modification, please remove the semantic modification in [Sentence 2], ensure that the sentence is error-free, and then provide an improved version. Otherwise, the improved version can directly output an empty string." In addition, the second prompt information also includes the specific content of [Format], which is the second format information.
[0113] Method 2: Correct the entity replacement content in the preliminarily corrected second text through a natural language processing model based on the first text, the preliminarily corrected second text and the third prompt information to obtain a third correction result, and obtain a re-corrected second text based on the third correction result; the third prompt information is used to prompt the natural language processing model through natural language to correct the entity replacement content in the preliminarily corrected second text; correct the other semantic modification content in the re-corrected second text except the entity replacement content through a natural language processing model based on the first text, the re-corrected second text and the fourth prompt information to obtain a second correction result; the fourth prompt information is used to prompt the natural language processing model through natural language to correct the other semantic modification content in the re-corrected second text except the entity replacement content.
[0114] This second method occurs when the second content is divided into entity replacement content and other semantically modified content other than the entity replacement content. By making two corrections, a more detailed correction is made to the second content in the preliminary correction of the second text, which is conducive to further improving the reliability of the correction of the second content in the preliminary correction of the second text.
[0115] In the above-mentioned method 2, the entity replacement content in the preliminarily corrected second text is first corrected by the natural language processing model under the prompt of the third prompt information to obtain a re-corrected second text, and then the other semantic modification content except the entity replacement content in the re-corrected second text is corrected by the natural language processing model under the prompt of the fourth prompt information.
[0116] The content of the third prompt information can be flexibly set according to the needs, as long as it is information described in natural language that can prompt the natural language processing model to correct the entity replacement content in the preliminarily corrected second text. In some embodiments, the third prompt information may include natural language that clearly prompts the natural language processing model to correct the entity replacement content in the preliminarily corrected second text, so as to provide a more intuitive prompt to the natural language processing model. In some embodiments, the third prompt information may also include information for more detailed constraints on the process of the natural language processing model correcting the entity replacement content in the preliminarily corrected second text (such as constraining different processing flows for the presence and absence of entity replacement content in the preliminarily corrected second text, etc.). In some embodiments, the third prompt information may also include third format information, which is used to constrain the format of the result output after the natural language processing model corrects the entity replacement content in the preliminarily corrected second text.
[0117] For example, the first text, the preliminarily corrected second text and the third prompt information are used as the third input information. The third input information can be as follows: Figure 6 As shown. Figure 6 In the third input information shown, the specific content of [Sentence 1] is the first text, the specific content of [Sentence 2] is the preliminarily corrected second text, and the remaining content, excluding the specific content of [Sentence 1] and [Sentence 2], is the third prompt information. The third prompt information includes natural language instructions that explicitly prompt the natural language processing model to correct the entity replacement content in the preliminarily corrected second text: "Please analyze whether [Sentence 2] changes the meaning of [Sentence 1], focusing on the perspective of entity replacement. First, extract all entities in [Sentence 1] and [Sentence 2], then determine whether [Sentence 2] replaces the entities in [Sentence 1] and provide an explanation using natural language." The third prompt information also includes information that constrains the different processing flows for the preliminarily corrected second text with and without entity replacement content: "If entity replacement content exists, please remove this entity replacement in [Sentence 2], ensure that the sentence is error-free, and then provide an improved version. Otherwise, simply output an empty string for the improved version." Furthermore, the third prompt information includes the specific content of [Format], which constitutes the third format information.
[0118] The content of the fourth prompt information can be flexibly set according to needs, as long as it is information described in natural language that can prompt the natural language processing model to correct other semantic modification contents in the re-corrected second text except the entity replacement content. In some embodiments, the fourth prompt information may include natural language that clearly prompts the natural language processing model to correct other semantic modification contents in the re-corrected second text except the entity replacement content, so as to provide a more intuitive prompt to the natural language processing model. In some embodiments, the fourth prompt information may also include information for more detailed constraints on the process of the natural language processing model correcting other semantic modification contents in the re-corrected second text except the entity replacement content (such as constraining different processing flows for the presence and absence of other semantic modification contents in the re-corrected second text, etc.). In some embodiments, the fourth prompt information may also include fourth format information, which is used to constrain the format of the result output after the natural language processing model corrects other semantic modification contents in the re-corrected second text.
[0119] For example, the first text, the second text corrected again, and the fourth prompt information are used as the fourth input information. The fourth input information can be as follows: Figure 7 As shown. Figure 7 In the fourth input information shown, the specific content of [Sentence 1] is the first text, the specific content of [Sentence 2] is the re-corrected second text, and the remaining content, excluding the specific content of [Sentence 1] and [Sentence 2], is the fourth prompt information. The fourth prompt information includes natural language instructions that explicitly prompt the natural language processing model to correct other semantic modifications in the re-corrected second text: "Please analyze whether [Sentence 2] changes the meaning of [Sentence 1], focusing on possible changes to the meaning of the sentence other than entity replacement, and provide an explanation in natural language." The fourth prompt information also includes information that constrains the different processing flows for the re-corrected second text with and without other semantic modifications: "If other semantic modifications exist, please remove the incorrect modification in [Sentence 2], ensure that the sentence is error-free, and then provide an improved version. Otherwise, simply output an empty string for the improved version." The fourth prompt information also includes the specific content of [Format], which is the fourth format information. The third text refers to the text after the first and second contents of the second text have been corrected.
[0120] In an exemplary embodiment, the third correction result includes a third text output result, and a method for obtaining the re-corrected second text based on the third correction result may include: if the third text output result includes text, using the text in the third text output result as the re-corrected second text; and if the third text output result is an empty string (i.e., does not include text), using the initially corrected second text as the re-corrected second text. The situation where the third text output result is an empty string occurs when there is no entity replacement content in the initially corrected second text.
[0121] It should be noted that, in addition to the third text output result, the third correction result may also include other results, which is not limited in this application. For example, in addition to the third text output result, the third correction result may also include the entity recognition result of the first text, the entity recognition result of the preliminarily corrected second text, the proofreading conclusion and explanatory information. Among them, the entity recognition result of the first text is used to list the entities identified from the first text, the entity recognition result of the preliminarily corrected second text is used to list the entities identified from the preliminarily corrected second text, and the proofreading conclusion is used to indicate whether there is entity replacement content in the preliminarily corrected second text. The explanatory information is used to explain which entity replacement content exists in the preliminarily corrected second text.
[0122] For example, the correction process of the second method described above can be referred to as a process of using the Prompt technology to allow a natural language processing model (e.g., LLM) to correct the semantically modified content (i.e., the second content) in the preliminarily corrected second text. In some embodiments, the process of correcting the semantically modified content (i.e., the second content) in the preliminarily corrected second text can also be referred to as a process of checking and correcting the original meaning. Figure 6 The third input information shown and Figure 7 In the fourth input information shown, emphasis is placed on proofreading of entity replacement content and checking of the entire sentence (that is, from the perspective of other semantic modification content). First, all entities of the original input first text are identified, and it is checked whether the preliminarily corrected second text has replaced the entities. Then, the natural language processing model is used to check the meaning of the entire sentence and further correct other semantic modification content.
[0123] In one possible implementation, during the execution of step 2033 using the second correction model, only the first text and the preliminarily corrected second text need be provided. That is, the implementation of step 2033 includes: using the second correction model to correct the second content in the preliminarily corrected second text based on the first text and the preliminarily corrected second text, thereby obtaining a second correction result. After the first text and the preliminarily corrected second text are input into the second correction model, the second correction model corrects the second content in the preliminarily corrected second text based on the first text, and then outputs a second correction result. Because the number of model parameters of the second correction model is smaller than the number of model parameters of the natural language processing model, the computational complexity of correcting the second content in the preliminarily corrected second text using the second correction model is relatively small, which is beneficial for improving the efficiency of correcting the second content in the preliminarily corrected second text and saving computing resources.
[0124] Step 2034: Obtain a third text based on the second correction result.
[0125] The third text refers to a text obtained by correcting the first content and the second content in the second text respectively.
[0126] In an exemplary embodiment, the second correction result includes a second text output result, and a method for obtaining the third text based on the second correction result may include: if the second text output result includes text, using the text in the second text output result as the third text; if the second text output result is an empty string (i.e., does not include text), using the preliminarily corrected second text as the third text. The second text output result being an empty string occurs when the preliminarily corrected second text does not contain the second content.
[0127] It should be noted that, in addition to the second text output result, the second correction result may also include other results, which is not limited in this application. For example, in addition to the second text output result, the second correction result may also include proofreading conclusions and explanatory information. The proofreading conclusion is used to indicate whether the second content exists in the second text of the preliminary correction or to indicate whether other semantically modified content exists in the second text of the re-correction. The explanatory information is used to indicate which second content exists in the second text of the preliminary correction or to indicate which other semantically modified content exists in the second text of the re-correction.
[0128] Through the above steps 2031 to 2034, the first content and the second content in the second text can be corrected, thereby reducing the same-meaning replacement content and semantic modification content in the correction results, ensuring the effective reduction of unnecessary correction content in the correction results, and effectively improving the accuracy of the correction results.
[0129] It should be noted that the above steps 2031 to 2034 are only a possible implementation of step 203 when the non-essential error correction content includes the first content and the second content, and the embodiment of the present application is not limited thereto.
[0130] In other embodiments, when the non-essential error correction content includes the first content and the second content, step 203 may also be implemented as follows: based on the first text and the second text, correcting the second content in the second text to obtain a fourth correction result, and obtaining a preliminary corrected second text based on the fourth correction result; based on the first text and the preliminary corrected second text, correcting the first content in the preliminary corrected second text to obtain a fifth correction result, and obtaining a third text based on the fifth correction result. The implementation principle of the above implementation method is the same as the implementation principle of steps 2031 to 2034, and will not be repeated here.
[0131] Case 2: The non-essential error correction content includes only the first content, that is, the non-essential error correction content includes the first content but does not include the second content.
[0132] In one possible implementation, in this scenario 2, step 203 includes correcting the first content based on the first text and the second text to obtain a first correction result, and obtaining a third text based on the first correction result. The process of correcting the first content based on the first text and the second text to obtain the first correction result is described in step 2031 and is not further described here.
[0133] In an exemplary embodiment, the first correction result includes a first text output result, and a method for obtaining the third text based on the first correction result may include: if the first text output result includes text, using the text in the first text output result as the third text; if the first text output result is an empty string (i.e., does not include text), using the second text as the third text. The first text output result being an empty string occurs when the first content does not exist in the second text.
[0134] Case 3: The non-essential error correction content includes only the second content, that is, the non-essential error correction content includes the second content but does not include the first content.
[0135] In one possible implementation, in this case 3, the implementation of step 203 includes: based on the first text and the second text, correcting the second content in the second text to obtain a sixth correction result, and acquiring the third text based on the sixth correction result.
[0136] The implementation principle of correcting the second content in the second text based on the first text and the second text is the same as the implementation principle of correcting the second content in the corrected second text based on the first text and the corrected second text (i.e., step 2033). It is only necessary to replace the preliminarily corrected second text in step 2033 with the second text, and replace the second correction result in step 2033 with the sixth correction result. No further details will be given here.
[0137] In an exemplary embodiment, the sixth correction result includes a fourth text output result, and a method for obtaining the third text based on the sixth correction result may include: if the fourth text output result includes text, using the text in the fourth text output result as the third text; and if the fourth text output result is an empty string (i.e., does not include text), using the second text as the third text. The fourth text output result being an empty string occurs when the second content does not exist in the second text.
[0138] In step 204, an error correction result of the first text is obtained based on the third text.
[0139] After obtaining the third text, the correction result of the first text is obtained based on the third text. Since the third text is a text obtained by correcting the unnecessary modified content in the second text, the correction result obtained in this way contains less unnecessary modified content, which is beneficial to increase the proportion of content that actually needs to be corrected in the actual correction content, that is, to improve the accuracy of the correction result, and thus improve the accuracy of text correction.
[0140] In a possible implementation, obtaining the error correction result of the first text based on the third text includes: using the third text as the error correction result of the first text.
[0141] In another possible implementation, if time and labor costs permit, obtaining the correction results for the first text based on the third text includes manually correcting the third text and using the text obtained after manual correction as the correction results for the first text. The third text obtained after correcting the unnecessary correction content in the second text may still contain some unnecessary modifications. Adding a manual correction step can further ensure the accuracy of the correction results.
[0142] The present application embodiment does not limit the operation after obtaining the error correction result of the first text. In some embodiments, after obtaining the error correction result of the first text, the error correction result of the first text can be displayed on the screen of the computer device so that the user can view the error correction result.
[0143] In some embodiments, after obtaining the error correction result of the first text, the initial error correction model can also be trained based on the first text and the error correction result of the first text to obtain a target error correction model, and the target error correction model is used to correct the text to be corrected. The training of the initial error correction model based on the first text and the error correction result of the first text is supervised training, and the error correction result of the first text is the supervisory label in the supervised training process. That is to say, the error correction result obtained by the text error correction method provided in the embodiment of the present application is used as a label for supervised training of the initial error correction model. The accuracy of the error correction result is relatively high. Using the error correction result as a label to train the initial error correction model is conducive to improving the model training effect, and then improving the text error correction accuracy of the target error correction model obtained by training.
[0144] Exemplarily, an initial error correction model is trained based on a first text and an error correction result of the first text to obtain a target error correction model. The process of training the target error correction model includes: inputting the first text into the initial error correction model, obtaining a predicted error correction result output by the initial error correction model, and updating the model parameters of the initial error correction model based on the difference between the error correction result of the first text and the predicted error correction result until a third training termination condition is met, and the model obtained when the training termination condition is met is used as the target error correction model. The third training termination condition can mean that the number of updates to the model parameters of the initial error correction model reaches a third threshold, or that the difference between the error correction result of the first text and the predicted error correction result is less than a third difference threshold, etc.
[0145] The initial error correction model can be any model, and the embodiments of the present application do not limit this. In some embodiments, the initial error correction model can be an untrained model that has no text error correction capability at all; in other embodiments, the initial error correction model can also be a pre-trained model with a certain text error correction capability. In this case, training the initial error correction model can be referred to as supervised fine-tuning (SFT) of the initial error correction model. In either case, training the initial error correction model using the first text and its corresponding error correction results can improve the text error correction accuracy of the initial error correction model.
[0146] In one possible implementation, when a second text is obtained by correcting a first text using a natural language processing model, the initial correction model can be a natural language processing model. In this case, using the corrected, more accurate correction results to supervise the natural language processing model itself can help encourage the natural language processing model to reduce the correction of unnecessary content during subsequent text corrections, thereby improving the natural language processing model's ability to improve text correction accuracy based on its original text correction capabilities.
[0147] In another possible implementation, when the second text is obtained by correcting the first text through a natural language processing model, the initial error correction model can also be a model with fewer model parameters than the natural language processing model. That is, relative to the natural language processing model, the initial error correction model is a small model. Based on this, since the error correction result is obtained based on the second text obtained after the first text is corrected by the natural language processing model, the error correction result is used as a supervisory label to perform supervised training on the initial error correction model with a smaller number of model parameters. The text error correction capability of the natural language processing model can be distilled to the initial error correction model with a smaller number of model parameters through knowledge distillation, so that the trained target error correction model has the error correction capability of the natural language processing model. Exemplarily, the error correction capability of the natural language processing model includes high recall rate, high fluency of the text obtained after error correction, high naturalness of the text obtained after error correction, etc. Among them, the recall rate refers to the proportion of content that is actually corrected in the content that really needs to be corrected.
[0148] In addition, since the non-essential error correction content in the second text is also corrected during the process of obtaining the error correction results, the error correction results are used as supervisory labels to conduct supervised training on the initial error correction model with a smaller number of model parameters. This can also ensure the error correction accuracy of the trained target error correction model, thereby ensuring that the target error correction model with a smaller number of model parameters has the error correction capabilities of a natural language processing model while also ensuring that the error correction accuracy is not reduced. Furthermore, since the target error correction model has fewer model parameters, the computational complexity of using the target error correction model for text error correction is smaller, and the efficiency of text error correction is higher, making the error correction capabilities of the target error correction model more easily applicable to actual business implementation.
[0149] The method provided in the embodiment of the present application can be considered as a text error correction method based on the distillation of a natural language processing model, the purpose of which is to distill the error correction recall capability of the natural language processing model to a small model, while retaining the advantages of high fluency and high naturalness. By designing a correction process for non-essential error correction content, it can be ensured that there will be no problems of over-correction and change of meaning, and the error correction results will be more fluent and natural. Ultimately, the error correction recall capability of the small model is improved, and its error correction accuracy is also guaranteed not to decrease, and the error correction results are more liked and accepted by people due to their high fluency and high naturalness.
[0150] The technical solution provided in the embodiments of this application, after obtaining a second text obtained by correcting a first text, corrects any unnecessary correction content in the second text, and then obtains a correction result for the first text based on the corrected text. This approach can reduce unnecessary correction content in the correction result, increase the proportion of content that actually needs correction in the actual correction content, and thus improve the accuracy of the correction result, thereby improving the accuracy of the text correction.
[0151] For example, Figure 8 As shown, in the case where the non-essential error correction content includes the first content and the second content, the text error correction method may include the following steps 801 to 810.
[0152] In step 801, a first text to be corrected is obtained.
[0153] In step 802, the first text is corrected based on the first text and the initial prompt information by a natural language processing model to obtain a second text.
[0154] The initial prompt information is used to prompt the natural language processing model to correct the first text through natural language.
[0155] In step 803, the first content in the second text is corrected based on the first text, the second text and the first prompt information through a natural language processing model to obtain a first correction result.
[0156] The first prompt information is used to prompt a natural language processing model to correct the first content through natural language.
[0157] In step 804 , a preliminarily corrected second text is obtained based on the first correction result.
[0158] In step 805, the entity replacement content in the preliminarily corrected second text is corrected by a natural language processing model based on the first text, the preliminarily corrected second text and the third prompt information to obtain a third correction result.
[0159] The third prompt information is used to prompt the natural language processing model to correct the entity replacement content in the preliminarily corrected second text through natural language.
[0160] In step 806 , a re-corrected second text is obtained based on the third correction result.
[0161] In step 807, the semantic modification content other than the entity replacement content in the re-corrected second text is corrected by a natural language processing model based on the first text, the re-corrected second text and the fourth prompt information to obtain a second correction result.
[0162] The fourth prompt information is used to prompt the natural language processing model through natural language to correct other semantically modified contents in the second text that is corrected again except for the entity replacement contents.
[0163] In step 808 , a third text is obtained based on the second correction result.
[0164] In step 809, manual correction is performed on the third text, and the text obtained after manual correction is used as the error correction result of the first text.
[0165] In step 810, an initial error correction model is trained based on the first text and the error correction result of the first text to obtain a target error correction model; the number of model parameters of the initial error correction model is less than the number of model parameters of the natural language processing model.
[0166] For example, the text correction process can be as follows Figure 9 As shown. Obtain a first text to be corrected, correct the first text through a natural language processing model (such as LLM) to obtain a second text; correct the same-meaning replacement content (that is, the first content) in the second text through the natural language processing model to obtain a preliminarily corrected second text. Among them, the process of correcting the same-meaning replacement content includes the process of correcting the synonym replacement content and the process of correcting the same-statement replacement content. After obtaining the preliminarily corrected second text, correct the semantically modified content (that is, the second content) in the preliminarily corrected second text through the natural language processing model to obtain a third text. Among them, the process of correcting the semantically modified content includes the process of correcting the entity replacement content and the process of correcting other semantically modified contents except the entity replacement through whole-sentence checking.
[0167] After obtaining the third text, the error correction result of the first text is obtained based on the third text, and the initial error correction model is supervised fine-tuned (SFT) based on the first text and the error correction result of the first text to obtain a target error correction model. The target error correction model is a model with a smaller number of model parameters (also called a small model) used to correct text errors.
[0168] For example, assuming that the first text to be corrected is "I think this bad culture is also changing slowly", the second text obtained after correction through the natural language processing model can be "I think this bad atmosphere is also gradually changing", and the third text obtained after correcting the content with the same meaning in the second text through the natural language processing model can be "I think this bad culture is also slowly changing".
[0169] For another example, assuming that the first text to be corrected is "His views have been recognized by many people", the second text obtained after correction through the natural language processing model can be "My views have been recognized by many people", and the text obtained after correcting the semantic modification content in the second text through the natural language processing model can be "His views have been recognized by many people".
[0170] The text error correction method provided in the embodiment of the present application can be applied in a variety of scenarios, such as text editing scenarios, machine translation scenarios, speech recognition scenarios, search engine scenarios, etc. Next, the text error correction method provided in the embodiment of the present application is introduced in conjunction with specific scenarios.
[0171] In a text editing scenario, the first text refers to the edited text (i.e., the text edited by a computer device), the second text refers to the edited text after error correction, and the third text refers to the edited text after correction. The text correction method in the text editing scenario includes: obtaining the edited text; correcting the edited text to obtain a corrected edited text; correcting unnecessary correction content in the corrected edited text to obtain a corrected edited text; and obtaining a correction result of the original edited text based on the corrected edited text.
[0172] In a machine translation scenario, the first text refers to the translated text (i.e., the text translated by the machine), the second text refers to the corrected translated text, and the third text refers to the corrected translated text. The text correction method in a machine translation scenario includes: obtaining the translated text; correcting the translated text to obtain a corrected translated text; correcting unnecessary correction content in the corrected translated text to obtain a corrected translated text; and obtaining a correction result for the original translated text based on the corrected translated text.
[0173] In a speech recognition scenario, the first text refers to the speech recognition text (i.e., the text obtained by recognizing speech), the second text refers to the speech recognition text after error correction, and the third text refers to the corrected speech recognition text. The text error correction method in a speech recognition scenario includes: obtaining the speech recognition text; correcting the speech recognition text to obtain a corrected speech recognition text; correcting unnecessary error correction content in the corrected speech recognition text to obtain a corrected speech recognition text; and obtaining the correction result of the original speech recognition text based on the corrected speech recognition text.
[0174] In the search engine scenario, the first text refers to the input text (that is, the text entered by the user into the search engine), the second text refers to the input text after error correction, and the third text refers to the corrected input text; or, the first text refers to the search text (that is, the text searched by the search engine), the second text refers to the search text after error correction, and the third text refers to the corrected search text.
[0175] In the case where the first text refers to the input text, the second text refers to the input text after error correction, and the third text refers to the corrected input text, the text correction method in the search engine scenario includes: obtaining the input text; correcting the input text to obtain the corrected input text; correcting unnecessary correction content in the corrected input text to obtain the corrected input text; and obtaining the correction result of the original input text based on the corrected input text.
[0176] In the case where the first text refers to the search text, the second text refers to the search text after error correction, and the third text refers to the corrected search text, the text correction method in the search engine scenario includes: obtaining the search text; correcting the search text to obtain the corrected search text; correcting unnecessary correction content in the corrected search text to obtain the corrected search text; and obtaining the correction result of the original search text based on the corrected search text.
[0177] See also Figure 10 , an embodiment of the present application provides a text error correction device, the device comprising:
[0178] A first acquisition module 1001 is used to acquire a first text to be corrected;
[0179] An error correction module 1002 is configured to correct errors in the first text to obtain a second text;
[0180] Correction module 1003, configured to correct non-essential error correction content in the second text to obtain a third text, wherein the non-essential error correction content includes at least one of the first content or the second content, the first content being obtained by replacing original words in the first text with the same meaning, and the second content being obtained by modifying the original semantics of the first text;
[0181] The second acquisition module 1004 is configured to acquire an error correction result of the first text based on the third text.
[0182] In one possible implementation, the non-essential error correction content includes a first content and a second content. The correction module 1003 is used to correct the first content based on the first text and the second text to obtain a first correction result, and obtain a preliminarily corrected second text based on the first correction result; based on the first text and the preliminarily corrected second text, correct the second content in the preliminarily corrected second text to obtain a second correction result, and obtain a third text based on the second correction result.
[0183] In one possible implementation, the correction module 1003 is used to correct the first content based on the first text, the second text and the first prompt information through a natural language processing model to obtain a first correction result; the first prompt information is used to prompt the natural language processing model to correct the first content through natural language.
[0184] In one possible implementation, the correction module 1003 is used to correct the first content based on the first text and the second text through a first correction model to obtain a first correction result, and the number of model parameters of the first correction model is less than the number of model parameters of the natural language processing model; wherein the first correction model is trained based on a first sample text pair and a first label, the first sample text pair includes a first sample text and a second sample text, the first label is a text obtained after standardized correction of the third content in the second sample text, and the third content is obtained by replacing words in the first sample text with the same meaning.
[0185] In one possible implementation, the correction module 1003 is used to correct the second content in the preliminarily corrected second text based on the first text, the preliminarily corrected second text and the second prompt information through a natural language processing model to obtain a second correction result; the second prompt information is used to prompt the natural language processing model through natural language to correct the second content in the preliminarily corrected second text.
[0186] In one possible implementation, the second content includes entity replacement content and other semantic modification content except the entity replacement content, and the entity replacement content is obtained by replacing the entity in the first text; the correction module 1003 is used to correct the entity replacement content in the preliminarily corrected second text based on the first text, the preliminarily corrected second text and the third prompt information through a natural language processing model to obtain a third correction result, and obtain a re-corrected second text based on the third correction result; the third prompt information is used to correct the entity replacement content in the preliminarily corrected second text through natural language prompting the natural language processing model; correct the other semantic modification content in the re-corrected second text except the entity replacement content through the natural language processing model based on the first text, the re-corrected second text and the fourth prompt information to obtain a second correction result; the fourth prompt information is used to correct the other semantic modification content in the re-corrected second text except the entity replacement content through natural language prompting the natural language processing model.
[0187] In one possible implementation, the correction module 1003 is used to correct the second content in the preliminarily corrected second text based on the first text and the preliminarily corrected second text through a second correction model to obtain a second correction result; the number of model parameters of the second correction model is less than the number of model parameters of the natural language processing model; wherein the second correction model is trained based on the second sample text pair and the second label, the second sample text pair includes the third sample text and the fourth sample text, the second label is the text obtained after the fourth content in the fourth sample text is standardized and corrected, and the fourth content is obtained by modifying the semantics of the third sample text.
[0188] In one possible implementation, the device further includes:
[0189] The training module is used to train the initial error correction model based on the first text and the error correction result of the first text to obtain a target error correction model, and the target error correction model is used to correct the text to be corrected.
[0190] In one possible implementation, the second text is obtained by correcting the first text using a natural language processing model; the number of model parameters of the initial error correction model is less than the number of model parameters of the natural language processing model; or, the initial error correction model is a natural language processing model.
[0191] In one possible implementation, the error correction module 1002 is used to correct the first text based on the first text and initial prompt information through a natural language processing model to obtain a second text; wherein the initial prompt information is used to correct the first text through a natural language prompt natural language processing model; the initial prompt information includes at least one of the first constraint information, the second constraint information or the third constraint information; the first constraint information is used to constrain the error correction type, the second constraint information is used to constrain the error correction principle, and the third constraint information is used to constrain the expression method of the text obtained after error correction.
[0192] In a possible implementation, the second acquisition module 1004 is configured to manually correct the third text, and use the text obtained after the manual correction as the error correction result of the first text.
[0193] In an embodiment of the present application, after obtaining a second text obtained by correcting the first text, the unnecessary correction content in the second text is corrected, and then the correction result of the first text is obtained based on the corrected text. This method can reduce the unnecessary correction content in the correction result, increase the proportion of content that actually needs correction in the actual correction content, and thus improve the accuracy of the correction result, thereby improving the accuracy of the text correction.
[0194] It should be noted that the apparatus provided in the above embodiments is merely illustrated by the division of the above functional modules when implementing its functions. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0195] Figure 11 This is a schematic diagram of the structure of a terminal provided in an embodiment of the present application. The terminal may be a PC, mobile phone, smartphone, PDA, wearable device, PPC, tablet computer, smart car computer, smart TV, smart speaker, or vehicle-mounted terminal. The terminal may also be referred to as user equipment, portable terminal, laptop terminal, desktop terminal, or other similar terminology.
[0196] Typically, the terminal includes: a processor 1101 and a memory 1102 .
[0197] The processor 1101 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 1101 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), or PLA (Programmable Logic Array). The processor 1101 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 1101 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1101 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0198] Memory 1102 may include one or more computer-readable storage media, which may be non-transitory. Memory 1102 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in memory 1102 is used to store at least one instruction, which is executed by processor 1101 to enable the terminal to implement the text error correction method provided in the method embodiment of the present application.
[0199] In some embodiments, the terminal may optionally include a peripheral device interface 1103 and at least one peripheral device. The processor 1101, memory 1102, and peripheral device interface 1103 may be connected via a bus or signal lines. Each peripheral device may be connected to the peripheral device interface 1103 via a bus, signal lines, or circuit boards. Specifically, the peripheral device may include at least one of a radio frequency circuit 1104, a display screen 1105, a camera assembly 1106, an audio circuit 1107, and a power supply 1108.
[0200] The peripheral device interface 1103 can be used to connect at least one I / O (Input / Output)-related peripheral device to the processor 1101 and the memory 1102. In some embodiments, the processor 1101, the memory 1102, and the peripheral device interface 1103 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 1101, the memory 1102, and the peripheral device interface 1103 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.
[0201] The RF circuit 1104 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 1104 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 1104 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the RF circuit 1104 includes an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and the like. The RF circuit 1104 can communicate with other terminals via at least one wireless communication protocol. Such wireless communication protocols include, but are not limited to, metropolitan area networks, various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and / or WiFi (Wireless Fidelity) networks. In some embodiments, the RF circuit 1104 may also include circuits related to NFC (Near Field Communication), which is not limited in this application.
[0202] Display screen 1105 is used to display a user interface (UI). This UI may include graphics, text, icons, videos, or any combination thereof. When display screen 1105 is a touchscreen display, it is also capable of collecting touch signals on or above the surface of display screen 1105. These touch signals can be input as control signals to processor 1101 for processing. Display screen 1105 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there can be a single display screen 1105, located on the front panel of the terminal. In other embodiments, there can be at least two display screens 1105, located on different surfaces of the terminal or in a foldable design. In still other embodiments, display screen 1105 can be a flexible display, located on a curved or foldable surface of the terminal. Display screen 1105 can also be configured as a non-rectangular, irregular shape, also known as a special-shaped screen. Display screen 1105 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).
[0203] The camera assembly 1106 is used to capture images or videos. Optionally, the camera assembly 1106 includes a front camera and a rear camera. Typically, the front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 1106 may also include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.
[0204] The audio circuit 1107 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals and input them into the processor 1101 for processing, or input them into the RF circuit 1104 to achieve voice communication. For the purpose of stereo sound collection or noise reduction, there can be multiple microphones, which are respectively set at different parts of the terminal. The microphone can also be an array microphone or an omnidirectional collection microphone. The speaker is used to convert the electrical signals from the processor 1101 or the RF circuit 1104 into sound waves. The speaker can be a traditional thin film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signals into sound waves audible to humans, but also convert the electrical signals into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 1107 may also include a headphone jack.
[0205] Power supply 1108 is used to power various components in the terminal. Power supply 1108 can be AC power, DC power, disposable batteries, or rechargeable batteries. When power supply 1108 includes a rechargeable battery, the rechargeable battery can support wired charging or wireless charging. The rechargeable battery can also be used to support fast charging technology.
[0206] In some embodiments, the terminal further includes one or more sensors 1109 , including but not limited to: an acceleration sensor 1110 , a gyroscope sensor 1111 , a pressure sensor 1112 , an optical sensor 1113 , and a proximity sensor 1114 .
[0207] The accelerometer 1110 can detect the magnitude of acceleration along the three coordinate axes of the coordinate system established by the terminal. For example, the accelerometer 1110 can be used to detect the components of gravity acceleration along the three coordinate axes. The processor 1101 can control the display screen 1105 to display the user interface in either a landscape or portrait view based on the gravity acceleration signal collected by the accelerometer 1110. The accelerometer 1110 can also be used to collect game or user motion data.
[0208] The gyroscope sensor 1111 can detect the terminal's body orientation and rotation angle. It can also work with the accelerometer 1110 to collect the user's 3D movements on the terminal. Based on the data collected by the gyroscope sensor 1111, the processor 1101 can implement the following functions: motion sensing (such as changing the UI based on the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.
[0209] The pressure sensor 1112 can be set in the side frame of the terminal and / or the lower layer of the display screen 1105. When the pressure sensor 1112 is set in the side frame of the terminal, it can detect the user's grip signal of the terminal, and the processor 1101 performs left and right hand recognition or shortcut operations based on the grip signal collected by the pressure sensor 1112. When the pressure sensor 1112 is set in the lower layer of the display screen 1105, the processor 1101 controls the operable controls on the UI interface based on the user's pressure operation on the display screen 1105. Operable controls include at least one of button controls, scroll bar controls, icon controls, and menu controls.
[0210] Optical sensor 1113 is used to detect ambient light intensity. In one embodiment, processor 1101 can control the display brightness of display screen 1105 based on the ambient light intensity detected by optical sensor 1113. Specifically, when the ambient light intensity is high, the display brightness of display screen 1105 is increased; when the ambient light intensity is low, the display brightness of display screen 1105 is decreased. In another embodiment, processor 1101 can also dynamically adjust the shooting parameters of camera assembly 1106 based on the ambient light intensity detected by optical sensor 1113.
[0211] Proximity sensor 1114, also known as a distance sensor, is typically located on the front panel of the terminal. Proximity sensor 1114 is used to measure the distance between the user and the front of the terminal. In one embodiment, when proximity sensor 1114 detects that the distance between the user and the front of the terminal is gradually decreasing, processor 1101 controls display screen 1105 to switch from the screen-on state to the screen-off state. When proximity sensor 1114 detects that the distance between the user and the front of the terminal is gradually increasing, processor 1101 controls display screen 1105 to switch from the screen-off state to the screen-on state.
[0212] Those skilled in the art will understand that Figure 11 The structure shown in the figure does not constitute a limitation on the terminal, and may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component arrangement.
[0213] Figure 12This is a structural diagram of a server provided in an embodiment of the present application. The server may have relatively large differences due to different configurations or performances, and may include one or more processors (Central Processing Units, CPU) 1201 and one or more memories 1202, wherein the one or more memories 1202 store at least one computer program, and the at least one computer program is loaded and executed by the one or more processors 1201, so that the server implements the text error correction method provided in the above-mentioned various method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The server may also include other components for implementing device functions, which will not be described in detail here.
[0214] In an exemplary embodiment, a computer device is further provided, comprising a processor and a memory, wherein the memory stores at least one computer program. The at least one computer program is loaded and executed by one or more processors to enable the computer device to implement any of the above-mentioned text error correction methods.
[0215] In an exemplary embodiment, a computer-readable storage medium is further provided, in which at least one computer program is stored. The at least one computer program is loaded and executed by a processor of a computer device to enable the computer to implement any of the above-mentioned text error correction methods.
[0216] In one possible implementation, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, and the like.
[0217] In an exemplary embodiment, a computer program or a computer program product is further provided. The computer program or the computer program product includes computer instructions. The computer instructions are loaded and executed by a processor to enable a computer to implement any of the above-mentioned text error correction methods.
[0218] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.), and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the first text to be corrected in this application was obtained with full authorization.
[0219] It should be noted that the terms "first," "second," and the like in this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential sequence. It should be understood that the data used in this manner are interchangeable where appropriate so that the embodiments of the application described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the above exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application.
[0220] It should be understood that the term "plurality" used herein refers to two or more. "And / or" describes a relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can mean: A exists alone, A and B exist simultaneously, or B exists alone. The character " / " generally indicates an "or" relationship between the associated objects.
[0221] Those skilled in the art will understand that all or part of the steps to implement the above embodiments can be completed by hardware, or can be completed by instructing relevant hardware through a program. Optionally, the program is stored in a computer-readable storage medium. Optionally, the above-mentioned storage medium is a read-only memory, a disk or an optical disk, etc.
[0222] The above description is merely an exemplary embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A text error correction method, characterized in that: The method comprises: Obtaining a first text to be corrected; Correcting the first text to obtain a second text; Correcting non-essential error-correction content in the second text to obtain a third text, wherein the non-essential error-correction content includes at least one of the first content or the second content, the first content being obtained by replacing original words in the first text with the same meaning, and the second content being obtained by modifying the original semantics of the first text; An error correction result of the first text is obtained based on the third text.
2. The method according to claim 1, characterized in that The non-essential error correction content includes a first content and a second content, and correcting the non-essential error correction content in the second text to obtain a third text includes: Correcting the first content based on the first text and the second text to obtain a first correction result, and acquiring a preliminarily corrected second text based on the first correction result; Based on the first text and the preliminarily corrected second text, the second content in the preliminarily corrected second text is corrected to obtain a second correction result, and the third text is acquired based on the second correction result.
3. The method according to claim 2, characterized in that Correcting the first content based on the first text and the second text to obtain a first correction result includes: The first content is corrected based on the first text, the second text and the first prompt information through a natural language processing model to obtain the first correction result; the first prompt information is used to prompt the natural language processing model to correct the first content through natural language.
4. The method according to claim 2, characterized in that Correcting the first content based on the first text and the second text to obtain a first correction result includes: Correcting the first content based on the first text and the second text using a first correction model to obtain a first correction result, wherein the number of model parameters of the first correction model is less than the number of model parameters of the natural language processing model; Among them, the first correction model is trained based on a first sample text pair and a first label, the first sample text pair includes a first sample text and a second sample text, the first label is a text obtained by standardizing and correcting the third content in the second sample text, and the third content is obtained by replacing words in the first sample text with the same meaning.
5. The method according to claim 2, characterized in that Correcting the second content in the preliminarily corrected second text based on the first text and the preliminarily corrected second text to obtain a second correction result includes: Based on the first text, the preliminarily corrected second text and the second prompt information, the second content in the preliminarily corrected second text is corrected by a natural language processing model to obtain the second correction result; the second prompt information is used to prompt the natural language processing model to correct the second content in the preliminarily corrected second text through natural language.
6. The method according to claim 2, characterized in that The second content includes entity replacement content and other semantically modified content except the entity replacement content, and the entity replacement content is obtained by replacing the entity in the first text; Correcting the second content in the preliminarily corrected second text based on the first text and the preliminarily corrected second text to obtain a second correction result includes: Correcting the entity replacement content in the preliminarily corrected second text using a natural language processing model based on the first text, the preliminarily corrected second text, and third prompt information to obtain a third correction result, and obtaining a re-corrected second text based on the third correction result; the third prompt information is used to prompt the natural language processing model to correct the entity replacement content in the preliminarily corrected second text using natural language; The natural language processing model is used to correct the other semantic modification content in the re-corrected second text except the entity replacement content based on the first text, the re-corrected second text and the fourth prompt information to obtain the second correction result; the fourth prompt information is used to prompt the natural language processing model through natural language to correct the other semantic modification content in the re-corrected second text except the entity replacement content.
7. The method according to claim 2, characterized in that Correcting the second content in the preliminarily corrected second text based on the first text and the preliminarily corrected second text to obtain a second correction result includes: Correcting the second content in the preliminarily corrected second text using a second correction model based on the first text and the preliminarily corrected second text to obtain a second correction result; the number of model parameters of the second correction model is less than the number of model parameters of the natural language processing model; Among them, the second correction model is trained based on the second sample text pair and the second label, the second sample text pair includes the third sample text and the fourth sample text, the second label is the text obtained after the fourth content in the fourth sample text is standardized and corrected, and the fourth content is obtained by modifying the semantics of the third sample text.
8. The method according to any one of claims 1 to 7, characterized in that: After obtaining the error correction result of the first text based on the third text, the method further includes: An initial error correction model is trained based on the first text and the error correction result of the first text to obtain a target error correction model, and the target error correction model is used to correct the text to be corrected.
9. The method according to claim 8, characterized in that The second text is obtained by correcting the first text through a natural language processing model; The number of model parameters of the initial error correction model is less than the number of model parameters of the natural language processing model; or, the initial error correction model is the natural language processing model.
10. The method according to any one of claims 1 to 7, characterized in that: Correcting the first text to obtain a second text includes: Correcting the first text based on the first text and initial prompt information using a natural language processing model to obtain the second text; Among them, the initial prompt information is used to prompt the natural language processing model to correct the first text through natural language; the initial prompt information includes at least one of the first constraint information, the second constraint information or the third constraint information; the first constraint information is used to constrain the correction type, the second constraint information is used to constrain the correction principle, and the third constraint information is used to constrain the expression of the text obtained after correction.
11. The method according to any one of claims 1 to 7, characterized in that: The obtaining the error correction result of the first text based on the third text includes: Manual correction is performed on the third text, and the text obtained after the manual correction is used as the error correction result of the first text.
12. A text error correction device, characterized in that: The device comprises: A first acquisition module, configured to acquire a first text to be corrected; an error correction module, configured to correct errors in the first text to obtain a second text; a correction module, configured to correct non-essential error correction content in the second text to obtain a third text, wherein the non-essential error correction content includes at least one of the first content or the second content, the first content being obtained by replacing original words in the first text with the same meaning, and the second content being obtained by modifying the original semantics of the first text; The second acquisition module is configured to acquire an error correction result of the first text based on the third text.
13. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor so that the computer device implements the text error correction method according to any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that The computer-readable storage medium stores at least one computer program, and the at least one computer program is loaded and executed by a processor to enable a computer to implement the text error correction method according to any one of claims 1 to 11.
15. A computer program product, characterized in that The computer program product includes computer instructions, which are loaded and executed by a processor to enable a computer to implement the text error correction method according to any one of claims 1 to 11.