A method, apparatus, computer device, and storage medium for correcting text

By combining the correction model with unsupervised and supervised models, the Chinese text is corrected, which solves the problem of low accuracy during the correction process, ensuring the accuracy and context of the output text.

CN113761189BActive Publication Date: 2025-07-18TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110426412.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-20
Publication Date
2025-07-18
Estimated Expiration
2041-04-20

AI Technical Summary

Technical Problem

In the process of correcting texts, especially for Chinese texts, the prior art has low accuracy and is prone to delete or correcting wrong words into similar words, changing the original meaning or context.

Method used

The trained correction model is adopted to match the input text sequence and the preset candidate subtext collection, combined with unsupervised and supervised models, the candidate subtext is measured from the perspectives of the whole and individual input subtexts, and the output subtext is determined to avoid deletion or synonym correction.

Benefits of technology

Improve the accuracy of the correct text, ensuring that the output text retains its original meaning and context, and does not change the original meaning of the statement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113761189B_ABST
    Figure CN113761189B_ABST
Patent Text Reader

Abstract

The present application provides a method, apparatus, computer device, and storage medium for correcting text, which can be applied to the field of cloud computing or the field of artificial intelligence to solve the problem of low accuracy in correcting text. The method at least includes: using a trained correction model to respectively match the input text sequence with each candidate sub-text in a preset candidate sub-text set based on the input sub-texts at each input text position included in the input text sequence, to obtain a first matching result for each output text position; respectively matching the input text sequence with each candidate sub-text based on the input sub-text at a specified input text position among the input text positions, to obtain a second matching result for each output text position; and determining the output sub-texts at each output text position based on the obtained first matching results and second matching results, to obtain a corrected output text sequence.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular, to a method, apparatus, computer device, and storage medium for correcting text. Background Art

[0002] With the continuous development of technology, more and more devices can perform intelligent tasks. For example, a device can correct incorrect text in a sentence to correct text.

[0003] In the process of correcting text, due to reasons such as lack of prior knowledge, it is easy to delete incorrect text in a sentence, or correct the incorrect text in the sentence to other text similar to the correct text. However, for a language like Chinese with very rich text meanings, even similar texts cannot accurately express the original meaning of the sentence. It can be seen that the accuracy of the text correction process is relatively low. Summary of the Invention

[0004] Embodiments of this application provide a method, apparatus, computer device, and storage medium for correcting text, which are used to solve the problem of relatively low accuracy in text correction.

[0005] In a first aspect, a method for correcting text is provided, including:

[0006] Obtain an input text sequence to be corrected;

[0007] Using a trained correction model, based on the input sub-texts at each input text position included in the input text sequence, for each output text position, respectively match the input text sequence with each candidate sub-text in a preset candidate sub-text set, and obtain a first matching result for each output text position, where each output text position corresponds one-to-one to each input text position included in the input text sequence;

[0008] Based on the input sub-text at a specified input text position among each input text position, for each output text position, respectively match the input text sequence with each candidate sub-text, and obtain a second matching result for each output text position, where the specified input text position is an input text position specified for each output text position among each input text position;

[0009] Based on the obtained first matching results and second matching results, determine the output sub-texts at each output text position, and obtain the corrected output text sequence corresponding to the input text sequence.

[0010] In a second aspect, a device for correcting text is provided, including:

[0011] Acquisition module: used to obtain the input text sequence to be corrected;

[0012] Processing module: used to adopt a trained correction model, and based on the input sub-texts at each input text position included in the input text sequence, for each output text position, respectively match the input text sequence with each candidate sub-text in a preset candidate sub-text set, to obtain a first matching result for each output text position, wherein each of the output text positions corresponds one-to-one to each input text position included in the input text sequence;

[0013] The processing module is further used for: based on the input sub-text at a specified input text position among the input text positions, for each output text position, respectively match the input text sequence with each of the candidate sub-texts, to obtain a second matching result for each output text position, wherein the specified input text position is an input text position respectively specified for each output text position among the input text positions;

[0014] The processing module is further used for: based on the obtained first matching results and second matching results, determine the output sub-texts at each output text position, to obtain the corrected output text sequence corresponding to the input text sequence.

[0015] Optionally, the acquisition module is specifically used for:

[0016] Obtain the input text to be corrected, and extract each input sub-text included in the input text;

[0017] Arrange each of the input sub-texts in the connection order of the input sub-texts in the input text, to obtain the input text sequence, wherein the input text sequence includes multiple input text positions, and each input text position corresponds to an input sub-text.

[0018] Optionally, the trained correction model includes a trained unsupervised correction sub-model and a trained supervised correction sub-model; then the first matching result is obtained by using the trained unsupervised correction sub-model, and the second matching result is obtained by using the trained supervised correction sub-model.

[0019] Optionally, the processing module is specifically used for:

[0020] For each output text position, respectively perform the following operations:

[0021] Using the trained unsupervised correction sub-model, for an output text position among each output text position, based on the sub-text features of each input sub-text, obtain a first sequence feature vector of the input text sequence;

[0022] Match the first sequence feature vector of the input text sequence with the candidate feature vectors of each pre-stored candidate sub-text, and for the output text position, obtain a first matching probability between the input text sequence and each candidate sub-text;

[0023] Use the obtained first matching probabilities as the first matching results for the output text position;

[0024] The processing module is specifically configured to:

[0025] For each output text position, respectively perform the following steps:

[0026] Using the trained supervised correction sub-model, for an output text position among each output text position, based on the sub-text features of the input sub-text at the specified input text position, obtain a second sequence feature vector of the input text sequence;

[0027] Match the second sequence feature vector of the input text sequence with the candidate feature vectors of each pre-stored candidate sub-text, and for the output text position, obtain a second matching probability between the input text sequence and each candidate sub-text;

[0028] Use the obtained second matching probabilities as the second matching results for the output text position.

[0029] Optionally, the trained supervised correction sub-model includes a trained encoding sub-model and a trained decoding sub-model, and the processing module is specifically configured to:

[0030] Using the trained encoding sub-model, based on the sub-text features of the input sub-text at the specified input text position, obtain an encoded sequence feature vector of the input text sequence;

[0031] Using the trained decoding sub-model, based on the sub-text features of the input sub-text at a preset input text position among each input text position, obtain a decoded sequence feature vector of the input text sequence, where the preset input text position is at least one input text position preset among each input text position for the output text position;

[0032] Based on the obtained encoded sequence feature vector and decoded sequence feature vector, determine the second sequence feature vector;

[0033] The processing module is specifically configured to:

[0034] Adopt the trained decoding sub-model to perform decoding processing on the second sequence feature vector to obtain the second matching probability.

[0035] Optionally, in the trained encoding sub-model and the trained decoding sub-model, the values of the model parameters with the same name are shared.

[0036] Optionally, the processing module is specifically configured to:

[0037] Perform a linear operation on the obtained encoded sequence feature vector and decoded sequence feature vector based on the third model parameter of the trained correction model to obtain the encoding weight parameter of the encoded sequence feature vector;

[0038] Determine the decoding weight parameter of the decoded sequence feature vector based on the obtained encoding weight parameter and a preset weight relationship;

[0039] Perform a weighted summation process on the encoded sequence feature vector and the decoded sequence feature vector based on the obtained encoding weight parameter and decoding weight parameter to obtain the second sequence feature vector.

[0040] Optionally, the third model parameter includes the connection weight of the encoded sequence feature vector, the connection weight of the decoded sequence feature vector, and the bias vector.

[0041] Optionally, the processing module is specifically configured to:

[0042] For each output text position, respectively perform the following steps:

[0043] Based on the first model parameter and the second model parameter of the trained correction model, perform a fusion process on the first matching result and the second matching result for an output text position among the output text positions to obtain a fused matching result for the output text position, where the fused matching result includes the fused matching probability between the input text sequence and each candidate sub-text;

[0044] Based on the fused matching result, screen out the candidate sub-texts whose fused matching probabilities meet a preset screening condition from the pre-stored candidate sub-text set as the output sub-text at the output text position.

[0045] Optionally, the processing module is further configured to:

[0046] The to-be-trained correction model is iteratively trained for multiple rounds based on labeled training samples until the training loss value meets the preset convergence condition, and a trained correction model is obtained. During one round of iterative training, the following operations are performed:

[0047] Input the sample input text sequence in the labeled training samples into the to-be-trained correction model to obtain the supervised training result output by the to-be-trained correction model;

[0048] Based on the first comparison result between the supervised training result and the sample label in the labeled training samples, determine the training loss value of the to-be-trained correction model;

[0049] Based on the obtained training loss value, adjust the model parameters of the to-be-trained correction model.

[0050] Optionally, the to-be-trained correction model includes a to-be-trained unsupervised correction sub-model; the processing module is further configured to:

[0051] Before inputting the sample input text sequence in the labeled training samples into the to-be-trained correction model to obtain the supervised training result output by the to-be-trained correction model, input the unlabeled training samples into the to-be-trained unsupervised correction sub-model to obtain the unsupervised training result output by the to-be-trained unsupervised correction sub-model;

[0052] Based on the obtained unsupervised training results, determine at least one clustering center;

[0053] Based on the second comparison result between the unsupervised training results and the at least one clustering center, adjust the model parameters of the to-be-trained unsupervised correction sub-model to obtain a trained unsupervised correction sub-model.

[0054] Optionally, the to-be-trained correction model includes a trained unsupervised correction sub-model and a to-be-trained supervised correction sub-model; the processing module is specifically configured to:

[0055] Input the sample input text sequence in the labeled training samples into the trained unsupervised correction sub-model to obtain the first training matching result output by the trained unsupervised correction sub-model;

