Text correction method and apparatus

By performing error detection and candidate word recall on the text to be corrected, and using a pre-trained language model for masking, the problem of insufficient error correction efficiency and accuracy in existing technologies is solved, achieving more efficient text correction.

CN114580382BActive Publication Date: 2025-11-04ALIBABA (CHINA) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210129335.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-11
Publication Date
2025-11-04
Estimated Expiration
2042-02-11

AI Technical Summary

Technical Problem

Existing text correction schemes cannot effectively utilize long-distance contextual dependencies when dealing with misspelled words, and the training cost is high, resulting in insufficient error correction efficiency and accuracy.

Method used

By acquiring the text to be corrected, error detection is performed to identify erroneous words and recall candidate words. A pre-trained language model is then used in conjunction with masking to replace erroneous words based on the probability of the candidate words, thus obtaining the corrected text.

Benefits of technology

It improves the accuracy and efficiency of text correction by using a pre-trained language model combined with masking processing to enhance the precision and speed of text correction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114580382B_ABST
    Figure CN114580382B_ABST
Patent Text Reader

Abstract

The embodiment of the specification provides a text error correction method and device, wherein the text error correction method comprises: performing error detection on a text to be corrected, identifying an error text segment, and obtaining each initial candidate word corresponding to a wrong word through recall; according to token information and pronunciation information corresponding to the error text segment, a pre-trained language model is combined with mask processing to obtain a probability that each initial candidate word is at a mask position in the error text segment; according to the probability of each initial candidate word, a target candidate word used to replace the wrong word can be determined; then the target candidate word is used to replace the wrong word in the text to be corrected, so that an accurate corrected text is obtained, the accuracy of text error correction is improved, and the efficiency of text error correction is improved by using the pre-trained language model combined with the mask processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments in this specification relate to the field of computer technology, and in particular to a text correction method. Background Technology

[0002] Natural Language Processing (NLP) is an important research area in computer science and artificial intelligence. It primarily studies the theories and methods for enabling effective communication between humans and computers using natural language. NLP technology has been widely applied in various scenarios such as speech recognition, information retrieval, machine translation, and intelligent response.

[0003] In practical applications, NLP often involves speech recognition, text conversion, and text translation, which involves converting input speech data, image data, etc., into target text. During this data conversion process, errors are easily generated, necessitating error correction of the target text. By identifying and correcting these errors, the accuracy of subsequent text processing steps such as grammatical analysis, semantic extraction, and entity recognition can be improved. Therefore, a more efficient and accurate text correction solution is needed. Summary of the Invention

[0004] In view of this, embodiments of this specification provide a text correction method. One or more embodiments of this specification also relate to a text correction apparatus, a computing device, a computer-readable storage medium, and a computer program, to address the technical deficiencies existing in the prior art.

[0005] According to a first aspect of the embodiments of this specification, a text correction method is provided, comprising:

[0006] Obtain the text to be corrected, perform error detection on the text to be corrected, and identify the erroneous text segments containing misspelled words;

[0007] Candidate word recall is performed on the misspelled words to determine the initial candidate words corresponding to the misspelled words, and token information and pronunciation information corresponding to the misspelled text fragment are obtained. The token information is obtained by masking the misspelled words in the misspelled text fragment.

[0008] The token information, pronunciation information, and each preliminary candidate word are input into the pre-trained language model to obtain the probability of each preliminary candidate word at the mask position in the erroneous text segment. The language model is trained in the form of a mask based on the first corpus sample and the pronunciation information of the first corpus sample.

[0009] The target candidate word is determined according to the probability of each initial candidate word, the error word in the text to be corrected is replaced by the target candidate word, and a corrected text is obtained.

[0010] According to a second aspect of the embodiments of the present specification, a text correction device is provided, comprising:

[0011] An error detection module is configured to obtain a text to be corrected, perform error detection on the text to be corrected, and determine an error text segment containing an error word;

[0012] A recall module is configured to perform candidate word recall on the error word, determine each initial candidate word corresponding to the error word, and obtain token information and pronunciation information corresponding to the error text segment, wherein the token information is obtained by performing mask processing on the error word in the error text segment;

[0013] A probability calculation module is configured to input the token information, the pronunciation information, and each initial candidate word into a pre-trained language model to obtain probabilities that the mask position in the error text segment is each initial candidate word, wherein the language model is obtained by performing mask form training on a specific word in a first corpus sample based on the first corpus sample and pronunciation information of the first corpus sample;

[0014] A correction module is configured to determine a target candidate word according to the probability of each initial candidate word, replace the error word in the text to be corrected with the target candidate word, and obtain a corrected text.

[0015] According to a third aspect of the embodiments of the present specification, a computing device is provided, comprising:

[0016] A memory and a processor;

[0017] The memory is used to store computer executable instructions, and the processor is used to execute the computer executable instructions, which implement the steps of the above-mentioned text correction method when executed by the processor.

[0018] According to a fourth aspect of the embodiments of the present specification, a computer readable storage medium is provided, which stores computer executable instructions, which implement the steps of the above-mentioned text correction method when executed by the processor.

[0019] According to a fifth aspect of the embodiments of the present specification, a computer program is provided, wherein when the computer program is executed in a computer, the computer executes the steps of the above-mentioned text correction method.

[0020] In an embodiment of the present specification, by obtaining the text to be corrected, performing error detection on the text to be corrected, determining the error text segment containing the wrong word, performing candidate word recall on the wrong word, determining each initial candidate word corresponding to the wrong word, and obtaining token information and pronunciation information corresponding to the error text segment, the token information, pronunciation information and each initial candidate word are input into the pre-trained language model to obtain the probability that each initial candidate word is at the mask position in the error text segment. According to the probability of each initial candidate word, the target candidate word is determined, the target candidate word is used to replace the wrong word in the text to be corrected, and the corrected text is obtained. Wherein, the token information is obtained by masking the wrong word in the error text segment, and the language model is obtained by masking the specific word in the first corpus sample based on the first corpus sample and the pronunciation information of the first corpus sample.

[0021] By performing error detection on the text to be corrected, identifying the error text segment, and obtaining each initial candidate word corresponding to the wrong word through recall, and then according to the token information and pronunciation information corresponding to the error text segment, the pre-trained language model is used in combination with the mask processing to obtain the probability that each initial candidate word is at the mask position in the error text segment. The probability of each initial candidate word represents the accuracy of the text segment after replacing the wrong word with the initial candidate word. The higher the probability of an initial candidate word, the higher the accuracy of the text obtained by replacing the wrong word with the initial candidate word. According to the probability of each initial candidate word, the target candidate word used to replace the wrong word can be determined. Then, the target candidate word is used to replace the wrong word in the text to be corrected, and the corrected text is obtained. This improves the accuracy of text correction, and the use of the pre-trained language model in combination with the mask processing improves the efficiency of text correction. BRIEF DESCRIPTION OF DRAWINGS

[0022] Figure 1 is a flowchart of a text correction method provided by an embodiment of the present specification;

[0023] Figure 2 is an architecture diagram of error detection by an error detection model in a text correction method provided by an embodiment of the present specification;