[0056] Input the sample input text sequence in the labeled training samples into the to-be-trained supervised correction sub-model to obtain the second training matching result output by the to-be-trained supervised correction sub-model;

[0057] Based on the first model parameter and the second model parameter of the to-be-trained correction model, perform a fusion process on the first training matching result and the second training matching result to obtain the supervised training result output by the to-be-trained correction model.

[0058] In a third aspect, there is provided a computer device, comprising:

[0059] a memory for storing program instructions;

[0060] a processor for calling the program instructions stored in the memory and executing the method according to the obtained program instructions as described in the first aspect.

[0061] In a fourth aspect, there is provided a storage medium storing computer-executable instructions for causing a computer to execute the method as described in the first aspect.

[0062] In the embodiments of the present application, each output text position included in the output text sequence corresponds one-to-one to each input text position included in the input text sequence, avoiding the situation where the original meaning of the input text is changed by the correction method of deleting wrong words during the process of correcting the text, and also avoiding the situation where the original context of the input text is changed by the correction method of correcting idioms into synonymous or homomorphic words during the process of correcting the text, etc.

[0063] Moreover, the trained correction model obtains a first matching result for characterizing the matching degree between the overall input text sequence and the candidate sub-texts by matching the input sub-texts at each input text position with the candidate sub-texts in the preset candidate sub-text set. By matching the input sub-text at the specified input text position with the candidate sub-texts in the preset candidate sub-text set, a second matching result for characterizing the matching degree between the individual input sub-texts in the input text sequence and the candidate sub-texts is obtained. Matching the candidate sub-texts from two perspectives enables the trained correction model to comprehensively measure each candidate sub-text. Thus, each output sub-text determined based on the first matching result and the second matching result is more accurate, improving the correction accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] Figure 1 is an application scenario of the method for correcting text provided by the embodiments of the present application;

[0065] Figure 2 is a schematic diagram of the principle of the method for correcting text provided by the embodiments of the present application Figure 1 ;

[0066] Figure 3a is a schematic diagram of the process of the method for correcting text provided by the embodiments of the present application Figure 1 ;

[0067] Figure 3b is a schematic diagram of the principle of the method for correcting text provided by the embodiments of the present application Figure 2 ;

[0068] Figure 4 Schematic flow of a method for correcting text provided by an embodiment of the present application Figure 2 ;

[0069] Figure 5 Schematic diagram III of the principle of a method for correcting text provided by an embodiment of the present application;

[0070] Figure 6a Schematic diagram of the principle of a method for correcting text provided by an embodiment of the present application Figure 4 ;

[0071] Figure 6b Schematic diagram of the principle of a method for correcting text provided by an embodiment of the present application Figure 5 ;

[0072] Figure 7 Schematic diagram VI of the principle of a method for correcting text provided by an embodiment of the present application;

[0073] Figure 8 Schematic diagram of the structure of a device for correcting text provided by an embodiment of the present application Figure 1 ;

[0074] Figure 9 Schematic diagram of the structure of a device for correcting text provided by an embodiment of the present application Figure 2 。 Detailed implementation manners

[0075] In order to make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application.

[0076] Some terms in the embodiments of the present application are explained below to facilitate the understanding of those skilled in the art.

[0077] (1) Language model:

[0078] The language model is obtained through unsupervised training on a large-scale corpus, including the Ngram-based statistical language model and the deep learning-based neural network language model. After training the language model, the perplexity score (PPL) can be calculated for a sentence to calculate the fluency of the sentence, so as to determine whether the sentence is a reasonable natural language expression. For example, when inputting a sentence, each word is replaced with various candidates (including homophone candidates, near-homophone candidates, and shape-similar candidates), and the ratio of the PPL scores before and after the replacement of this sentence is calculated. If it is greater than a certain threshold, it means that this character or word is incorrect.

[0079] (2) Generation model:

[0080] The generation model is obtained through supervised training on a labeled corpus. For example, a seq2seq (Sequence to sequence) model. Usually, a sentence is used as the input, encoded by an encoding model, and then decoded by a decoding model to output character by character to obtain the correct sentence.

[0081] Embodiments of the present application relate to cloud technology and artificial intelligence (AI). It is designed based on cloud computing and cloud storage in cloud technology, etc. It is designed based on speech technology, natural language processing (NLP), machine learning (ML), etc. in artificial intelligence.

[0082] Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or local area network to achieve data computing, storage, processing, and sharing. Cloud technology is the general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model, which can form a resource pool, be used on demand, and be flexible and convenient. Cloud computing technology will become an important support. The back-end services of the technical network system require a large amount of computing and storage resources, such as video websites, picture websites, and more portal websites. With the highly developed application of the Internet industry, in the future, each item may have its own identification mark and needs to be transmitted to the back-end system for logical processing. Data at different levels will be processed separately, and various types of industry data require a powerful system back-end support, which can only be achieved through cloud computing.

[0083] Cloud computing is a computing model that distributes computing tasks across a resource pool composed of a large number of computing devices, enabling various application systems to obtain computing power, storage space, and information services as needed. The network that provides resources is called the "cloud". The resources in the "cloud" seem to be infinitely expandable to users, and can be obtained at any time, used on demand, expanded at any time, and paid according to usage.

[0084] As a basic capability provider of cloud computing, a cloud computing resource pool (abbreviated as a cloud platform, generally called an Infrastructure as a Service (IaaS) platform) will be established, and various types of virtual resources will be deployed in the resource pool for external customers to choose and use. The cloud computing resource pool mainly includes: computing devices (virtual machines containing operating systems), storage devices, and network devices.

[0085] According to the logical function division, on the IaaS layer, the Platform as a Service (PaaS) layer can be deployed, and on top of the PaaS layer, the Software as a Service (SaaS) layer can be deployed. Or the SaaS can be directly deployed on the IaaS. PaaS is the platform for software operation, such as databases, web containers, etc. SaaS is various business software, such as web portals, SMS mass senders, etc. Generally speaking, SaaS and PaaS are the upper layers relative to IaaS.

[0086] Cloud storage is a new concept extended and developed from the concept of cloud computing. A distributed cloud storage system (hereinafter referred to as the storage system) refers to a storage system that combines a large number of different types of storage devices (storage devices are also called storage nodes) in the network through functions such as cluster applications, grid technology, and distributed storage file systems, and collaborates through application software or application interfaces to jointly provide data storage and business access functions to the outside world.

[0087] Currently, the storage method of the storage system is as follows: Create a logical volume. When creating a logical volume, physical storage space is allocated for each logical volume. This physical storage space may be composed of the disks of a certain storage device or several storage devices. The client stores data on a certain logical volume, that is, stores the data on the file system. The file system divides the data into many parts, and each part is an object. The object not only contains the data but also contains additional information such as the data identifier (ID entity, ID). The file system writes each object into the physical storage space of the logical volume respectively, and the file system will record the storage location information of each object. Thus, when the client requests to access the data, the file system can enable the client to access the data according to the storage location information of each object.

[0088] The process of the storage system allocating physical storage space for the logical volume is specifically as follows: According to the capacity estimation of the objects stored in the logical volume (this estimation usually has a large margin relative to the actual capacity of the objects to be stored) and the group of the Redundant Array of Independent Disk (RAID), the physical storage space is pre-divided into stripes. A logical volume can be understood as a stripe, thereby allocating physical storage space for the logical volume.

[0089] Artificial intelligence uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, including theories, methods, technologies, and application systems for perceiving the environment, acquiring knowledge, and using knowledge to achieve the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can react in a way similar to human intelligence. Artificial intelligence also studies the design principles and implementation methods of various intelligent machines to enable machines to have the functions of perception, reasoning, and decision-making. Artificial intelligence technology mainly includes several major directions such as computer vision technology, natural language processing technology, machine learning, and deep learning.

[0090] With the research and progress of artificial intelligence technology, artificial intelligence has been studied and applied in multiple fields, such as common smart homes, intelligent recommendation systems, virtual assistants, smart speakers, intelligent marketing, intelligent translation, autonomous driving, robots, intelligent healthcare, etc. It is believed that with the development of technology, artificial intelligence will be applied in more fields and play an increasingly important role.

[0091] The key technologies of speech technology include automatic speech recognition technology (ASR), text-to-speech technology (TTS), and voiceprint recognition technology. Enabling computers to listen, see, speak, and feel is the future development direction of human-computer interaction, and among them, speech has become one of the most promising human-computer interaction methods.

[0092] Natural language processing is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can enable effective communication between humans and computers using natural language. Natural language processing is a science that integrates linguistics, computer science, and mathematics. Therefore, the research in this field will involve natural language, that is, the language people use in daily life, so it has a close connection with the research of linguistics. Natural language processing technology usually includes technologies such as text processing, semantic understanding, machine translation, robot question answering, and knowledge graphs.

[0093] Machine learning is an interdisciplinary subject that involves multiple disciplines such as probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory. It specifically studies how computers simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize the existing knowledge structure to continuously improve their own performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent, and its applications cover all fields of artificial intelligence. Machine learning and deep learning usually include technologies such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and rote learning.

[0094] The following briefly introduces the application fields of the method for correcting text provided in the embodiments of this application.

[0095] With the continuous rise of the self-media industry, more and more accounts publish articles and the like through devices for other accounts to read. When an account inputs text through a device, spelling mistakes may occur due to fast input or pressing the wrong keys on the keyboard, such as homophone mistakes, near-homophone mistakes or shape-similar word mistakes; grammar mistakes may also occur due to reasons such as the mismatch between the account's place of origin and the language being input, such as preposition mistakes or collocation mistakes.

[0096] With the continuous development of technology, an account can even input text without external devices such as a keyboard, but can directly speak the content to be input to the device, and the device converts the obtained voice into text form. In the process of the device converting voice into text, text mistakes such as spelling mistakes or grammar mistakes are also likely to occur.

[0097] If there are many text mistakes in the article published by an account, it is likely to make it difficult for other accounts to directly understand the meaning expressed in the article, affecting the reading experience; it will also increase the extra work difficulty for the staff reviewing the article. At present, more and more devices can perform intelligent tasks. For example, when the device obtains text, it can correct the wrong words in the text into correct words. However, due to reasons such as the lack of prior knowledge, the device is likely to delete the wrong words in the text during the process of correcting the text, or correct the wrong words in the text into other words similar to the correct words. For a language like Chinese with very rich word meanings, even similar words cannot accurately express the original meaning of the text. It can be seen that the accuracy of the process of correcting the text is relatively low.

[0098] To solve the problem of relatively low accuracy in correcting text, this application proposes a method for correcting text. After obtaining the input text sequence to be corrected, the method can adopt a trained correction model, and based on the input sub-texts at each input text position included in the input text sequence, for each output text position, respectively match the input text sequence with each candidate sub-text in the preset candidate sub-text set to obtain the first matching result for each output text position, where each output text position corresponds one-to-one with each input text position included in the input text sequence. Based on the input sub-text at the specified input text position among each input text position, for each output text position, respectively match the input text sequence with each candidate sub-text to obtain the second matching result for each output text position, where the specified input text position is the input text position specified for each output text position among each input text position. Based on the obtained first matching results and second matching results, determine the output sub-text at each output text position, and obtain the corrected output text sequence corresponding to the input text sequence.

[0099] In the embodiments of the present application, each output text position included in the output text sequence corresponds one-to-one to each input text position included in the input text sequence, avoiding the situation where the original meaning of the input text is changed by the correction method of deleting incorrect words during the text correction process, and also avoiding the situation where the original context of the input text is changed by the correction method of correcting idioms into synonymous or homonymous words during the text correction process, etc. The trained correction model obtains a first matching result for characterizing the matching degree between the overall input text sequence and the candidate sub-texts in the preset candidate sub-text set by matching the input sub-texts at each input text position with each candidate sub-text in the preset candidate sub-text set. By matching the input sub-text at a specified input text position with each candidate sub-text in the preset candidate sub-text set, a second matching result for characterizing the matching degree between an individual input sub-text in the input text sequence and the candidate sub-text is obtained. Matching the candidate sub-texts from two perspectives enables the trained correction model to comprehensively measure each candidate sub-text. Thus, each output sub-text determined based on the first matching result and the second matching result is more accurate, improving the correction accuracy.

[0100] The application scenarios of the method for correcting text provided by the present application will be described below.

[0101] Please refer to Figure 1 , which is an application scenario of the method for correcting text provided by the present application. This application scenario includes a client 101 and a server 102. Communication can be established between the client 101 and the server 102. The communication method can be wired communication technology, such as communication by connecting an Ethernet cable or a serial cable; it can also be wireless communication technology, such as communication by Bluetooth or wireless fidelity (WIFI) and other technologies, and specific limitations are not made.

[0102] The client 101 generally refers to a device that can provide input text for the server 102. For example, a terminal device, a third-party application that can be accessed by the terminal device, or a web page that can be accessed by the terminal device, etc. The terminal device is, for example, a mobile phone, a tablet computer, or a personal computer, etc. The server 102 generally refers to a device that can correct the obtained input text. For example, a terminal device or a server, etc. The server is, for example, a cloud server or a local server, etc. Both the client 101 and the server 102 can adopt cloud computing to reduce the occupation of local computing resources; similarly, cloud storage can also be adopted to reduce the occupation of local storage resources.

[0103] As an embodiment, the client 101 and the server 102 can be the same device, and specific limitations are not made. In the embodiments of the present application, the client 101 and the server 102 are taken as different devices as an example for introduction.

[0104] Based on Figure 1 , a method for correcting text provided in an embodiment of the present application will be specifically introduced.

[0105] Please refer to Figure 2 , which is a schematic diagram of a principle of a method for correcting text provided in an embodiment of the present application.

[0106] Taking the determination of the output sub - text at the first output text position in the output text sequence as an example, after obtaining the input text sequence, a trained correction model is used to match the input text sequence with each candidate sub - text in a preset candidate sub - text set based on the input sub - texts at each input text position included in the input text sequence, and a first matching result for the first output text position is obtained. For example, if the input text sequence includes n input text positions, then based on the input sub - texts at the n input text positions, that is, a1, a2, ……, a n , the input text sequence is matched with each candidate sub - text.

[0107] Using the trained correction model, based on the input sub - texts at specified input text positions, the input text sequence is matched with each candidate sub - text, and a second matching result for the first output text position is obtained. For example, if the number of specified input text positions is m, then based on the input sub - texts at the m input text positions, that is, b1, b2, ……, b m , the input text sequence is matched with each candidate sub - text. Wherein, m is an integer greater than 0 and less than n.

[0108] After obtaining the first matching result and the second matching result for the first output text position, the output sub - text at the first output text position can be determined based on the first matching result and the second matching result. After determining the corresponding output sub - text for each output text position included in the output text sequence, a corrected output text sequence corresponding to the input text sequence can be obtained, that is, c1, c2, ……, c n . Each output text position included in the output text sequence corresponds one - to - one with each input text position included in the input text sequence.

[0109] Please refer to Figure 3a , which is a schematic flowchart of a method for correcting text provided in an embodiment of the present application.

[0110] S301, obtain an input text sequence to be corrected.

[0111] There are various methods for the server 102 to obtain the input text sequence to be corrected. For example, the client 101 receives the input text to be corrected from the account input. The client 101 performs sub - text disassembling processing on the received input text and extracts each input sub - text included in the input text. The client 101 arranges each input sub - text in sequence according to the connection order of each input sub - text in the input text to obtain the input text sequence. The client 101 sends the input text sequence to the server 102, and the server 102 receives the input text sequence sent by the client 101. Among them, the input text can be a sentence, paragraph, article, etc. input by the account. The input sub - text can be a character, word, phrase, or allegorical saying, etc. in the input text.

[0112] For another example, after the client 101 receives the input text to be corrected from the account input, it can send the input text to the server 102. The server 102 receives the input text sent by the client 101, and the server 102 determines the input text sequence based on the input text.

[0113] As an embodiment, in order to represent the start or end of the input text sequence, a start identifier can be added before the first input text position in the input text sequence; an end identifier can be added after the last input text position. Thus, when the server 102 receives an input text sequence, it can determine the first input text position in the input text sequence based on the start identifier, and determine the last input text position in the input text sequence based on the end identifier, etc.

[0114] As an embodiment, when there are many input sub - texts included in the input text sequence, the server 102 can group the input sub - texts included in the input text sequence. For example, according to the number of characters included in the input text sequence, the input text sequence is divided into multiple groups, and each group includes at least one input sub - text at an input text position. The server 102 can correct the input sub - texts in each group in turn. The server 102 can correct the input sub - texts in each group in sequence or randomly correct the input sub - texts in each group. When the server 102 corrects the input sub - texts in each group in sequence, a first start identifier is added before the first input text position of the first group of input sub - texts, and a first end identifier is added after the last input text position of the first group of input sub - texts. A second start identifier is added before the first input text position of the second group of input sub - texts, and a second end identifier is added after the last input text position of the second group of input sub - texts. And so on, corresponding start identifiers and end identifiers can be set for each group of input sub - texts, and the end identifier of the previous group of input sub - texts is associated with the start identifier of the next group of input sub - texts. Thus, the server 102 can correct the input sub - texts in each group in sequence.

[0115] As an embodiment, all possible sub-texts, i.e., the candidate sub-text set, may be pre-stored in the server 102. The server 102 may also pre-store the sub-text features of each candidate sub-text in the candidate sub-text set, such as feature vectors. Thus, after obtaining the input text, the server 102 may perform sub-text division on the input text according to the text forms of the candidate sub-texts included in the candidate sub-text set. After performing sub-text division on the input text, the server 102 obtains each input sub-text included in the input text. Each candidate sub-text in the candidate sub-text set and each input sub-text in the input text may be represented in the form of an encoded vector, so that when performing operations on the candidate sub-text or the input sub-text, operations can be directly performed on the encoded vector of the candidate sub-text or the encoded vector of the input sub-text, improving the convenience of performing operations on the candidate sub-text or the input sub-text.

[0116] Taking a Chinese text as an example below, an example introduction to the method for obtaining an input text sequence is given.

[0117] For example, an account inputs a Chinese input text, "How did the Cowherd and the Weaver Girl evolve from celestial phenomena into mythological figures", through the client 101. After obtaining the input text, the client 101 sends the input text to the server 102. The server 102 receives the input text sent by the client 101 and extracts each input sub-text included in the input text, "Cowherd", "Weaver Girl", "How", "from", "celestial phenomena", "evolve into", and "mythological figures". The server 102 arranges each input sub-text in sequence according to the connection order of each input sub-text in the input text, ["Cowherd", "Weaver Girl", "How", "from", "celestial phenomena", "evolve into", "mythological figures"]. Before and after arranging each input sub-text in sequence, the server 102 adds a start identifier and an end identifier respectively, ["CLS", "Cowherd", "Weaver Girl", "How", "from", "celestial phenomena", "evolve into", "mythological figures", "SEP"], and the server 102 obtains the input text sequence.

[0118] S302. Using the trained correction model, based on the input sub-texts at each input text position included in the input text sequence, for each output text position, respectively match the input text sequence with each candidate sub-text in the preset candidate sub-text set to obtain a first matching result for each output text position.