[0024] Figure 3 is an architecture diagram of candidate word screening by a language model in a text correction method provided by an embodiment of the present specification;

[0025] Figure 4 is a process flowchart of a text correction method provided by an embodiment of the present specification;

[0026] Figure 5 is a structural schematic diagram of a text correction device provided by an embodiment of the present specification;

[0027] Figure 6 is a structural block diagram of a computing device provided by an embodiment of the present specification. DETAILED DESCRIPTION

[0028] In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present specification. However, the present specification can be practiced without the specific details, other than in the examples, set forth in this description. Those skilled in the art, in possession of the present specification, can make similar modifications or adaptations to the present specification in order to accomplish like purposes without departing from the scope of the present specification.

[0029] The terminology used by the one or more embodiments of the present specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of the present specification. As used in the one or more embodiments of the present specification and the appended claims, the singular forms "a," "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "and / or," as used in the one or more embodiments of the present specification, refers to and encompasses any and all possible combinations of one or more of the associated listed items.

[0030] It will be understood that, although the terms first, second, etc. can be used herein to describe various information, these terms are not intended to denote a temporal or chronological order. Rather, these terms are used only to distinguish one from another. For example, without departing from the scope of the one or more embodiments of the present specification, first can be termed second, and similarly, second can be termed first. The word "if' as used herein means "when" or "upon" or "in response to the determination" depending on the context.

[0031] First, the noun terms related to the one or more embodiments of the present specification are explained.

[0032] Speech recognition technology: also known as automatic speech recognition (ASR, Automatic Speech Recognition), is to let intelligent devices understand human voice. Its goal is to convert the lexical content in human voice into computer-readable input, such as keystrokes, binary codes or character sequences. Speech recognition technology is a multi-disciplinary science involving digital signal processing, artificial intelligence, linguistics, mathematical statistics, acoustics, emotion and psychology. This technology can provide many applications such as automatic customer service, automatic speech translation, command control, voice verification, etc. In recent years, with the rise of artificial intelligence, speech recognition technology has made great breakthroughs in theory and application, and has begun to move from the laboratory to the market, and has gradually entered our daily life. Now speech recognition has been used in many fields, mainly including speech recognition dictation, voice paging and question answering platform, autonomous advertising platform, intelligent customer service, etc.

[0033] Text Correction: A technology in the field of natural language processing that detects and corrects errors in a piece of text. It is commonly used in the preprocessing stage of text and can significantly improve the accuracy of ASR in scenarios such as intelligent customer service.

[0034] N-Gram Language Model: A statistical language model algorithm that operates on a sliding window of size N in the text to form a sequence of byte segments of length N. Each byte segment is called a Gram, and the frequency of each Gram is counted and filtered based on a pre-set threshold to form a list of key Grams, which is the vector feature space of the text. Each Gram in the list is a feature vector dimension. This model is based on the assumption that the appearance of the i-th word is only related to the previous i-1 words, and has nothing to do with any other word. The probability of the entire sentence is the product of the probabilities of each word appearing. These probabilities can be obtained by directly counting the number of times i words appear together in the corpus.

[0035] BERT (Bidirectional Encoder Representations from Transformers): A language representation model. Its main model structure is the encoder layer of the transformer model, which is actually a two-stage framework, pre-training and fine-tuning on specific tasks. The pre-training stage requires a large amount of data and a large amount of computer resources. Generally, you can obtain an open-source language pre-training model and then fine-tune it on this basis.

[0036] RoBERTa: An improved BERT model.

[0037] Masked Language Model (MLM): It is actually a cloze task, randomly masking some words in the text, and then predicting the masked words by the model.

[0038] Logistic Regression (LR): A generalized linear regression analysis model commonly used in data mining, automatic disease diagnosis, economic prediction, and other fields. Logistic regression is essentially a binary classification problem.

[0039] w2v (word to vector): A tool for converting words to vector representations.

[0040] In a traditional text correction scheme, an N-Gram language model is often used for interpolation. This scheme requires determining a specific application scenario, manually constructing a scenario corpus, training a small-scale N-Gram language model, and interpolating the small-scale N-Gram language model with a large-scale general N-Gram language model. This scheme requires strong prior knowledge to construct the scenario corpus, and has the disadvantage of the N-Gram language model, i.e., the long-distance context dependency is not ignored during text correction.

[0041] Another text correction scheme is based on a machine translation model, which translates a text containing incorrect words into a correct text by training a translation model. This scheme requires a large amount of parallel correction data (including incorrect sentences and corresponding correct sentences) for training, and the model training cost is high.

[0042] To address the above problems, in the present specification, a text correction method is provided, and the present specification also relates to a text correction device, a computing device, and a computer-readable storage medium, which are described in detail in the following embodiments.

[0043] The execution subject of the text correction method provided in the embodiments of the present specification can be a computing device providing a text correction function, or a computing device providing a speech recognition function, such as a real-time conference device, a voice question and answer device, a personal computer, etc. The execution subject can also be a background server, which provides a text correction function. The text correction method provided in the embodiments of the present specification can be implemented by at least one of software, hardware circuit, and logic circuit in the execution subject.

[0044] Referring to Figure 1 , Figure 1 A flowchart of a text correction method according to an embodiment of the present specification is shown, which specifically includes the following steps.

[0045] Step 102: obtaining a text to be corrected, detecting errors in the text to be corrected, and determining an error text segment containing incorrect words.

[0046] The text to be corrected refers to a text input by a user and requiring correction processing, or a text obtained by converting speech data, picture data, or a text to be translated. Due to the limitations of the tools used for data conversion and the uncontrollability of manual input, these texts often contain incorrect words and characters, which need to be corrected.

[0047] In an implementation form of the embodiment of the present specification, the step of obtaining the text to be corrected in step 102 can be implemented by the following manner: obtaining audio data; performing recognition on the audio data to obtain the text to be corrected.

[0048] In actual speech recognition scenarios, such as real-time conference scenarios, voice question and answer scenarios, etc., due to the influence of subjective or objective factors such as accent and spoken language habits, the problem of inaccurate recognition of speech recognition technology is more prominent. Therefore, for the speech recognition scenario, the audio data is obtained, and then the audio data is recognized, that is, the text to be corrected can be obtained. The audio data can be input by the user in real time or obtained by pre-recording, and the ASR technology can be used to recognize the audio data.

[0049] After obtaining the text to be corrected, error detection needs to be performed on the text to be corrected. Error detection is to detect the error words from the text to be corrected. Whether a word is wrong or not is also related to its context. Therefore, in order to further improve the accuracy of error detection, the error text segment containing the wrong word will be finally determined.