[0119] The trained correction model may include a trained unsupervised correction sub-model and a trained supervised correction sub-model. Please refer to Figure 3b, the first matching result can be obtained by using the trained unsupervised correction sub-model, and the second matching result can be obtained by using the trained supervised correction sub-model. This avoids the problem of poor generalization of the correction model caused by only learning and training labeled training samples during the process of text correction based solely on the supervised correction model; it also avoids the problem of low correction accuracy caused by the lack of accurate reference labels for the unlabeled training samples learned during the process of text correction based solely on the unsupervised correction model. By combining the advantages of the strong generalization ability of the unsupervised correction sub-model and the high correction accuracy of the supervised correction sub-model, the accuracy of the correction model during the process of correcting text can be improved.

[0120] As an embodiment, the trained correction model may not include the complete trained unsupervised correction sub-model and the complete trained supervised correction sub-model, but the trained correction model itself can perform the steps performed by the trained unsupervised correction sub-model and the trained supervised correction sub-model. In the embodiments of the present application, for the convenience of introduction, the trained correction model is introduced as including the complete trained unsupervised correction sub-model and the complete trained supervised correction sub-model, and there is no specific limitation.

[0121] Please refer to Figure 4 , which is a schematic flow diagram for obtaining the corrected output text sequence corresponding to the input text sequence. The server 102 can obtain the corresponding output sub-text for each output text position. After obtaining the output sub-texts at all output text positions, the server 102 can obtain the output text sequence. Next, for the target output text position among each output text position, the process of obtaining the corresponding output sub-text will be introduced. The target output text position is any output text position among each output text position.

[0122] S401, use the trained unsupervised correction sub-model to obtain the first matching result for the target output text position.

[0123] The server 102 uses the trained unsupervised correction sub-model to obtain the first sequence feature vector corresponding to the input text sequence based on the sub-text features of each input sub-text included in the input text sequence. The trained unsupervised correction sub-model can fuse the sub-text features of the input sub-texts to obtain the first sequence feature vector of the input text sequence. The fusion method is the method learned by the trained unsupervised correction sub-model during the training process for fusing different permutation forms of the input sub-texts. The first sequence feature vector is used to represent the sub-text features of each input sub-text included in the input text sequence.

[0124] After obtaining the first sequence feature vector corresponding to the input text sequence, the server 102 matches the first sequence feature vector with each cluster center determined after the training of the trained unsupervised correction sub-model, determines the error between the first sequence feature vector and each cluster center, and obtains the matching degree between the input text sequence and each cluster center. Among them, the cluster center is equivalent to a part or all of the candidate sub-texts determined by the trained unsupervised correction sub-model in the candidate sub-text set during the training process. The part or all of the candidate sub-texts are the correct candidate sub-texts corresponding to the input sub-texts at the target input text positions corresponding to the target output text positions that are often prone to errors learned by the trained unsupervised correction sub-model. By matching the first sequence feature vector with each cluster center, for the target output text position, the first matching probability between the input text sequence and each candidate sub-text can be determined, and the first matching probability is used to characterize the matching degree of using each candidate sub-text to correct the input sub-text at the target input text position corresponding to the target output text position.

[0125] After the server 102 obtains the first matching probability between the input text sequence and each candidate sub-text for the target output text position, it can use the obtained first matching probabilities as the first matching results for the target output text position.

[0126] S402, adopt the trained supervised correction sub-model to obtain the second matching result for the target output text position.

[0127] The server 102 adopts the trained supervised correction sub-model to obtain the second sequence feature vector corresponding to the input text sequence based on the sub-text features of the input sub-text at the specified input text position in the input text sequence. If the specified input text position is one, then the trained supervised correction sub-model uses the sub-text features of the input sub-text at the specified input text position as the second sequence feature vector of the input text sequence; if the specified input text position is multiple, then the trained supervised correction sub-model can fuse the sub-text features of the input sub-texts at multiple input text positions respectively to obtain the second sequence feature vector of the input text sequence, and the fusion method is the method learned by the trained supervised correction sub-model during the training process for fusing different combinations of input sub-texts. The second sequence feature vector is used to characterize the sub-text features of the input sub-texts at each specified input text position respectively.

[0128] After obtaining the second sequence feature vector corresponding to the input text sequence, the server 102 can match the second sequence feature vector with the sub-text features of each candidate sub-text in the candidate sub-text set, determine the error between the second sequence feature vector and the sub-text features of each candidate sub-text, and obtain the matching degree between the second sequence feature vector and the sub-text features of each candidate sub-text for the target output text position. By matching the second sequence feature vector with the sub-text features of each candidate sub-text, for the target output text position, the second matching probability between the input text sequence and each candidate sub-text can be determined, and the second matching probability is used to characterize the matching degree of using each candidate sub-text to correct the input sub-text at the target input text position corresponding to the target output text position.

[0129] After the server 102 obtains the second matching probability between the input text sequence and each candidate sub-text for the target output text position, it can use the obtained second matching probabilities as the second matching results for the target output text position.

[0130] As an embodiment, the trained supervised correction sub-model includes a trained encoding sub-model and a trained decoding sub-model. Please refer to Figure 5 When the server 102 uses the trained supervised correction sub-model to obtain the second matching result for the target output text position, it can use the trained encoding sub-model to obtain the encoded sequence feature vector of the input text sequence based on the sub-text features of the input sub-text at the specified input text position. Use the trained decoding sub-model to obtain the decoded sequence feature vector of the input text sequence based on the sub-text features of the input sub-text at the preset input text position among all input text positions.

[0131] The preset input text position is at least one input text position preset for the target output text position among all input text positions. For example, the preset input text position can be each input text position in the input text sequence that is before the target input text position corresponding to the target output text position. If the target output text position is the third output position in the output text sequence, then the preset input text position can include the first input text position and the second input text position in the input text sequence.

[0132] For another example, the preset input text position can be each input text position in the input text sequence that has a mapping relationship with the target output text position. The mapping relationship can be pre-stored or learned by the trained decoding sub-model during the training process, etc., and is not limited here.

[0133] The server 102 determines the second sequence feature vector of the input text sequence based on the encoded sequence feature vector and the decoded sequence feature vector of the input text sequence. After obtaining the second sequence feature vector, the trained decoding sub-model is used to perform decoding processing on the second sequence feature vector, and the second matching probabilities of the input text sequence and each candidate sub-text are obtained for the target output text position.

[0134] After obtaining the second matching probabilities of the input text sequence and each candidate sub-text for the target output text position, the server 102 uses the respective second matching probabilities for the target output text position as the second matching results for the target output text position.

[0135] As an embodiment, there are multiple methods for the server 102 to obtain the second sequence feature vector of the input text sequence based on the encoded sequence feature vector of the specified input sub-text and the decoded sequence feature vector of the preset input sub-text. For example, the encoded sequence feature vector of the specified input text sequence and the decoded sequence feature vector of the preset input sub-text are summed to obtain the fused feature vector of the input text sequence. For another example, the third model parameters of the trained correction model include the weights of the encoded sequence feature vector and the weights of the decoded sequence feature vector. Based on the third model parameters, the encoded sequence feature vector of the specified input text sequence and the decoded sequence feature vector of the preset input sub-text are weighted and summed to obtain the second sequence feature vector of the input text sequence.

[0136] For another example, the third model parameters of the trained correction model include the connection weights of the encoded sequence feature vector, the connection weights of the decoded sequence feature vector, and the bias vector. Based on the third model parameters, for the target output text position, a linear operation is performed on the encoded sequence feature vector and the decoded sequence feature vector, and for the target output text position, the weight parameter g of the encoded sequence feature vector is obtained. t , please refer to formula (1):

[0137]

[0138] Among them, δ(·) represents a mapping function that maps the value to a specified interval range, such as the sigmoid function. W g represents the connection weights of the encoded sequence feature vector, U g represents the connection weights of the decoded sequence feature vector, represents the bias vector. represents the encoded sequence feature vector for the target output position t, represents the decoded sequence feature vector for the target output position t.

[0139] Based on the preset weight relationship and the weight parameters of the obtained encoded sequence feature vectors, for the target output text position, determine the weight parameters of the decoded sequence feature vectors. For the target output text position, perform a weighted summation process on the encoded sequence feature vectors and the decoded sequence feature vectors, and use the weighted summation result as the second sequence feature vector Please refer to formula (2):

[0140]

[0141] Thus, when the decoding sub-model performs decoding processing based on the second sequence feature vector, more attention can be focused on the input sub-text at the input text position corresponding to the current output text position, avoiding the situation where the semantic meaning of the input text is changed due to correction methods such as deleting words or correcting idioms into words, and improving the correction accuracy.

[0142] As an embodiment, in the trained encoding sub-model and the trained decoding sub-model, the values of the model parameters with the same name are shared among the model parameters. Thus, when training the encoding sub-model and the decoding sub-model, there is no need to repeatedly train the model parameters with the same name, improving the efficiency of model training.

[0143] S403. Based on the obtained first matching results and the obtained second matching results, determine the output sub-texts at each output text position.

[0144] After the server 102 obtains each first matching result and each second matching result, it can determine the output sub-texts at each output text position. Continuing to take the target output text position among each output text position as an example for introduction.

[0145] Perform a fusion process on the first matching result obtained for the target output text position and the second matching result obtained for the target output text position to obtain a fusion matching result for the target output text position. Since the first matching result includes the first matching probability between the input text sequence and each candidate sub-text, and the second matching result includes the second matching probability between the input text sequence and each candidate sub-text, the fusion matching result includes the fusion matching probability between the input text sequence and each candidate sub-text.

[0146] After obtaining the fusion matching result for the target output text position, the server 102 can, based on the obtained fusion matching result, screen out the candidate sub-texts that meet the preset screening conditions from the pre-stored candidate sub-text set, and use the candidate sub-text as the output sub-text at the target output text position. The preset screening conditions can be set in advance according to the usage scenario, or the one with the maximum fusion matching probability, etc., and there is no specific limitation.

[0147] As an example, there are various methods for fusing the first matching result obtained for the target output text position and the second matching result obtained for the target output text position. For example, the first model parameters of the trained correction model are used as the weights of the first matching probabilities included in the first matching result, and the second model parameters of the trained correction model are used as the weights of the second matching probabilities included in the second matching result. For the same candidate sub-text, the first matching probability and the second matching probability are subjected to a weighted summation process to obtain the fusion matching probability between the input text sequence and the corresponding candidate sub-text, thereby obtaining the fusion matching probabilities between the input text sequence and each candidate sub-text. Based on the fusion matching probabilities logp(y t ) of the input text sequence and each candidate sub-text, the fusion matching result of the input text sequence is obtained. Please refer to Formula (3):

[0148] logp(y t )=ω1logp TM (y t )+ω2logp LM (y t ) (3)

[0149] Where y t represents the t-th output text position. logp LM (y t ) represents the first matching probability between the input text sequence and each candidate sub-text, and logp TM (y t ) represents the second matching probability between the input text sequence and each candidate sub-text. ω1 and ω2 represent the second model parameter and the first model parameter respectively.

[0150] When ω1 = 0 and ω2 = 1, it means that the fusion matching probability between the input text sequence and each candidate sub-text is the second matching probability between the input text sequence and each candidate sub-text; when ω1 = 1 and ω2 = 0, it means that the fusion matching probability between the input text sequence and each candidate sub-text is the first matching probability between the input text sequence and each candidate sub-text. By adjusting the values of ω1 and ω2, the attention of the correction model can be mainly focused on the output of the unsupervised correction sub-model or the output of the supervised correction sub-model. Therefore, different ω1 and ω2 can be learned in different usage scenarios, improving the adaptability of the correction model.

[0151] For another example, based on the first model parameter and the second model parameter, for the same candidate sub-text, a non-linear operation is performed on the first matching probability and the second matching probability to obtain the fusion matching probability between the input text sequence and each candidate sub-text. The fusion matching probability between the input text sequence and each candidate sub-text is used as the fusion matching result.

[0152] As an example, after obtaining the output sub-texts at each output text position included in the output text sequence, that is, after obtaining the output text sequence, the server 102 can combine each output sub-text in a corresponding manner of disassembling the input text to obtain the output text. The server 102 can send the output text to the client 101. The client 101 receives the output text sent by the server 102 and displays the output text at the corresponding position on the display interface, completing the process of correcting the input text.

[0153] As an example, before using the trained correction model to correct text, the server 102 can first obtain the trained correction model. The trained correction model can be obtained by adjusting the model parameters of the correction model to be trained based on the training loss value.

[0154] The process of training the correction model to be trained is introduced below.

[0155] Please refer to Figure 6a , the server 102 inputs the sample input text sequence in the labeled training sample into the correction model to be trained, and obtains the supervised training result output by the correction model to be trained. The server 102 compares the supervised training result with the sample label in the labeled training sample to obtain the first comparison result between the supervised training result and the sample label. The server 102 determines the training loss value of the correction model to be trained based on the first comparison result. The server 102 determines whether the training loss value meets the convergence condition based on the obtained training loss value. If it is determined that the training loss value does not meet the convergence condition, then the server 102 adjusts the model parameters of the correction model to be trained. If it is determined that the training loss value meets the convergence condition, then the server 102 obtains the trained correction model.

[0156] The correction model includes an unsupervised correction sub-model and a supervised correction sub-model. Among them, the unsupervised correction sub-model is trained based on the unlabeled training sample, and the supervised correction sub-model is trained based on the labeled training sample. The sample input sequences included in the unlabeled training sample and the sample input sequences included in the labeled training sample can be all the same, or partially the same, or completely different, and no specific restrictions are made.

[0157] Please refer to Figure 6b, the server 102 can first obtain a trained unsupervised correction sub-model based on the unlabeled training samples, and then combine the trained unsupervised correction sub-model with the to-be-trained supervised correction sub-model, and train the to-be-trained supervised correction sub-model based on the labeled training samples. Determine the training loss value of the to-be-trained correction model based on the first training matching result output by the trained unsupervised correction sub-model and the second training matching result output by the to-be-trained supervised correction sub-model. The server adjusts the model parameters of the to-be-trained correction model based on the obtained training loss value until the training loss value meets the convergence condition, and obtains the trained supervised correction sub-model and the trained correction model. Among them, the model parameters of the correction model at least include the model parameters of the supervised correction sub-model.

[0158] The process of training the to-be-trained unsupervised correction sub-model based on the unlabeled training samples will be introduced below.

[0159] The server 102 inputs the unlabeled training samples into the to-be-trained unsupervised correction sub-model to obtain the unsupervised training result output by the to-be-trained unsupervised correction sub-model. The initial model parameters of the to-be-trained unsupervised correction sub-model can be randomly generated, or determined by the server 102 based on the model parameters of the trained unsupervised correction sub-model in the network resources, etc., and are not specifically limited. The unsupervised training result output by the to-be-trained unsupervised correction sub-model can be the matching probability that each sample input sub-text at each sample input text position in the sample input text sequence included in the training samples determined by the to-be-trained unsupervised correction sub-model matches each candidate sub-text in the pre-stored candidate sub-text set. For example, the sample input text sequence includes a first sample input sub-text and a second sample input sub-text, and the candidate sub-text set includes a first candidate sub-text and a second candidate sub-text. The unsupervised training result can include the matching probability between the first sample input sub-text and the first candidate sub-text, the matching probability between the first sample input sub-text and the second candidate sub-text, the matching probability between the second sample input sub-text and the first candidate sub-text, and the matching probability between the second sample input sub-text and the second candidate sub-text, etc.

[0160] The unsupervised training results output by the unsupervised correction sub-model to be trained can be the matching probabilities that the sample fusion input features of the sample input sub-texts at all sample input text positions in the sample input text sequence included in the training samples determined by the unsupervised correction sub-model to be trained respectively match the sub-text features of each candidate sub-text in the pre-stored candidate sub-text set. For example, the sample input text sequence includes a first sample input sub-text and a second sample input sub-text, and the candidate sub-text set includes a first candidate sub-text and a second candidate sub-text. The unsupervised training results can include the matching probabilities between the fusion input features of the first sample input sub-text and the second sample input sub-text and the sub-text features of the first candidate sub-text, the matching probabilities between the fusion input features and the sub-text features of the second candidate sub-text, etc.

[0161] Based on the obtained unsupervised training results, the server 102 clusters the unsupervised training results to determine at least one cluster center. The process of clustering the unsupervised training results can be to cluster similar unsupervised training results into one class, so that the cluster center of each class can be used as a basis for judging whether the unsupervised training results in this class are accurate. When the number of unlabeled training samples learned by the unsupervised correction sub-model to be trained is small, the error of the unsupervised training results output by the unsupervised correction sub-model to be trained is very large. As the number of unlabeled training samples learned increases, the unsupervised training results become more and more accurate. Thus, the cluster centers of the unsupervised training results become more and more accurate.

[0162] After the server 102 obtains at least one cluster center, it compares the error between the unsupervised training results included in each class in at least one class and the corresponding cluster center to obtain a second comparison result. The server 102 determines the training loss value of the unsupervised correction sub-model to be trained based on the second comparison result. The server 102 determines whether the training loss value meets the convergence condition based on the obtained training loss value. If it is determined that the training loss value does not meet the convergence condition, then the server 102 adjusts the model parameters of the unsupervised correction sub-model to be trained. If it is determined that the training loss value meets the convergence condition, then the server 102 obtains the trained unsupervised correction sub-model.

[0163] As an embodiment, the training process of the unsupervised correction sub-model can be executed by the server 102. In order to reduce the occupancy of the computing resources of the server 102, the server 102 can receive the trained unsupervised correction sub-model sent by other devices, or obtain the trained unsupervised correction sub-model from network resources, etc., so that the server 102 does not need to execute the process of training the unsupervised correction sub-model to be trained.

[0164] The process of training the to-be-trained correction model based on the labeled training samples will be introduced below in combination with the trained unsupervised correction sub-model and the to-be-trained supervised correction sub-model.

[0165] The server 102 inputs the sample input text sequence in the labeled training samples into the trained unsupervised correction sub-model, and obtains the first matching result output by the trained unsupervised correction sub-model. The first matching result may include the matching probabilities between the sample input sub-texts at the specified sample input text positions included in the sample input text sequence and each candidate sub-text.

[0166] At the same time, the server 102 inputs the sample input text sequence in the labeled training samples into the to-be-trained supervised correction sub-model, and obtains the second matching result output by the to-be-trained unsupervised correction sub-model. The second matching result may include the matching probabilities between the sample input sub-texts at the specified sample input text positions included in the sample input text sequence and each candidate sub-text.

[0167] As an embodiment, the supervised correction sub-model may include an encoding sub-model and a decoding sub-model. The process of obtaining the second matching result output by the to-be-trained unsupervised correction sub-model may be that the server 102 inputs the sample input text sequence into the encoding sub-model to obtain the sample encoding sequence feature vectors corresponding to the sample input sub-texts at the specified sample input text positions included in the sample input text sequence; inputs the sample input text sequence into the decoding sub-model to obtain the sample decoding sequence feature vectors corresponding to the sample input sub-texts at the preset sample input text positions included in the sample input text sequence.