[0050] Error detection can be performed in the following ways: based on a hot word list, a correction word pair, and an error detection model. The hot word list method is to pre-establish a list that records hot words prone to errors. Then, the text to be corrected is processed by word segmentation (word segmentation tools such as Jieba word segmentation can be used), and each word is matched with the hot words in the hot word list. If it matches, the word is a wrong word. Alternatively, a word extraction model (a pre-trained language model) can be used to extract each word from the text to be corrected, and then the extracted word is matched with the hot word in the hot word list. If it matches, the word is a wrong word. The correction word pair method is to collect correction word pairs according to the error correction behavior. The correction word pair records the original word before modification and the candidate word after modification. Then, the text to be corrected is processed by word segmentation (word segmentation tools such as Jieba word segmentation can be used), and each word is matched with the original word in the correction word pair. If it matches, the word is a wrong word. Alternatively, a word extraction model (a pre-trained language model) can be used to extract each word from the text to be corrected, and then the extracted word is matched with the original word in the correction word pair. If it matches, the word is a wrong word. The error detection model method is to pre-train an error detection model. The error detection model is trained based on a large amount of samples (sample sentences with errors). The error detection model is an end-to-end neural network model. The input of the error detection model is the text to be corrected, and the output of the error detection model is the wrong word in the text to be corrected.

[0051] After detecting the wrong word in the text to be corrected, the error text segment can be extracted by extracting the wrong word and the adjacent words / phrases / sentences before and after the wrong word.

[0052] In an implementation form of an embodiment of the present specification, before step 102 is performed, the text error correction method can further include the following steps:

[0053] The pre-processing is performed on the text to be corrected to obtain each sentence in the text to be corrected.

[0054] Correspondingly, step 102 can be implemented by the following manner: respectively performing error detection on each sentence to determine the error text segment containing the wrong word in each sentence.

[0055] After obtaining the text to be corrected, in order to facilitate subsequent error detection, candidate word recall and other operations, the text to be corrected is generally pre-processed first. The pre-processing can generally include steps of word segmentation, part-of-speech tagging, keyword extraction, sentence splicing, etc. The word segmentation step can use word segmentation tools such as Jieba, SnowNLP, THULAC, NLPIR, etc. to perform word segmentation on the text to be corrected. After word segmentation of the text to be corrected, since a word can have different parts of speech, the possibility of error under different parts of speech is different. For example, “self-learning” can be used as a noun or a verb, and the possibility of error as a noun is greater, and it is likely to appear as “school of children” or “school of children”. Therefore, it is necessary to perform part-of-speech tagging on each word. The part-of-speech tagging can be manually annotated or machine annotated. The machine annotation generally uses a neural network based on deep learning. The word and sentence are input into a pre-trained part-of-speech tagging model. The part-of-speech tagging model is trained based on a large amount of samples (sample sentences with part-of-speech annotations for each word). The part-of-speech tagging model is an end-to-end neural network model. The input word and sentence can directly obtain the part of speech of the word in the sentence. After part-of-speech tagging, for some words with certain parts of speech, such as prepositions and conjunctions, they do not play a big role in specific semantics, and the error has little effect on semantics. However, the error of entity words such as nouns and verbs has a greater impact on semantics. Therefore, in order to improve the efficiency of error detection, keyword extraction can be performed. The specific manner of keyword extraction can use an entity extraction model or other keyword extraction model. The keyword extraction model is trained based on a large amount of samples (sample sentences with keyword annotations for each word). The keyword extraction model is an end-to-end neural network model. The input sentence can directly extract the keywords in the sentence. After extracting the keywords, the keywords can be spliced to obtain the spliced sentences. The specific splicing manner is to splice the keywords in the order of keyword extraction.

[0056] After pre-processing the to-be-corrected text to obtain each sentence in the to-be-corrected text, error detection can be performed on each sentence, that is, error detection is performed on each sentence to determine the error text segment containing the wrong word in each sentence. The error detection method for each sentence can be the above-mentioned method based on the hot word list, the error correction word pair, and the error detection model, and will not be described here. The length of each sentence is shorter than the length of the to-be-corrected text, which can improve the efficiency of error detection.

[0057] In an implementation form of the embodiment of the present specification, the step of performing error detection on each sentence to determine the error text segment containing the wrong word in each sentence can be implemented by the following method:

[0058] Obtaining pronunciation information of the first sentence, wherein the first sentence is any one of the sentences;

[0059] Inputting the first sentence and the pronunciation information into the pre-trained error detection model to obtain a correctness value of each character in the first sentence, wherein the error detection model is trained based on the second corpus sample and the pronunciation information of the second corpus sample;

[0060] Determining a first wrong word in the first sentence according to the correctness value of each character;

[0061] Determining a first error text segment composed of the first wrong word and the adjacent words of the first wrong word according to the preset text segment extraction method.

[0062] In the specific implementation of the embodiment of the present specification, in order to improve the efficiency and accuracy of error detection, a pre-trained error detection model can be used for error detection. Specifically, the error detection model is trained based on the second corpus sample and the pronunciation information of the second corpus sample. The specific training process can be: extracting the second corpus sample and the pronunciation information of the second corpus sample, inputting an initial neural network model, calculating the correctness of each character in the second corpus sample through the neural network model, comparing the obtained correctness with the identification information to obtain a loss value, adjusting the model parameters of the neural network model based on the loss value, and then returning to execute the step of extracting the second corpus sample and the pronunciation information of the second corpus sample and inputting the initial neural network model until the loss value is less than a threshold value, or the number of iterations of the returned execution reaches a preset number, then confirming that the training is completed, and obtaining the error detection model.

[0063] After the error detection model is trained in the above manner, the first sentence (any sentence) in the to-be-corrected text and the pronunciation information of the sentence are input into the pre-trained error detection model, and the correctness value of each character in the first sentence is obtained end-to-end. The higher the correctness value of adjacent characters, the higher the correctness of the word composed of the adjacent characters, and vice versa. Therefore, the first wrong word in the first sentence can be determined according to the correctness value of each character. Specifically, the correctness values of the characters that can form a word are multiplied, and if the result is less than a threshold, the word is considered to be a wrong word. Of course, the correctness values of the characters that can form a word can also be compared with the threshold respectively, and if a certain comparison result is met, the word is considered to be a wrong word. Then, according to a pre-set text segment extraction manner, a first error text segment composed of the first wrong word and the adjacent words of the first wrong word can be determined. The text segment extraction manner can be extracting a first error text segment composed of a pre-set number of words adjacent to the left of the first wrong word, or extracting a first error text segment composed of a pre-set number of words adjacent to the right of the first wrong word, or extracting a first error text segment composed of a pre-set number of words adjacent to the left and right of the first wrong word. The pronunciation information of the first sentence refers to a sequence composed of the pronunciation information (usually pinyin) of each character in the first sentence.