[0168] The server 102 performs a fusion process on the obtained sample encoding sequence feature vectors and sample decoding sequence feature vectors to obtain the training feature vectors corresponding to the sample input sub-texts at the sample input text positions. There are various methods for performing a fusion process on the sample encoding sequence feature vectors and sample decoding sequence feature vectors. For example, directly perform a summation process on the sample encoding sequence feature vectors and sample decoding sequence feature vectors, and use the summation result as the training feature vector. Another example is to perform a linear operation on the sample encoding sequence feature vectors and sample decoding sequence feature vectors based on the third model parameters of the correction model to obtain the weights of the sample encoding sequence feature vectors. After obtaining the training feature vectors corresponding to the sample input sub-texts at each sample input text position, the server 102 may use the decoding sub-model to perform a decoding process on each training feature vector to obtain the second training matching probabilities between each sample input sub-text and each candidate sub-text, and obtain the second training matching result.

[0169] After obtaining the first matching result and the second matching result, the server 102 performs a fusion process on the first training matching result and the second training matching result of the sample input sub-text based on the first model parameter and the second model parameter of the correction model to be trained, and obtains the supervised training result of the sample input sub-text output by the correction model to be trained.

[0170] The training process of each model is similar to its usage process and will not be elaborated in this application.

[0171] The server 102 compares the supervised training result of the sample input sub-text with the sample label corresponding to the sample input sub-text in the labeled training sample, and obtains the first comparison result between the supervised training result and the sample label. The server 102 determines the training loss value loss of the correction model to be trained based on the sum of the first comparison results of all sample input sub-texts in the sample input text sequence. Please refer to formula (4):

[0172]

[0173] Among them, t represents the t-th sample input text position in the sample input text sequence, and n represents the number of sample input text positions in the sample input text sequence. -logP t represents the first comparison result between the supervised training result of the input sub-text at the t-th sample input text position and the sample label.

[0174] The server 102 determines whether the training loss value meets the convergence condition based on the obtained training loss value. If it is determined that the training loss value does not meet the convergence condition, then the server 102 adjusts the model parameters of the correction model to be trained. If it is determined that the training loss value meets the convergence condition, then the server 102 obtains the trained correction model.

[0175] There are various processes for fusing the first training matching result and the second training matching result based on the first model parameter and the second model parameter of the correction model to be trained. For example, when both the first training matching result and the second training matching result include the matching probabilities between the sample input text sequence and each candidate sub-text, the first model parameter can be used as the weight of each matching probability included in the first training matching result, and the second model parameter can be used as the weight of each matching probability included in the second training matching result, and weighted summation processing is performed on each matching probability with the same corresponding candidate sub-text. The server 102 uses the obtained weighted summation results as the supervised training results.

[0176] For another example, when both the first training matching result and the second training matching result include the matching probabilities between the sample input text sequence and each candidate sub-text, among the respective matching probabilities included in the first training matching result, determine the number of matching probabilities corresponding to the first model parameters, and among the respective matching probabilities included in the second training matching result, determine the number of matching probabilities corresponding to the second model parameters. Sum up the respective matching probabilities for the candidate sub-texts that are the same. The server 102 uses the obtained respective summation results as the supervised training results.

[0177] Thus, after obtaining the supervised training results, the server 102 can train the to-be-trained corrected model based on the obtained supervised training results, and adjust the model parameters of the to-be-trained corrected model, including at least the first model parameters, the second model parameters, and the third model parameters. Based on the model parameters after the last adjustment, obtain the trained supervised corrected sub-model and the trained corrected model.

[0178] Please refer to Figure 7 , and the method for correcting text provided in the embodiments of the present application will be introduced by way of example below.

[0179] The client 101 receives the input text "Revelation, this dish was once a very famous dish in the orchard. Now, every household can also have this dish, which shows that the happiness index of the citizens is getting higher and higher" input by the account. The client 101 sends the input text to the server 102, and the server 102 receives the input text sent by the client 101. The server 102 performs disassembling processing on the input text, extracts each input sub-text included in the input text. Taking the input sub-texts in the form of words as an example, each input sub-text includes "Revelation", "this dish", "once", "in", "orchard", "on", "is", "very famous", "a dish", "now", "every household", "also", "all", "can", "have", "this dish", "it can be seen that", "citizens", "happiness index", "higher and higher", "already". The server 102 obtains the input text sequence based on each input sub-text, ["Revelation", "this dish", "once", "in", "orchard", "on", "is", "very famous", "a dish", "now", "every household", "also", "all", "can", "have", "this dish", "it can be seen that", "citizens", "happiness index", "higher and higher", "already"].

[0180] The server 102 inputs the input subtext at each input text position in [“revelation”, “this dish”, “once”, “in”, “orchard”, “on”, “is”, “very famous”, “once a dish”, “now”, “each household”, “also”, “all”, “can”, “eat”, “on”, “this dish”, “it can be seen”, “citizens”, “happiness index”, “higher and higher”, “SEP”] into the encoding sub-model to obtain the encoding sequence feature vector of each input sub-text. At the same time, the server 102 inputs the input subtext at each input text position in [“BOS”, “revelation”, “this dish”, “once”, “in”, “orchard”, “on”, “is”, “very famous”, “once a dish”, “now”, “each household”, “also”, “all”, “can”, “eat”, “on”, “this dish”, “it can be seen”, “citizens”, “happiness index”, “higher and higher”, “SEP”] into the decoding sub-model to obtain the decoding sequence feature vector of each input sub-text. The server 102 inputs the input sub-text at each input text position in ["revelation", "this dish", "once", "in", "orchard", "on", "is", "very famous", "once a dish", "now", "each household", "also", "all", "can", "eat", "on", "this dish", "it can be seen", "citizens", "happiness index", "the higher the higher", "on"] into the unsupervised correction sub-model to obtain the first matching result of the input text sequence.

[0181] For example, the server 102 performs a coding sequence feature vector analysis of the input subtext "辛" and the input subtext "民" at the third input text position based on the third model parameter. and the decoded sequence feature vector of the input subtext "民" Perform linear operations to obtain the encoding sequence feature vector The weight parameter g, and the decoded sequence feature vector The server 102 generates the encoding sequence feature vector of the input subtext "辛" and the decoded sequence feature vector of the input subtext "民" Perform weighted summation to obtain the second sequence feature vector of the input subtext "辛"

[0182] The decoding submodel is used to decode the second sequence feature vector A decoding process is performed to obtain a second matching result of the input text sequence, thereby obtaining a second matching result of each input subtext.

[0183] For example, for the first matching result and the second matching result at the third output text position, based on the first model parameter and the second model parameter, a weighted sum process is performed on the first matching result and the second matching result to obtain a fused matching result for the third output text position.

[0184] The server 102 screens out the candidate sub - text "Xing" corresponding to the maximum fused matching probability in the pre - stored candidate sub - text set as the output sub - text at the third output text position. Thus, the server 102 corrects "Qishi" in the input text to "Qishi", "Guoyuan" to "Guoyan", "Yidaocai" to "Yidaocai", "Xinfu Zhishu" to "Xingfu Zhishu", and "Yuegaoyuegao" to "Yuelaiyuegao". Each output sub - text can be obtained, namely "Qishi", "Zhe daocai", "Cengjing", "Zai", "Guoyan", "Shang", "Shi", "Feichang youming de", "Yidaocai", "Xianzai", "Ge jia ge hu", "Ye", "Dou", "Nenggou", "Chi", "Shang", "Zhe daocai", "Keyi kan chu", "Shimin", "Xingfu Zhishu", "Yuelaiyuegao", "Le", and the output text sequence ["Qishi", "Zhe daocai", "Cengjing", "Zai", "Guoyan", "Shang", "Shi", "Feichang youming de", "Yidaocai", "Xianzai", "Ge jia ge hu", "Ye", "Dou", "Nenggou", "Chi", "Shang", "Zhe daocai", "Keyi kan chu", "Shimin", "Xingfu Zhishu", "Yuelaiyuegao", "Le"] is obtained.

[0185] After the server 102 obtains the output text sequence, it can combine each output sub - text in the output text sequence to obtain the output text "In fact, this dish was once a very famous dish at the state banquet. Now, every household can also eat this dish, which shows that the citizens' happiness index is getting higher and higher." The server 102 sends the output text to the client 101 for display. Thus, for example, when correcting "Xin", more attention can be focused on "Xin" and less attention will be scattered on other input sub - texts, improving the correction accuracy.

[0186] As an embodiment, the encoding sub - model can be a BERT model, and the decoding sub - model can be a Transformer model. The correction model can output each output sub - text in an autoregressive manner. The unsupervised correction sub - model can be a language model, which can be implemented by an LSTM model or a GRU model, etc., and the supervised correction sub - model can be a generative model, which can be implemented by an LSTM model or a GRU model, etc.

[0187] Based on the same inventive concept, an embodiment of the present application provides an apparatus for correcting text. This apparatus is equivalent to the server 102 discussed above and can implement the functions corresponding to the foregoing method for correcting text. Please refer to Figure 8 , the apparatus includes an acquisition module 801 and a processing module 802, where:

[0188] The acquisition module 801: is used to obtain an input text sequence to be corrected;

[0189] The processing module 802: is used to adopt a trained correction model, and based on the input sub-texts at each input text position included in the input text sequence, for each output text position, respectively match the input text sequence with each candidate sub-text in a preset candidate sub-text set, and obtain a first matching result for each output text position, where each output text position corresponds one-to-one with each input text position included in the input text sequence;