[0064] Referring to Figure 2 , Figure 2 An architecture diagram of error detection by an error detection model in a text correction method according to one embodiment of the present specification is shown. For example, the first sentence (i.e. Figure 2The pronunciation information of the first sentence is "you yi ge mei shi qi quan", and the position index and block index information are added accordingly. The input is input into the error detection model, and the output layer outputs the correctness value of the position of a certain word at the 6th and 7th position index. Since the input pronunciation information has a strong influence on the output result, the pronunciation information is considered when outputting. For example, if the pronunciation information is not considered, the output of the output layer will be: the correctness value of the 6th position is 0.01 for "qi", and the correctness value of the 7th position is 0.05 for "quan"; the correctness value of the 6th position is 0.25 for "zu", and the correctness value of the 7th position is 0.11 for "qiu"; the correctness value of the 6th position is 0.41 for "ka", and the correctness value of the 7th position is 0.15 for "fei"; the correctness value of the 6th position is 0.22 for "qi", and the correctness value of the 7th position is 0.65 for "quan". If the pronunciation information is considered, the output of the output layer will be: the correctness value of the 6th position is 0.12 for "qi", and the correctness value of the 7th position is 0.11 for "quan"; the correctness value of the 6th position is 0.75 for "qi", and the correctness value of the 7th position is 0.81 for "quan". It can be seen that the pronunciation information is used to constrain the error detection model, which can improve the accuracy of the error detection model.

[0065] In an implementation form of the embodiment of the present specification, according to the correctness value of each word, the step of determining the first wrong word in the first sentence can be implemented by the following manner:

[0066] According to the correctness value of each word, determining a target word whose correctness value is less than a first preset threshold value;

[0067] Searching for a target word composed of adjacent target words in a preset near sound restricted word list;

[0068] If the target word is found, the target word is determined as the first wrong word in the first sentence.

[0069] Specifically, in determining the first wrong word in the first sentence according to the correctness value of each word, first, the target word with a correctness value less than a first preset threshold can be determined according to the correctness value of each word. For each word, if the correctness value of the word is less than the first preset threshold, it means that the word composed of the word is more likely to be a wrong word. Therefore, the target word meeting the condition is determined first. Specifically, the comparison of the correctness value of each word with the first preset threshold can be dynamically performed (i.e., the comparison is performed once the correctness value of the first word is extracted), or statically performed (all words are extracted and then compared uniformly). After the target word is determined, the target word composed of the adjacent target words is searched from the preset near-homophone restricted word list. The near-homophone restricted word list records near-homophone words that are prone to errors, for example, “full” and “option” and “waive” are near-homophone words, and the possibility of being recognized as errors is relatively large. In order to improve the accuracy of error detection, the target word composed of the adjacent target words can be searched in the near-homophone restricted word list. If the target word is found, it means that the first wrong word (i.e., the target word found) exists in the first sentence. If the target word is not found, it means that there is no wrong word in the first sentence.

[0070] Step 104: performing candidate word recall on the wrong word, determining each initial candidate word corresponding to the wrong word, and obtaining token information and pronunciation information corresponding to the error text segment, wherein the token information is obtained by performing mask processing on the wrong word in the error text segment.

[0071] After the error text to be corrected is subjected to error detection to determine the error text segment containing the wrong word, the wrong word can be subjected to a recall operation. The recall operation here refers to finding the possible correct word corresponding to the wrong word, obtaining each initial candidate word corresponding to the wrong word. The specific recall method can include a general word list, a model recall, and the like. The general word list is pre-established and records the possible correct candidate words corresponding to each word if an error occurs. Each initial candidate word corresponding to the wrong word can be directly obtained from the general word list. The model recall is to pre-train a recall model. The recall model is trained based on a large amount of samples (including word pairs of wrong words and candidate words). The recall model is an end-to-end neural network model. The initial candidate words corresponding to the wrong word can be directly obtained by inputting the wrong word.

[0072] In an implementation manner of the embodiment of the present specification, the step of performing candidate word recall on the wrong word to determine each initial candidate word corresponding to the wrong word can be implemented by the following manner:

[0073] The candidate word recall on the wrong word is performed by using a preset candidate word recall manner.

[0074] The first pronunciation information of the wrong word and the second pronunciation information of each recalled candidate word are obtained, and the similarity between each second pronunciation information and the first pronunciation information is determined.

[0075] obtain each initial candidate word with a similarity greater than a second preset threshold.

[0076] Specifically, when determining each initial candidate word corresponding to the error word, the general word table, the model recall, and other preset candidate word recall manners can be used to recall candidate words for the error word, that is, a large number of candidate words can be obtained, and the error word is generally caused by the pronunciation of the word being too similar, for example, the pronunciation information of "option" and "complete" is "qi quan", and the candidate word recall can be performed in combination with the near sound restriction, that is, the candidate words are screened based on the pronunciation information. Specifically, the first pronunciation information of the error word and the second pronunciation information of each recalled candidate word can be obtained, the similarity of each second pronunciation information and the first pronunciation information is determined, if the similarity is high (greater than a second preset threshold), the possibility of being a candidate word is high, therefore, each candidate word with a similarity greater than the second preset threshold in each recalled candidate word is obtained as an initial candidate word. By combining the near sound restriction to perform candidate word recall, the possibility of each initial candidate word being accurate is higher, and therefore the text correction accuracy in the subsequent process can be improved.

[0077] In an implementation manner of the embodiments of the present specification, the step of recalling candidate words for the error word and determining each initial candidate word corresponding to the error word can be implemented by the following manners:

[0078] recalling candidate words for the error word by using a preset candidate word recall manner;

[0079] determining the word feature information of each recalled candidate word based on the text to be corrected;

[0080] determining the key degree of each recalled candidate word by using a logistic regression algorithm according to the word feature information, and extracting each initial candidate word with a key degree greater than a third preset threshold in each recalled candidate word.

[0081] Specifically, in determining each initial candidate word corresponding to the wrong word, the above-mentioned general word table, model recall, and other preset candidate word recall modes can be used to recall candidate words for the wrong word, that is, a large number of candidate words can be obtained. Since the number of candidate words recalled by the above-mentioned mode for one wrong word is huge, in order to further improve the text correction efficiency, the obtained candidate words can be screened. Specifically, the word feature information of each recalled candidate word can be determined based on the corrected text, and the word feature information represents the importance of the candidate word. Then, according to the word feature information, the LR algorithm can be used to determine the key degree of each recalled candidate word. The LR algorithm is equivalent to a binary classification model, and the result of whether the candidate word is key or not can be obtained. Therefore, the higher the key degree, the higher the possibility that the candidate word is retained to replace the wrong word. Therefore, each candidate word with a key degree greater than a third preset threshold can be extracted from each recalled candidate word as an initial candidate word. Specifically, after obtaining each recalled candidate word, the candidate words can be sorted in descending order of the key degree of each recalled candidate word, and then each candidate word with a key degree greater than the third preset threshold can be selected in descending order as an initial candidate word.

[0082] The above-mentioned word feature information includes but is not limited to mask probability, part-of-speech information, word frequency information, text correlation information, pronunciation similarity, whether it is a hot word, etc., which will be introduced one by one. The mask probability is obtained by inputting the error text segment into the pre-trained mask language model. The mask language model is a cloze task, which randomly masks some words in the text, and then the model predicts the masked words. The specific output is the probability of the masked word, that is, the wrong word in the error text segment is masked, and then input into the mask language model, so that the mask probability of each candidate word at the mask position in the error text segment can be obtained. The part-of-speech information is the part-of-speech information added in the preprocessing, such as the above-mentioned possibility of different part-of-speeches. Similarly, different candidate words have different part-of-speeches, which will make the possibility of replacing the wrong word different. The part-of-speech information of the candidate word is generally manually annotated. The word frequency information is the frequency of the candidate word appearing in the text to be corrected, which fully considers the text to be corrected and can better meet the needs of long text. The text correlation information can be obtained by calculating the similarity between the candidate word and the key word extracted in the preprocessing stage. Specifically, the cosine value of the candidate word and the key word w2v can be calculated, or the characters can be directly compared for similarity. The pronunciation similarity refers to the pronunciation similarity between the candidate word and the wrong word, which can be obtained by comparing the pronunciation information of the candidate word and the pronunciation information of the wrong word. Whether it is a hot word can be a pre-established hot word list, which records hot words prone to errors. Then the candidate word is matched with the hot words in the hot word list.

[0083] In another implementation manner of the embodiment of the present disclosure, the candidate word recall can be performed in combination with the above-mentioned manner of limiting the near sound, and then the key degree of each recalled candidate word is determined according to the word feature information of each recalled candidate word by using a logistic regression algorithm, and each preselected candidate word with a key degree greater than a third preset threshold is extracted from each recalled candidate word.

[0084] After the preselected candidate words corresponding to the error word are determined, since the subsequent steps need to use a pre-trained language model to screen the candidate words, and the input of the language model includes the token information, pronunciation information of the error text segment and the preselected candidate words, therefore, before the candidate words are screened by using the language model, the token information and pronunciation information corresponding to the error text segment need to be obtained. The token information corresponding to the error text segment refers to the information obtained by performing mask processing on the error words in the error text segment. Since the error words in the error text segment need to be corrected during text error correction, that is, the correct words are re-filled at the position of the error words, the error words in the error text segment can be masked, that is, the error words in the error text segment are hidden, and thus the token information of the error text segment is obtained. For example, the error text segment is “you yi ge mei shi qi quan”, and “qi quan” is an error word, and the token information obtained by performing mask processing on the error word in the error text segment is “you yi ge mei shi [MASK] [MASK]”. The pronunciation information corresponding to the error text segment refers to a sequence composed of the pronunciation information (generally, pinyin, phonetic alphabet, etc.) of each word in the error text segment. For example, the error text segment is “you yi ge mei shi qi quan”, and the pronunciation information corresponding to the error text segment is “you yi ge mei shi qi quan”.

[0085] Step 106: inputting the token information, pronunciation information and preselected candidate words into a pre-trained language model to obtain the probability that each preselected candidate word is at the mask position in the error text segment, wherein the language model is obtained by performing mask training on a specific word in a first corpus sample based on the first corpus sample and the pronunciation information of the first corpus sample.

[0086] After obtaining the error word corresponding to each initial candidate word, the token information and pronunciation information corresponding to the error text segment, the token information, pronunciation information and each initial candidate word can be input into the pre-trained language model. The language model is an end-to-end neural network model obtained by training a specific word in the first corpus sample in a masked form based on the first corpus sample and the pronunciation information of the first corpus sample. The specific training process can be: extracting the first corpus sample and the pronunciation information of the first corpus sample, masking any word in the first corpus sample, then inputting the initial neural network model, calculating the neural network model to obtain the probability of each target word at the masked position in the first corpus sample, comparing the model output with the original word at the position of the first corpus sample to obtain a loss value, adjusting the model parameters of the neural network model based on the loss value, and then returning to execute the step of extracting the first corpus sample and the pronunciation information of the first corpus sample, masking any word in the first corpus sample, then inputting the initial neural network model, until the loss value is less than a threshold value, or the number of iterations returned to execute reaches a preset number, then confirming that the training is completed, and obtaining the language model. The first corpus sample can be a spoken corpus input by a person or an internet corpus obtained from the Internet, which is not limited here. Inputting the token information, pronunciation information and each initial candidate word into the pre-trained language model can obtain the probability of each initial candidate word at the masked position in the error text segment.

[0087] Referring to Figure 3 , Figure 3 An architecture diagram of language model for candidate word screening in a text error correction method according to one embodiment of the present specification is shown. The language model uses a phone-RoBERTa model, where phone represents that the model input includes phone-level features (i.e. pronunciation information corresponding to the error text segment). For example, the error text segment is "you have a complete American style", the token information input into the language model is "you have a complete American style [MASK] [MASK]", the pronunciation information is "youyi ge mei shi qi quan", and the position index and block index information are correspondingly increased, and these inputs are input into the language model. At the 6th and 7th position index of the output layer, the probability of each initial candidate word (such as "option", "waive", "go full", "ring") is output. For the information input into the language model, the token information and pronunciation information corresponding to multiple error text segments can also be spliced and input, which can better consider the context relationship of long text, and the length of the input can be limited within 512 bytes.

[0088] Since the input pronunciation information has a strong influence on the output result, the pronunciation information is considered during output, which can improve the accuracy of candidate word screening.

[0089] Step 108: determining a target candidate word according to the probability of each preliminary candidate word, replacing the error word in the text to be corrected with the target candidate word to obtain a corrected text.

[0090] After obtaining the probability of each preliminary candidate word at the mask position in the error text segment by using the pre-trained language model, since the probability of each preliminary candidate word represents the possibility of the preliminary candidate word being used to replace the error word, the higher the probability, the higher the possibility of replacing the error word. Therefore, the target candidate word can be determined according to the probability of each preliminary candidate word. Specifically, the preliminary candidate word with the highest probability can be selected as the target candidate word, or the preliminary candidate word with a probability higher than a certain threshold can be selected as the target candidate word. That is, after recalling the preliminary candidate words in a recall manner, the target candidate word is further determined more accurately according to the probability of each preliminary candidate word, and the target candidate word is used to replace the error word in the text to be corrected, so that an accurate corrected text is obtained, and the accuracy of text correction is improved.

[0091] In an implementation manner of the embodiment of the present specification, the step of determining the target candidate word according to the probability of each preliminary candidate word can be implemented in the following manner: determining the preliminary candidate word with a probability greater than a fourth preset threshold as the target candidate word according to the probability of each preliminary candidate word.

[0092] Specifically, when determining the target candidate word, the accuracy is further considered, and the preliminary candidate word with a probability greater than the fourth preset threshold can be determined as the target candidate word according to the probability of each preliminary candidate word, that is, the target candidate word is not necessarily unique, and a certain redundancy space is reserved.

[0093] In an implementation manner of the embodiment of the present specification, the step of replacing the error word in the text to be corrected with the target candidate word to obtain a corrected text can be implemented in the following manner:

[0094] For the second error word in the second sentence, any second target candidate word corresponding to the second error word is selected, wherein the second sentence is any sentence;

[0095] The second target candidate word is used to replace the second error word to obtain a corrected sentence corresponding to the second sentence;

[0096] The corrected sentence and the second sentence are subjected to conflict detection, and if there is a conflict, the step of selecting any second target candidate word corresponding to the second error word is returned.

[0097] For the above scheme of screening target candidate words, the initial candidate words with probabilities greater than a fourth preset threshold are determined as target candidate words according to the probabilities of the initial candidate words. The number of the determined target candidate words can be multiple. For any sentence (second sentence) in the text to be corrected, any second target candidate word corresponding to a second error word in the second sentence can be selected, and the second target candidate word can be used to replace the second error word to obtain a corrected sentence corresponding to the second sentence. After obtaining the corrected sentence, conflict detection can be performed on the corrected sentence and the second sentence, that is, whether there is a conflict between the corrected sentence and the second sentence is detected from the semantic and grammatical structure levels of the sentences, for example, whether the sentence meaning has changed greatly or the grammatical structure has changed greatly. If there is a great change, it means that there is a conflict, and the step of selecting any second target candidate word corresponding to the second error word needs to be performed again, that is, another second target candidate word is selected to replace the second error word, until there is no conflict. Then, an accurate corrected text can be obtained. After the error word is replaced by the target candidate word, the conflict detection of the whole sentence can ensure that the corrected text after text correction has no great conflict with the original text, and the accuracy of text correction is ensured.

[0098] In an implementation manner of the embodiments of the present specification, the step of replacing the error word in the text to be corrected by the target candidate word to obtain the corrected text can be implemented in the following manner:

[0099] The error word in the text to be corrected is replaced by the target candidate word to obtain each corrected sentence.

[0100] The context of each corrected sentence is analyzed, and each corrected sentence is determined to form a corrected text when the analysis result meets a preset semantic condition.

[0101] After the error word in the text to be corrected is corrected as a whole, the overall semantic of the text can be affected. In order to more fully consider the context semantic dependency of the long text, the error word in the text to be corrected can be replaced by the target candidate word to obtain each corrected sentence. Then, the context of each corrected sentence is analyzed. The specific context analysis can be that each corrected sentence is input into a semantic analysis model to obtain the context semantic relationship between the sentences. When the analysis result meets a preset semantic condition, for example, the context semantic relationship between the sentences is greater than a preset threshold, each corrected sentence is determined to form a corrected text. By analyzing the context of each corrected sentence, the context semantic dependency of the long text can be more fully considered, and the text correction effect of the long text can be better.

[0102] By applying the embodiments of the present specification, the error text segments are identified by performing error detection on the text to be corrected, and each initial candidate word corresponding to the error word is obtained by recall. Then, according to the token information and pronunciation information corresponding to the error text segment, the probability that each initial candidate word is at the mask position in the error text segment is obtained by using the pre-trained language model combined with mask processing. The probability of each initial candidate word represents the accuracy of the text segment after the error word is replaced by the initial candidate word. The higher the probability of an initial candidate word, the higher the accuracy of the text obtained after the error word is replaced by the initial candidate word. Therefore, according to the probability of each initial candidate word, the target candidate word used to replace the error word can be determined. Then, the target candidate word is used to replace the error word in the text to be corrected, so that the accurate corrected text is obtained, and the accuracy of text correction is improved. Moreover, the pre-trained language model combined with mask processing improves the efficiency of text correction.

[0103] The following describes the text correction method provided in the present specification in conjunction with the accompanying Figure 4 The text correction method provided in the present specification is further described by taking the application of the text correction method in the speech recognition scene as an example. Specifically, Figure 4 FIG. 1 shows a process flow diagram of a text correction method according to an embodiment of the present specification, which specifically includes the following steps.

[0104] Step 1: Perform recognition on the input long audio data to obtain a text recognition result of the long audio.

[0105] Step 2: Preprocess the text recognition result of the long audio. The preprocessing mainly includes the steps of word segmentation, part-of-speech tagging, keyword extraction, and sentence splicing. The specific implementation of word segmentation, part-of-speech tagging, keyword extraction, and sentence splicing can be found in the embodiment shown in FIG. 2, which is not described herein again. Figure 1

[0106] Step 3: Perform error detection on each sentence. The error detection methods mainly include the methods based on a hot word list, a correction word pair, and an error detection model. The specific implementation of the methods based on the hot word list, the correction word pair, and the error detection model can be found in the embodiment shown in FIG. 3, which is not described herein again. Figure 1

[0107] Step 4: After the error text segments are determined, perform candidate word recall on the error words in the error text segments. The candidate word recall methods mainly include the methods of a general word list, a model recall, a keyword / correction word pair / hot word list, and the like, and the near sound restriction can be combined during the candidate word recall. The specific implementation of the candidate word recall can be found in the embodiment shown in FIG. 4, which is not described herein again. Figure 1

[0108] ​​​Step 5: According to the word feature information of the recalled candidate words, the LR algorithm is used to preliminarily sort all the recalled candidate words, and extract each initial candidate word in each recalled candidate word whose key degree is greater than a preset threshold. The word feature information can include mask probability, part-of-speech information, word frequency information, text correlation degree information, pronunciation similarity, whether it is a hot word, etc. The specific implementation of the preliminary sorting can be seen from the embodiment shown in Figure 1 and will not be described here.

[0109] Step 6: Further fine sorting is performed on each initial candidate word, mainly using the pre-trained MLM model to obtain the probability of each initial candidate word, and determining the initial candidate word whose probability is greater than a preset probability threshold as a target candidate word according to the probability of each initial candidate word.

[0110] Step 7: Post-processing. The post-processing mainly includes conflict detection and full-text context analysis. The conflict detection is that for any sentence, a target candidate word corresponding to a wrong word in the sentence is selected, the target candidate word is used to replace the corresponding wrong word to obtain a corrected sentence corresponding to the sentence, and then the obtained corrected sentence is subjected to conflict detection with the original sentence. If there is a conflict, a target candidate word is extracted again to replace the wrong word until a target candidate word without conflict is found. The full-text context analysis is that the target candidate word is used to replace the wrong word in the text to be corrected to obtain each corrected sentence, and the context analysis is performed on each corrected sentence. If the analysis result meets the preset semantic condition, it is determined that each corrected sentence forms a corrected text. The specific process of the above conflict detection and full-text context analysis can be seen from the embodiment shown in Figure 1 and will not be described here.

[0111] Using the above scheme, for the input long audio text recognition result "like the word card class, it is not limited to banks, in fact, including small loan companies are also selfies, he is a regular through the agency issued that kind of license to operate this way", after correction, the corrected text "like the word card class, it is not limited to banks, in fact, including small loan companies are also word card, he is a regular through the agency issued that kind of license to operate this way" can be obtained. For example, for the input long audio text recognition result "there is an American option, when is it beneficial to me, I choose to exercise the American option, or say case loan, when is it beneficial to the borrower, pay off the mortgage loan", after correction, the corrected text "there is an American option, when is it beneficial to me, I choose to exercise the American option, or say mortgage loan, when is it beneficial to the borrower, pay off the mortgage loan" can be obtained.

[0112] Corresponding to the above method embodiment, the present specification also provides a text correction device embodiment, Figure 5A structural schematic diagram of a text error correction apparatus provided by one embodiment of the present specification is shown. As shown in Figure 5 The apparatus comprises:

[0113] An error detection module 520 is configured to obtain a text to be corrected, perform error detection on the text to be corrected, and determine an error text segment containing a wrong word.

[0114] A recall module 540 is configured to perform candidate word recall on the wrong word, determine each initial candidate word corresponding to the wrong word, and obtain token information and pronunciation information corresponding to the error text segment, wherein the token information is obtained by performing mask processing on the wrong word in the error text segment.

[0115] A probability calculation module 560 is configured to input the token information, the pronunciation information, and each initial candidate word into a pre-trained language model to obtain a probability that each initial candidate word is at a mask position in the error text segment, wherein the language model is obtained by performing mask-form training on a specific word in a first corpus sample based on the first corpus sample and pronunciation information of the first corpus sample.

[0116] An error correction module 580 is configured to determine a target candidate word according to the probability of each initial candidate word, replace the wrong word in the text to be corrected with the target candidate word, and obtain a corrected text.

[0117] According to the present specification, by performing error detection on the text to be corrected, the error text segment is identified, each initial candidate word corresponding to the wrong word is obtained through recall, and then according to the token information and pronunciation information corresponding to the error text segment, the pre-trained language model is combined with mask processing to obtain the probability that each initial candidate word is at the mask position in the error text segment. The probability of each initial candidate word represents the accuracy of the text segment after the wrong word is replaced by the initial candidate word. The higher the probability of an initial candidate word, the higher the accuracy of the text obtained by replacing the wrong word with the initial candidate word. According to the probability of each initial candidate word, the target candidate word used to replace the wrong word can be determined, and then the target candidate word is used to replace the wrong word in the text to be corrected, so that an accurate corrected text is obtained, the accuracy of text error correction is improved, and the efficiency of text error correction is improved by using the pre-trained language model combined with mask processing.

[0118] Optionally, the error detection module 520 is further configured to obtain audio data, and identify the audio data to obtain the text to be corrected.

[0119] Optionally, the apparatus further comprises:

[0120] A preprocessing module is configured to preprocess the text to be corrected to obtain each sentence in the text to be corrected.

[0121] The error detection module 520 is further configured to perform error detection on each sentence respectively to determine an error text segment containing a wrong word in each sentence.

[0122] Optionally, the error detection module 520 is further configured to obtain pronunciation information of a first sentence, wherein the first sentence is any one of the sentences; input the first sentence and the pronunciation information into the pre-trained error detection model to obtain a correctness value of each word in the first sentence, wherein the error detection model is trained based on the second corpus sample and pronunciation information of the second corpus sample; determine a first wrong word in the first sentence according to the correctness value of each word; and determine a first error text segment composed of the first wrong word and a neighboring word of the first wrong word according to a preset text segment extraction manner.

[0123] Optionally, the error detection module 520 is further configured to determine a target word whose correctness value is less than a first preset threshold according to the correctness value of each word; find a target word phrase composed of the neighboring target words in a preset near sound restricted word list; and if the target word phrase is found, determine the target word phrase as the first wrong word in the first sentence.

[0124] Optionally, the recall module 540 is further configured to perform candidate word recall on the wrong word by using a preset candidate word recall manner; obtain first pronunciation information of the wrong word and second pronunciation information of each recalled candidate word, and determine a similarity between each second pronunciation information and the first pronunciation information; and obtain each primary candidate word whose similarity is greater than a second preset threshold.

[0125] Optionally, the recall module 540 is further configured to perform candidate word recall on the wrong word by using a preset candidate word recall manner; determine word feature information of each recalled candidate word based on the text to be corrected; and determine a key degree of each recalled candidate word by using a logistic regression algorithm according to the word feature information, and extract each primary candidate word whose key degree is greater than a third preset threshold from each recalled candidate word.

[0126] Optionally, the error correction module 580 is further configured to determine a primary candidate word whose probability is greater than a fourth preset threshold as a target candidate word according to the probability of each primary candidate word.

[0127] Optionally, the error correction module 580 is further configured to select any second target candidate word corresponding to a second wrong word in a second sentence from the second target candidate words corresponding to the second wrong word, wherein the second sentence is any one of the sentences; replace the second wrong word with the second target candidate word to obtain a corrected sentence corresponding to the second sentence; and perform conflict detection on the corrected sentence and the second sentence, and if there is a conflict, return to select any second target candidate word corresponding to the second wrong word.

[0128] Optionally, the error correction module 580 is further configured to replace the error word in the text to be corrected with the target candidate word to obtain each corrected sentence; and perform context analysis on each corrected sentence, and determine that the corrected sentences form the revised text when the analysis result meets a preset semantic condition.

[0129] The above is a schematic scheme of the text error correction device according to the embodiment. It should be noted that the technical scheme of the text error correction device belongs to the same concept as the technical scheme of the text error correction method described above, and the details of the technical scheme of the text error correction device that are not described in detail can be referred to the description of the technical scheme of the text error correction method.

[0130] Figure 6 A structural block diagram of a computing device according to one embodiment of the present specification is shown. The components of the computing device 600 include, but are not limited to, a memory 610 and a processor 620. The processor 620 is connected to the memory 610 through a bus 630, and a database 650 is used to save data.

[0131] The computing device 600 also includes an access device 640, which enables the computing device 600 to communicate via one or more networks 660. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 640 can include one or more of any type of network interface (for example, a network interface card (NIC)), such as a IEEE 802.11 wireless local area network (WLAN) wireless interface, a World Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and the like.

[0132] In one embodiment of the present specification, the above-mentioned components of the computing device 600 and other components not shown in the Figure 6 may be connected to each other, for example, through a bus. It should be understood that Figure 6The illustrated computing device structural block diagram is merely for the purpose of example, and is not a limitation on the scope of the present specification. Other components can be added or substituted as needed by those skilled in the art.

[0133] The computing device 600 can be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smartphone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or PC. The computing device 600 can also be a mobile or stationary server.

[0134] The processor 620 is configured to execute computer-executable instructions, which, when executed by the processor, implement the steps of the text correction method described above.

[0135] The above is a schematic scheme of the computing device of the embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the text correction method described above belong to the same concept, and the details of the technical scheme of the computing device that are not described in detail can be referred to the description of the technical scheme of the text correction method.

[0136] An embodiment of the present specification also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the steps of the text correction method described above.

[0137] The above is a schematic scheme of the computer-readable storage medium of the embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the text correction method described above belong to the same concept, and the details of the technical scheme of the storage medium that are not described in detail can be referred to the description of the technical scheme of the text correction method.

[0138] An embodiment of the present specification also provides a computer program, which, when executed in a computer, causes the computer to perform the steps of the text correction method described above.

[0139] The above is a schematic scheme of the computer program of the embodiment. It should be noted that the technical scheme of the computer program and the technical scheme of the text correction method described above belong to the same concept, and the details of the technical scheme of the computer program that are not described in detail can be referred to the description of the technical scheme of the text correction method.

[0140] The above-described embodiments of the application have several aspects, no single one of which is solely responsible for the application's desirable attributes. Without limiting the scope of the application as expressed by the claims which follow, some further embodiments make these aspects even more useful. Other embodiments can result in less desirable attributes.

[0141] The computer readable medium can include any entity or apparatus capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, software distribution medium, etc.

[0142] It should be noted that, for the foregoing method embodiments, the acts described can be performed in serial, parallel, or in some other order. In other words, the order of the acts of the embodiments can be modified without changing the underlying nature of the embodiments. Also, the embodiments described herein can be performed in a different order than the order described. Furthermore, some acts can be performed in a different order than the order described, or even at the same time. In addition, it should be noted that described acts can be carried out in one embodiment, but can be optional in other embodiments.

[0143] In the above-described embodiments, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.

[0144] The preferred embodiments of the present application disclosed above are only used to help explain the present application. The alternative embodiments do not describe all the details, nor limit the application to the specific embodiments described. Obviously, according to the content of the embodiments of the present application, many modifications and changes can be made. The present application selects and specifically describes these embodiments in order to better explain the principles and practical application of the embodiments of the present application, so that those skilled in the art can well understand and use the present application. The present application is limited only by the claims and their full scope and equivalents.

Claims

1. A text error correction method, comprising: obtaining a to-be-corrected text, and obtaining pronunciation information of a first sentence in the to-be-corrected text, wherein the first sentence is any one of sentences in the to-be-corrected text; inputting the first sentence and the pronunciation information into a pre-trained error detection model to obtain a correctness value of each word in the first sentence, wherein the error detection model is trained based on a second corpus sample and pronunciation information of the second corpus sample, and each word in the second corpus sample carries an identification of whether it is correct; determining a first wrong word in the first sentence according to the correctness value of each word; and determining a first error text segment composed of the first wrong word and a word adjacent to the first wrong word according to a preset text segment extraction manner, wherein the preset text segment extraction manner comprises extracting a preset number of words adjacent to the first wrong word to form the first error text segment. performing candidate word recall on a wrong word in the to-be-corrected text to determine each initial candidate word corresponding to the wrong word, and obtaining token information and pronunciation information corresponding to the first error text segment, wherein the token information is obtained by performing mask processing on the wrong word in the first error text segment, wherein the initial candidate word is obtained by obtaining second pronunciation information of a candidate word obtained through the candidate word recall, and performing similarity determination and screening on the second pronunciation information and first pronunciation information of the wrong word. inputting the token information, the pronunciation information, and the initial candidate words into a pre-trained language model to obtain a probability that each initial candidate word is at a mask position in the first error text segment, wherein the language model is trained based on a first corpus sample and pronunciation information of the first corpus sample, and a specific word in the first corpus sample is trained in a mask form. determining a target candidate word according to the probability of each initial candidate word, and replacing the wrong word in the to-be-corrected text with the target candidate word to obtain a corrected text.

2. The method of claim 1, wherein the obtaining a to-be-corrected text comprises: obtaining audio data; performing recognition on the audio data to obtain the to-be-corrected text.

3. The method of claim 1 or 2, wherein before the obtaining pronunciation information of a first sentence in the to-be-corrected text, the method comprises: performing preprocessing on the to-be-corrected text to obtain each sentence in the to-be-corrected text.

4. The method of claim 1, wherein the determining a first wrong word in the first sentence according to the correctness value of each word comprises: determining a target word whose correctness value is less than a first preset threshold according to the correctness value of each word; searching for a target word composed of adjacent target words in a preset near sound limit word table; if the target word is found, determining the target word as the first wrong word in the first sentence.

5. The method of claim 1, wherein the performing candidate word recall on a wrong word in the to-be-corrected text to determine each initial candidate word corresponding to the wrong word comprises: performing candidate word recall on the wrong word in the to-be-corrected text using a preset candidate word recall manner. obtaining first pronunciation information of the wrong word and second pronunciation information of each recalled candidate word, and determining similarity of each second pronunciation information and the first pronunciation information; obtaining each initial candidate word with similarity greater than a second preset threshold.

6. The method of claim 1, wherein the candidate word recall for the wrong word in the text to be corrected, and the determination of each initial candidate word corresponding to the wrong word, comprises: recalling candidate words for the wrong word in the text to be corrected by using a preset candidate word recall manner; determining word feature information of each recalled candidate word based on the text to be corrected; determining the key degree of each recalled candidate word by using a logistic regression algorithm according to the word feature information, and extracting each initial candidate word with a key degree greater than a third preset threshold from the recalled candidate words.

7. The method of claim 1, 5 or 6, wherein the determination of the target candidate word according to the probability of each initial candidate word comprises: determining an initial candidate word with a probability greater than a fourth preset threshold as the target candidate word according to the probability of each initial candidate word.

8. The method of claim 7, wherein the replacement of the wrong word in the text to be corrected by using the target candidate word comprises: selecting any second target candidate word corresponding to a second wrong word in a second sentence for the second wrong word, the second sentence being any sentence; replacing the second wrong word with the second target candidate word to obtain a corrected sentence corresponding to the second sentence; and performing conflict detection on the corrected sentence and the second sentence, and returning to the selection of any second target candidate word corresponding to the second wrong word if there is a conflict.

9. The method of claim 1 or 8, wherein the replacement of the wrong word in the text to be corrected by using the target candidate word to obtain a revised text comprises: replacing the wrong word in the text to be corrected with the target candidate word to obtain each corrected sentence; performing context analysis on the corrected sentences, and determining that the corrected sentences form a revised text if the analysis result meets a preset semantic condition.

10. A text correction device, comprising: an error detection module configured to obtain a text to be corrected, and obtain pronunciation information of a first sentence in the text to be corrected, wherein the first sentence is any sentence in each sentence in the text to be corrected; input the first sentence and the pronunciation information into a pre-trained error detection model to obtain a correctness value of each character in the first sentence, the error detection model is trained based on a second corpus sample and pronunciation information of the second corpus sample, each character in the second corpus sample carries an identification of whether it is correct; determine a first wrong word in the first sentence according to the correctness value of each character; and determine a first error text segment composed of the first wrong word and adjacent words of the first wrong word according to a preset text segment extraction manner, wherein the preset text segment extraction manner comprises extracting a first error text segment composed of the first wrong word and a preset number of adjacent words of the first wrong word. The recall module is configured to perform candidate word recall on the error word in the text to be corrected, determine each initial candidate word corresponding to the error word, and obtain token information and pronunciation information corresponding to the first erroneous text segment, the token information being obtained by performing mask processing on the error word in the first erroneous text segment, wherein the initial candidate word is obtained by obtaining second pronunciation information of the candidate word obtained through the candidate word recall, and performing similarity determination on the second pronunciation information and first pronunciation information of the error word and performing screening; The probability calculation module is configured to input the token information, the pronunciation information, and the initial candidate words into a pre-trained language model to obtain probabilities of the initial candidate words respectively at the mask position in the first erroneous text segment, and the language model is obtained by performing mask form training on a specific word in a first corpus sample based on the first corpus sample and pronunciation information of the first corpus sample. The error correction module is configured to determine a target candidate word according to the probabilities of the initial candidate words, replace the error word in the text to be corrected with the target candidate word, and obtain a corrected text.

11. A computing device comprising: a memory and a processor; the memory is configured to store computer executable instructions, and the processor is configured to execute the computer executable instructions, and the computer executable instructions, when executed by the processor, implement the steps of the text error correction method in any one of claims 1 to 9.

12. A computer readable storage medium storing computer executable instructions, and the computer executable instructions, when executed by a processor, implement the steps of the text error correction method in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Text error correction method and device

    CN112199945A

  • Text error correction method and device, medium and electronic equipment

    CN112784581A