[0190] The processing module 802 is further used to: based on the input sub-text at a specified input text position among each input text position, for each output text position, respectively match the input text sequence with each candidate sub-text, and obtain a second matching result for each output text position, where the specified input text position is an input text position specified for each output text position respectively among each input text position;

[0191] The processing module 802 is further used to: based on the obtained first matching results and second matching results, determine the output sub-texts at each output text position, and obtain a corrected output text sequence corresponding to the input text sequence.

[0192] In a possible embodiment, the acquisition module 801 is specifically used to:

[0193] Obtain an input text to be corrected, and extract each input sub-text included in the input text;

[0194] Arrange each input sub-text in sequence according to the connection order of each input sub-text in the input text, and obtain an input text sequence, where the input text sequence includes multiple input text positions, and each input text position corresponds to an input sub-text.

[0195] In a possible embodiment, the trained correction model includes a trained unsupervised correction sub-model and a trained supervised correction sub-model; then the first matching result is obtained by using the trained unsupervised correction sub-model, and the second matching result is obtained by using the trained supervised correction sub-model.

[0196] In a possible embodiment, the processing module 802 is specifically used to:

[0197] For each output text position, perform the following operations respectively:

[0198] Using the trained unsupervised correction sub-model, for an output text position among each output text position, based on the sub-text features of each input sub-text, obtain the first sequence feature vector of the input text sequence;

[0199] Match the first sequence feature vector of the input text sequence with the candidate feature vectors of each pre-stored candidate sub-text, and for an output text position, obtain the first matching probability between the input text sequence and each candidate sub-text;

[0200] Take the obtained first matching probabilities as the first matching results for an output text position;

[0201] The processing module 802 is specifically configured to:

[0202] For each output text position, perform the following steps respectively:

[0203] Using the trained supervised correction sub-model, for an output text position among each output text position, based on the sub-text features of the input sub-text at the specified input text position, obtain the second sequence feature vector of the input text sequence;

[0204] Match the second sequence feature vector of the input text sequence with the candidate feature vectors of each pre-stored candidate sub-text, and for an output text position, obtain the second matching probability between the input text sequence and each candidate sub-text;

[0205] Take the obtained second matching probabilities as the second matching results for an output text position.

[0206] In a possible embodiment, the trained supervised correction sub-model includes a trained encoding sub-model and a trained decoding sub-model. The processing module 802 is specifically configured to:

[0207] Using the trained encoding sub-model, based on the sub-text features of the input sub-text at the specified input text position, obtain the encoded sequence feature vector of the input text sequence;

[0208] Using the trained decoding sub-model, based on the sub-text features of the input sub-text at the preset input text position among each input text position, obtain the decoded sequence feature vector of the input text sequence, where the preset input text position is at least one input text position preset for an output text position among each input text position;

[0209] Based on the obtained encoded sequence feature vector and decoded sequence feature vector, determine the second sequence feature vector;

[0210] The processing module 802 is specifically configured to:

[0211] Adopt the trained decoding sub-model to perform decoding processing on the second sequence feature vector to obtain the second matching probability.

[0212] In a possible embodiment, among the trained encoding sub-model and the trained decoding sub-model, the values of the model parameters with the same name are shared.

[0213] In a possible embodiment, the processing module 802 is specifically configured to:

[0214] Based on the third model parameters of the trained correction model, perform a linear operation on the obtained encoded sequence feature vector and the decoded sequence feature vector to obtain the encoding weight parameters of the encoded sequence feature vector;

[0215] Based on the obtained encoding weight parameters and the preset weight relationship, determine the decoding weight parameters of the decoded sequence feature vector;

[0216] Based on the obtained encoding weight parameters and decoding weight parameters, perform a weighted summation process on the encoded sequence feature vector and the decoded sequence feature vector to obtain the second sequence feature vector.

[0217] In a possible embodiment, the third model parameters include the connection weights of the encoded sequence feature vector, the connection weights of the decoded sequence feature vector, and the bias vector.

[0218] In a possible embodiment, the processing module 802 is specifically configured to:

[0219] For each output text position, respectively perform the following steps:

[0220] Based on the first model parameters and the second model parameters of the trained correction model, perform a fusion process on the first matching result and the second matching result for an output text position among each output text position to obtain a fusion matching result for an output text position, where the fusion matching result includes the fusion matching probabilities between the input text sequence and each candidate sub-text;

[0221] Based on the fusion matching result, in the pre-stored candidate sub-text set, screen out the candidate sub-texts whose fusion matching probabilities meet the preset screening conditions as the output sub-texts at an output text position.

[0222] In a possible embodiment, the processing module 802 is further configured to:

[0223] Perform multiple rounds of iterative training on the to-be-trained correction model based on the labeled training samples until the training loss value meets the preset convergence condition, so as to obtain the trained correction model, where, in one round of iterative training process, perform the following operations:

[0224] Input the sample input text sequence in the labeled training samples into the correction model to be trained, and obtain the supervised training result output by the correction model to be trained;

[0225] Based on the supervised training result and the first comparison result with the sample labels in the labeled training samples, determine the training loss value of the correction model to be trained;

[0226] Based on the obtained training loss value, adjust the model parameters of the correction model to be trained.

[0227] In a possible embodiment, the correction model to be trained includes an unsupervised correction sub-model to be trained; the processing module 802 is further configured to:

[0228] Before inputting the sample input text sequence in the labeled training samples into the correction model to be trained and obtaining the supervised training result output by the correction model to be trained, input the unlabeled training samples into the unsupervised correction sub-model to be trained, and obtain the unsupervised training result of the unsupervised correction sub-model to be trained;

[0229] Based on the obtained unsupervised training results, determine at least one clustering center;

[0230] Based on the second comparison result between the unsupervised training results and at least one clustering center, adjust the model parameters of the unsupervised correction sub-model to be trained to obtain the trained unsupervised correction sub-model.

[0231] In a possible embodiment, the correction model to be trained includes a trained unsupervised correction sub-model and a supervised correction sub-model to be trained; the processing module 802 is specifically configured to:

[0232] Input the sample input text sequence in the labeled training samples into the trained unsupervised correction sub-model, and obtain the first training matching result output by the trained unsupervised correction sub-model;

[0233] Input the sample input text sequence in the labeled training samples into the supervised correction sub-model to be trained, and obtain the second training matching result output by the supervised correction sub-model to be trained;

[0234] Based on the first model parameter and the second model parameter of the correction model to be trained, perform a fusion process on the first training matching result and the second training matching result to obtain the supervised training result output by the correction model to be trained.

[0235] Based on the same inventive concept, an embodiment of the present application provides a computer device. The following introduces this computer device 900.

[0236] Please refer toFigure 9 The device for amending text described above can run on a computer device 900. The current version and historical versions of the program for amending text, as well as the application software corresponding to the program for amending text, can be installed on the computer device 900. The computer device 900 includes a display unit 940, a processor 980, and a memory 920. Among them, the display unit 940 includes a display panel 941 for displaying a user interaction operation interface, etc.

[0237] In a possible embodiment, the display panel 941 can be configured in the form of a liquid crystal display (LCD) or an organic light-emitting diode (OLED), etc.

[0238] The processor 980 is used to read a computer program and then execute the method defined by the computer program. For example, the processor 980 reads the program or file for amending text, etc., so as to run the program for amending text on the computer device 900 and display the corresponding interface on the display unit 940. The processor 980 can include one or more general-purpose processors and can also include one or more DSPs (Digital Signal Processors) for performing related operations to implement the technical solutions provided in the embodiments of the present application.

[0239] The memory 920 generally includes an internal memory and an external memory. The internal memory can be a random access memory (RAM), a read-only memory (ROM), a cache (CACHE), etc. The external memory can be a hard disk, an optical disc, a USB flash drive, a floppy disk, or a tape drive, etc. The memory 920 is used to store computer programs and other data. The computer programs include application programs corresponding to each client, etc. The other data can include an operating system or data generated after the application program is run. This data includes system data (such as configuration parameters of the operating system) and user data. In the embodiments of the present application, program instructions are stored in the memory 920, and the processor 980 executes the program instructions stored in the memory 920 to implement any method for amending text described in the foregoing figures.

[0240] The above display unit 940 is used to receive input digital information, character information, or contact touch operations / non-contact gestures, and generate signal inputs related to the user settings and function controls of the computer device 900. Specifically, in the embodiments of the present application, the display unit 940 can include a display panel 941. The display panel 941, such as a touch screen, can collect touch operations of a user on or near it (such as a user using a finger, a stylus, or any suitable object or accessory to operate on the display panel 941 or near the display panel 941), and drive the corresponding connection device according to a preset program.

[0241] In a possible embodiment, the display panel 941 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the touch orientation of the player, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the processor 980, and can receive and execute the commands sent by the processor 980.

[0242] Among them, the display panel 941 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the display unit 940, the computer device 900 may further include an input unit 930. The input unit 930 may include a graphic input device 931 and other input devices 932. Among them, the other input devices may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, power on / off keys, etc.), trackballs, mice, joysticks, etc.

[0243] In addition to the above, the computer device 900 may further include a power supply 990 for powering other modules, an audio circuit 960, a near field communication module 970, and an RF circuit 910. The computer device 900 may further include one or more sensors 950, such as an acceleration sensor, a light sensor, a pressure sensor, etc. The audio circuit 960 specifically includes a speaker 961 and a microphone 962, etc. For example, the computer device 900 can collect the user's voice through the microphone 962 and perform corresponding operations, etc.

[0244] As an embodiment, the number of processors 980 may be one or more. The processor 980 and the memory 920 may be coupled or relatively independent.

[0245] As an embodiment, Figure 9 the processor 980 in Figure 8 may be used to implement the functions of the acquisition module 801 and the processing module 802 in

[0246] As an embodiment, Figure 9 the processor 980 in

[0247] Those of ordinary skill in the art can understand that all or part of the steps to implement the above method embodiments can be completed by hardware related to program instructions. The foregoing program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps including the above method embodiments; and the foregoing storage medium includes: various media such as removable storage devices, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs that can store program codes.

[0248] Alternatively, if the above integrated unit of the present invention is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiments of the present invention, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in the various embodiments of the present invention. And the foregoing storage medium includes: various media such as removable storage devices, ROM, RAM, magnetic disks, or optical discs that can store program codes.

[0249] Obviously, those skilled in the art can make various changes and modifications to this application without departing from the spirit and scope of this application. Thus, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalent technologies, this application is also intended to include these changes and modifications.

Claims

1. A method for correcting text, characterized in that, Including: Obtain an input text sequence to be corrected; Using a trained correction model, based on the input sub-texts at each input text position included in the input text sequence, for each output text position, respectively match the input text sequence with each candidate sub-text in a preset candidate sub-text set, to obtain a first matching result for each output text position, wherein, each output text position corresponds one-to-one with each input text position included in the input text sequence; Based on the input sub-text at a specified input text position among the various input text positions, for each output text position, respectively match the input sub-text at the specified input text position with each of the candidate sub-texts, to obtain a second matching result for each output text position, wherein, the specified input text position is an input text position respectively specified for each output text position among the various input text positions; Based on the obtained first matching results and second matching results, determine the output sub-texts at the respective output text positions, to obtain a corrected output text sequence corresponding to the input text sequence.

2. The method according to claim 1, wherein Obtaining an input text sequence to be corrected includes: Obtain an input text to be corrected, and extract each input sub-text included in the input text; Arrange the input sub-texts in sequence according to the connection order of the input sub-texts in the input text, to obtain the input text sequence, wherein, the input text sequence includes multiple input text positions, and each input text position corresponds to an input sub-text.

3. The method according to claim 1, characterized in that The trained correction model includes a trained unsupervised correction sub-model and a trained supervised correction sub-model; then the first matching result is obtained using the trained unsupervised correction sub-model, and the second matching result is obtained using the trained supervised correction sub-model.

4. The method according to claim 3, characterized in that, Based on the input sub-texts at each input text position included in the input text sequence, for each output text position, respectively match the input text sequence with each candidate sub-text in a preset candidate sub-text set, to obtain a first matching result for each output text position, including: For each output text position, respectively perform the following operations: Using the trained unsupervised correction sub-model, for an output text position among each output text position, based on the sub-text features of the input sub-texts, obtain a first sequence feature vector of the input text sequence; Match the first sequence feature vector of the input text sequence with the candidate feature vectors of the pre-stored candidate sub-texts, for the output text position, to obtain a first matching probability between the input text sequence and each candidate sub-text; Take the obtained first matching probabilities as the first matching result for the output text position; Based on the input sub-text at the specified input text position among the respective input text positions, for each of the output text positions, respectively match the input sub-text at the specified input text position with each of the candidate sub-texts to obtain a second matching result for each of the output text positions, including: For each of the output text positions, respectively perform the following steps: Using the trained supervised correction sub-model, for an output text position among each of the output text positions, based on the sub-text features of the input sub-text at the specified input text position, obtain a second sequence feature vector of the input text sequence; Match the second sequence feature vector of the input text sequence with the candidate feature vectors of each of the pre-stored candidate sub-texts, and for the output text position, obtain a second matching probability between the input text sequence and each of the candidate sub-texts; Take the obtained second matching probabilities as the second matching result for the output text position.

5. The method according to claim 4, characterized in that The trained supervised correction sub-model includes a trained encoding sub-model and a trained decoding sub-model; Then, using the trained supervised correction sub-model, for an output text position among each of the output text positions, based on the sub-text features of the input sub-text at the specified input text position, obtaining a second sequence feature vector of the input text sequence includes: Using the trained encoding sub-model, based on the sub-text features of the input sub-text at the specified input text position, obtain an encoded sequence feature vector of the input text sequence; Using the trained decoding sub-model, based on the sub-text features of the input sub-text at a preset input text position among the respective input text positions, obtain a decoded sequence feature vector of the input text sequence, where the preset input text position is at least one input text position preset for the output text position among the respective input text positions; Based on the obtained encoded sequence feature vector and decoded sequence feature vector, determine the second sequence feature vector; Match the second sequence feature vector of the input text sequence with the candidate feature vectors of each of the pre-stored candidate sub-texts, and for the output text position, obtaining a second matching probability between the input text sequence and each of the candidate sub-texts includes: Using the trained decoding sub-model, perform decoding processing on the second sequence feature vector to obtain the second matching probability.

6. The method according to claim 5, wherein Among the trained encoding sub-model and the trained decoding sub-model, the values of the model parameters with the same name are shared.

7. The method according to claim 5, wherein Based on the obtained encoded sequence feature vector and decoded sequence feature vector, determining the second sequence feature vector includes: Based on the third model parameter of the trained correction model, perform a linear operation on the obtained encoded sequence feature vector and decoded sequence feature vector to obtain an encoding weight parameter of the encoded sequence feature vector; Based on the obtained encoding weight parameter and a preset weight relationship, determine a decoding weight parameter of the decoded sequence feature vector; Based on the obtained encoding weight parameters and decoding weight parameters, perform weighted summation processing on the encoding sequence feature vector and the decoding sequence feature vector to obtain the second sequence feature vector.

8. The method according to claim 7, wherein The third model parameters include the connection weights of the encoding sequence feature vectors, the connection weights of the decoding sequence feature vectors, and the bias vector.

9. The method according to any one of claims 1 to 8, characterized in that Based on the obtained first matching results and second matching results respectively, determining the output sub-texts at the respective output text positions includes: For each of the output text positions, perform the following steps respectively: Based on the first model parameters and the second model parameters of the trained correction model, perform fusion processing on the first matching result and the second matching result for an output text position among the respective output text positions to obtain a fusion matching result for the output text position, where the fusion matching result includes the fusion matching probabilities between the input text sequence and the respective candidate sub-texts; Based on the fusion matching result, screen out the candidate sub-texts whose fusion matching probabilities meet the preset screening conditions from the pre-stored candidate sub-text set as the output sub-texts at the output text position.

10. The method according to any one of claims 1 to 8, characterized in that The trained correction model is obtained by adjusting the model parameters of the correction model to be trained based on the training loss value, including: Performing multiple rounds of iterative training on the correction model to be trained based on the labeled training samples until the training loss value meets the preset convergence condition to obtain the trained correction model, where during one round of iterative training, perform the following operations: Input the sample input text sequence in the labeled training sample into the correction model to be trained to obtain the supervised training result output by the correction model to be trained; Based on the first comparison result between the supervised training result and the sample label in the labeled training sample, determine the training loss value of the correction model to be trained; Based on the obtained training loss value, adjust the model parameters of the correction model to be trained.

11. The method according to claim 10, wherein The correction model to be trained includes an unsupervised correction sub-model to be trained; Then, before inputting the sample input text sequence in the labeled training sample into the correction model to be trained to obtain the supervised training result output by the correction model to be trained, further include: Input the unlabeled training sample into the unsupervised correction sub-model to be trained to obtain the unsupervised training result of the unsupervised correction sub-model to be trained; Based on the obtained unsupervised training results respectively, determine at least one clustering center; Based on the second comparison result between the unsupervised training results and the at least one clustering center, adjust the model parameters of the unsupervised correction sub-model to be trained to obtain the trained unsupervised correction sub-model.

12. The method according to claim 10, characterized in that, The correction model to be trained includes a trained unsupervised correction sub-model and a supervised correction sub-model to be trained; Then, inputting the sample input text sequence in the labeled training sample into the correction model to be trained to obtain the supervised training result output by the correction model to be trained includes: Input the sample input text sequence in the labeled training samples into the trained unsupervised correction sub-model to obtain the first training matching result output by the trained unsupervised correction sub-model; Input the sample input text sequence in the labeled training samples into the supervised correction sub-model to be trained to obtain the second training matching result output by the supervised correction sub-model to be trained; Based on the first model parameter and the second model parameter of the correction model to be trained, perform a fusion process on the first training matching result and the second training matching result to obtain the supervised training result output by the correction model to be trained.

13. An apparatus for correcting text, characterized in that, Comprising: An acquisition module: used to obtain the input text sequence to be corrected; A processing module: used to adopt the trained correction model, based on the input sub-texts at each input text position included in the input text sequence, match the input text sequence with each candidate sub-text in the preset candidate sub-text set for each output text position respectively, to obtain the first matching result for each output text position, wherein each output text position corresponds one-to-one to each input text position included in the input text sequence; Based on the input sub-text at the specified input text position among each input text position, match the input sub-text at the specified input text position with each candidate sub-text for each output text position respectively, to obtain the second matching result for each output text position, wherein the specified input text position is the input text position specified for each output text position respectively among each input text position; Based on the obtained first matching results and second matching results, determine the output sub-texts at each output text position to obtain the corrected output text sequence corresponding to the input text sequence.

14. A computer device, characterized in that, Comprising: A memory, used to store program instructions; A processor, used to call the program instructions stored in the memory and execute the method according to any one of claims 1 to 12 according to the obtained program instructions.

15. A storage medium, characterized in that, The storage medium stores computer-executable instructions, and the computer-executable instructions are used to cause a computer to execute the method according to any one of claims 1 to 12.

Citation Information

Patent Citations

  • Character spelling error correction method and system, computer equipment and storage medium

    CN108563632A

  • Machine processing and text error correction method and device, computing device and storage medium

    CN109753636A