Text correction methods, apparatus, computer equipment and storage media

By combining edit distance and similarity, and utilizing pre-defined standardized words and word vector models, the text content is gradually corrected, solving the problem of low accuracy in traditional text correction methods and achieving more efficient and accurate text correction.

CN117521640BActive Publication Date: 2026-11-17CHINA TELECOM CORP LTD TECHNOLOGY INNOVATION CENTER +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311345566.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-17
Publication Date
2026-11-17
Estimated Expiration
2043-10-17

AI Technical Summary

Technical Problem

Traditional text correction methods rely on synonym mapping relationships, resulting in low correction accuracy and an inability to handle text correction problems with large differences in character structure.

Method used

By combining edit distance and similarity, words in the text that need to be corrected are identified and corrected. A word network is constructed using pre-defined standard words and word vector models to gradually correct the text content.

Benefits of technology

It improves the flexibility and accuracy of text correction, reduces the risk of error propagation, and achieves more comprehensive and efficient text correction processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117521640B_ABST
    Figure CN117521640B_ABST
Patent Text Reader

Abstract

This application relates to a text correction method, apparatus, computer device, storage medium, and computer program product. The method includes: identifying a first word to be corrected in the text based on the edit distance between the segmented words of the text to be corrected and preset standard words; correcting the first word to be corrected in the text to be corrected according to the preset standard words to obtain an initial corrected text; and correcting a second word to be corrected in the initial corrected text based on the similarity between a second word to be corrected in the initial corrected text and the preset standard words to obtain a target corrected text; wherein the second word to be corrected is a word in the initial corrected text other than the corrected word of the first word to be corrected. Using this method can improve the accuracy of text correction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of text processing technology, and in particular to a text correction method, apparatus, computer equipment, storage medium, and computer program product. Background Technology

[0002] In production and daily life environments, we often encounter situations where different texts describe the same thing inconsistently, requiring the correction of a large amount of text data.

[0003] Traditional techniques primarily address this issue by using pre-built synonym mapping relationships to correct the text. However, this approach is limited by user-defined synonym mapping relationships, resulting in a somewhat one-sided text correction process. Furthermore, it cannot handle cases where words have similar meanings but significantly different or completely different character structures, leading to low accuracy in text correction. Summary of the Invention

[0004] Therefore, it is necessary to provide a text correction method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve the accuracy of text correction in order to address the above-mentioned technical problems.

[0005] Firstly, this application provides a text correction method, including:

[0006] Based on the edit distance between the word segmentation of the text to be corrected and the preset standard words, the first word to be corrected in the text to be corrected is identified from the word segmentation;

[0007] Based on the preset standard words, the first word to be corrected in the text to be corrected is corrected to obtain the initial corrected text of the text to be corrected;

[0008] Based on the similarity between the second word to be corrected in the initial correction text and the preset standard word, the second word to be corrected in the initial correction text is corrected to obtain the target correction text of the text to be corrected; the second word to be corrected is a word in the initial correction text other than the correction word of the first word to be corrected.

[0009] In one embodiment, identifying the first word to be corrected in the text to be corrected from the word segmentation based on the edit distance between the segmented words of the text to be corrected and the preset standardized words includes:

[0010] For any given word segment, the preset standard word with the smallest edit distance to that word segment is selected as the candidate correction word for that word segment.

[0011] Based on the edit distance between any word segment and the candidate correction word, and the number of characters in any word segment, the target edit ratio of any word segment is determined; the target edit ratio is used to represent the edit ratio corresponding to correcting any word segment into the candidate correction word;

[0012] If the target editing ratio is less than or equal to a preset editing ratio threshold, any one of the word segments is determined as the first word to be corrected in the text to be corrected;

[0013] The step of correcting the first word to be corrected in the text to be corrected according to the preset standard words, to obtain the initial corrected text of the text to be corrected, includes:

[0014] The first word to be corrected is corrected to the candidate word to be corrected, thus obtaining the initial corrected text of the text to be corrected.

[0015] In one embodiment, before correcting the second word to be corrected in the initial correction text based on the similarity between the second word to be corrected in the initial correction text and the preset standardized word, to obtain the target corrected text of the text to be corrected, the method further includes:

[0016] The second word to be corrected in the initial corrected text is determined, and a word network of the initial corrected text is constructed based on the adjacency relationship between the word segments of the initial corrected text.

[0017] Based on the word network, the preset standardized word vectors, and the pre-trained word vector model, the word vector of the second word to be corrected is obtained; the preset standardized word vector is the word vector corresponding to the preset standardized word.

[0018] The similarity between the second word to be corrected and the preset standardized word vector is determined based on the word vector of the second word to be corrected and the preset standardized word vector.

[0019] In one embodiment, obtaining the word vector of the second word to be corrected based on the word network, the preset standardized word vectors, and the pre-trained word vector model includes:

[0020] In the word network, word segments that have a connection relationship with the second word to be corrected and belong to the preset standard words are identified as adjacent standard words of the second word to be corrected.

[0021] The word vectors of the adjacent standardized words are determined from the preset standardized word vectors;

[0022] The word vectors of the adjacent standardized words are input into the pre-trained word vector model to obtain the word vector of the second word to be corrected.

[0023] In one embodiment, before obtaining the word vector of the second word to be corrected based on the word network, the preset canonical word vectors, and the pre-trained word vector model, the method further includes:

[0024] Word segments belonging to the preset standard words are selected from the word network and used as sample words;

[0025] From the word network, word segments that have a connection relationship with the sample word and belong to the preset standard words are identified as adjacent standard words of the sample word;

[0026] The word vectors of the adjacent standard words of the sample word are input into the word vector model to be trained to obtain the predicted word vector of the sample word.

[0027] Based on the predicted word vectors and the actual word vectors of the sample words, the word vector model to be trained is iteratively trained to obtain the pre-trained word vector model; the word vectors of the adjacent standard words of the sample words and the actual word vectors of the sample words are both obtained by querying the preset standard word vectors.

[0028] In one embodiment, the step of correcting the second word to be corrected in the initial corrected text based on the similarity between the second word to be corrected in the initial corrected text and the preset standardized word, to obtain the target corrected text of the text to be corrected, includes:

[0029] From the preset standardized words, the target standardized word with the highest similarity to the second word to be corrected is determined;

[0030] If the similarity between the second word to be corrected and the target standardized word is greater than a preset similarity threshold, the second word to be corrected in the initial corrected text is corrected to the target standardized word, thus obtaining the target corrected text of the text to be corrected.

[0031] In one embodiment, before correcting the second word to be corrected in the initial correction text based on the similarity between the second word to be corrected in the initial correction text and the preset standardized word, to obtain the target corrected text of the text to be corrected, the method further includes:

[0032] From the word network of the initial corrected text, select any two word segments with the same connection relationship;

[0033] If the first word in any two word segments belongs to the preset standard word and the second word does not belong to the preset standard word, the second word in the initial corrected text is corrected to the corresponding first word to obtain the processed initial corrected text;

[0034] The step of correcting the second word to be corrected in the initial corrected text based on the similarity between the second word to be corrected in the initial corrected text and the preset standardized words, to obtain the target corrected text of the text to be corrected, further includes:

[0035] Based on the similarity between the second word to be corrected in the processed initial corrected text and the preset standard words, the second word to be corrected in the processed initial corrected text is corrected to obtain the target corrected text of the text to be corrected; the second word to be corrected in the processed initial corrected text is the word in the processed initial corrected text other than the corrected word of the first word to be corrected and the first word segmentation.

[0036] Secondly, this application also provides a text correction device, comprising:

[0037] The word recognition module is used to identify the first word to be corrected in the text to be corrected from the word segmentation based on the edit distance between the word segmentation of the text to be corrected and the preset standard words;

[0038] The first correction module is used to correct the first word to be corrected in the text to be corrected according to the preset standard words, so as to obtain the initial corrected text of the text to be corrected.

[0039] The second correction module is used to correct the second word to be corrected in the initial correction text based on the similarity between the second word to be corrected in the initial correction text and the preset standard words, so as to obtain the target correction text of the text to be corrected; the second word to be corrected is a word in the initial correction text other than the correction word of the first word to be corrected.

[0040] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0041] Based on the edit distance between the word segmentation of the text to be corrected and the preset standard words, the first word to be corrected in the text to be corrected is identified from the word segmentation;

[0042] Based on the preset standard words, the first word to be corrected in the text to be corrected is corrected to obtain the initial corrected text of the text to be corrected;

[0043] Based on the similarity between the second word to be corrected in the initial correction text and the preset standard word, the second word to be corrected in the initial correction text is corrected to obtain the target correction text of the text to be corrected; the second word to be corrected is a word in the initial correction text other than the correction word of the first word to be corrected.

[0044] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:

[0045] Based on the edit distance between the word segmentation of the text to be corrected and the preset standard words, the first word to be corrected in the text to be corrected is identified from the word segmentation;

[0046] Based on the preset standard words, the first word to be corrected in the text to be corrected is corrected to obtain the initial corrected text of the text to be corrected;

[0047] Based on the similarity between the second word to be corrected in the initial correction text and the preset standard word, the second word to be corrected in the initial correction text is corrected to obtain the target correction text of the text to be corrected; the second word to be corrected is a word in the initial correction text other than the correction word of the first word to be corrected.

[0048] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:

[0049] Based on the edit distance between the word segmentation of the text to be corrected and the preset standard words, the first word to be corrected in the text to be corrected is identified from the word segmentation;

[0050] Based on the preset standard words, the first word to be corrected in the text to be corrected is corrected to obtain the initial corrected text of the text to be corrected;

[0051] Based on the similarity between the second word to be corrected in the initial correction text and the preset standard word, the second word to be corrected in the initial correction text is corrected to obtain the target correction text of the text to be corrected; the second word to be corrected is a word in the initial correction text other than the correction word of the first word to be corrected.

[0052] The aforementioned text correction method, apparatus, computer equipment, storage medium, and computer program product first identify the first word to be corrected in the text based on the edit distance between the segmented words of the text to be corrected and the preset standard words. Then, based on the preset standard words, the first word to be corrected in the text to be corrected is corrected to obtain the initial corrected text. This method does not require setting static synonym relationships; instead, it uses preset standard words and edit distance to more comprehensively correct the text, including but not limited to synonyms, thus improving the flexibility and versatility of the correction process. Next, based on the similarity between the second word to be corrected in the initial corrected text and the preset standard words, the second word to be corrected in the initial corrected text is corrected to obtain the target corrected text. The second word to be corrected is any word in the initial corrected text other than the corrected word for the first word to be corrected. The correction process can obtain similarity based on context and word characteristics to complete text correction, rather than relying solely on a fixed synonym mapping table, further improving the accuracy of correction and the contextual adaptability of the text. Meanwhile, the stepwise correction process effectively reduces the risk of error propagation. In each step, correction is based on already corrected text, allowing for more efficient and accurate subsequent correction operations. The method described above, by pre-setting standardized words, edit distance, and similarity based on context and word characteristics, ensures that text correction is not limited to synonym mapping relationships, achieving more comprehensive and accurate text correction processing. Furthermore, the stepwise correction process using multiple methods yields more efficient and accurate text correction results. Attached Figure Description

[0053] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0054] Figure 1 This is a flowchart illustrating a text correction method in one embodiment;

[0055] Figure 2 This is a flowchart illustrating the similarity determination steps in one embodiment;

[0056] Figure 3 Here is an example diagram of a word network in one embodiment;

[0057] Figure 4 This is a flowchart illustrating the text correction method in another embodiment;

[0058] Figure 5is a schematic flowchart of a text correction method based on a graph structure and a graph neural network in an embodiment;

[0059] Figure 6 is a structural block diagram of a text correction apparatus in an embodiment;

[0060] Figure 7 is an internal structural diagram of a computer device in an embodiment. DETAILED DESCRIPTION

[0061] To make the objectives, technical solutions and advantages of the present application more clearly understood, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely used to explain the present application and are not intended to limit the present application.

[0062] In an exemplary embodiment, as shown in Figure 1 , a text correction method is provided. This embodiment takes the application of the method to a terminal as an example for illustration. It can be understood that the method may also be applied to a server, or to a system including a terminal and a server, and is implemented through interaction between the terminal and the server. The terminal may be, but is not limited to, various personal computers, notebook computers, smartphones and tablet computers. The server may be implemented as an independent server or a server cluster composed of a plurality of servers. In this embodiment, the method includes the following steps:

[0063] Step S101: Identify a first to-be-corrected word in the to-be-corrected text from segmented words according to the edit distance between the segmented words of the to-be-corrected text and preset standard words.

[0064] The edit distance is a quantitative measure of the degree of difference between two character strings (such as English characters). The measurement method is to check the minimum number of operations required to convert one character string into another character string, including replacement, insertion and deletion operations. For example, converting "Ni Hao" to "Nin Hao" requires at least one replacement operation, so the edit distance between these two words is 1.

[0065] The to-be-corrected text includes at least one document.

[0066] For example, the terminal first performs word segmentation on the text to be corrected based on natural language processing technology, obtaining the word segments of the text to be corrected. The text to be corrected may include Chinese characters and English characters. Then, the terminal needs to determine the edit distance between each word segment and each preset standard word. Since it is not necessary to pre-set the synonym mapping relationship of the preset standard words, the preset standard words with the smallest edit distance to the word segment are directly selected as candidate correction words for the word segmentation. At the same time, in order to avoid the problem of over-correction, it is necessary to filter out the word segments that meet the preset edit ratio threshold set by the user as the first words to be corrected. In addition, for the word segments of the text to be corrected that belong to the preset standard words, they can be excluded from the first words to be corrected before determining the edit distance; or, after determining the edit distance of all word segments, the word segments with an edit distance of 0 can be excluded from the first words to be corrected.

[0067] Step S102: According to the preset standard words, the first word to be corrected in the text to be corrected is corrected to obtain the initial corrected text of the text to be corrected.

[0068] For example, after determining the first word to be corrected, the terminal replaces the first word to be corrected in the text to be corrected with the candidate correction word determined in step S101, thereby obtaining the initial corrected text of the text to be corrected.

[0069] Step S103: Based on the similarity between the second word to be corrected in the initial correction text and the preset standard words, the second word to be corrected in the initial correction text is corrected to obtain the target correction text of the text to be corrected.

[0070] Among them, the second word to be corrected is the word in the initial correction text that is not corrected in addition to the word to be corrected in the first word to be corrected.

[0071] For example, the terminal identifies the second word to be corrected in the initial correction text based on word segmentation. Then, through natural language processing, it determines the feature information of the second word to be corrected based on contextual relationships, word characteristics, etc., and determines the similarity between the second word to be corrected and the preset standard words based on the feature information of the second word to be corrected and the preset standard words. Finally, the terminal performs correction processing on the second word to be corrected in the initial correction text based on the similarity and the preset standard words, obtaining the target corrected text of the text to be corrected.

[0072] In the aforementioned text correction method, firstly, based on the edit distance between the segmented words of the text to be corrected and the preset standard words, the first word to be corrected in the text to be corrected is identified from the segmented words. Then, based on the preset standard words, the first word to be corrected in the text to be corrected is corrected, resulting in the initial corrected text. This method does not require setting static synonym relationships; instead, it uses preset standard words and edit distance to more comprehensively correct the text, including but not limited to synonyms, thus improving the flexibility and versatility of the correction process. Next, based on the similarity between the second word to be corrected in the initial corrected text and the preset standard words, the second word to be corrected in the initial corrected text is corrected, resulting in the target corrected text. The second word to be corrected is any word in the initial corrected text other than the corrected word for the first word to be corrected. The correction process can obtain similarity based on context and word characteristics, thereby completing the text correction, rather than solely relying on a fixed synonym mapping table, further improving the accuracy of the correction and the contextual adaptability of the text. Meanwhile, the stepwise correction process effectively reduces the risk of error propagation. In each step, correction is based on already corrected text, allowing for more efficient and accurate subsequent correction operations. The method described above, by pre-setting standardized words, edit distance, and similarity based on context and word characteristics, ensures that text correction is not limited to synonym mapping relationships, achieving more comprehensive and accurate text correction processing. Furthermore, the stepwise correction process using multiple methods yields more efficient and accurate text correction results.

[0073] In an exemplary embodiment, step S101, which identifies the first word to be corrected in the text to be corrected from the word segments based on the edit distance between the word segments and the preset standard words, further includes: for any word segment, selecting the preset standard word with the smallest edit distance from any word segment as a candidate correction word for any word segment; determining the target edit ratio of any word segment based on the edit distance between any word segment and the candidate correction word, and the number of characters in any word segment; the target edit ratio is used to represent the edit ratio corresponding to correcting any word segment into a candidate correction word.

[0074] Specifically, if the target editing ratio is less than or equal to the preset editing ratio threshold, any word segment will be identified as the first word to be corrected in the text to be corrected.

[0075] Furthermore, in an exemplary embodiment, step S102, which corrects the first word to be corrected in the text to be corrected according to preset standard words to obtain the initial corrected text of the text to be corrected, further includes: correcting the first word to be corrected into a candidate corrected word to obtain the initial corrected text of the text to be corrected.

[0076] Exemplarily, the terminal needs to determine the edit distance between the target segmented word and each preset standard word. Since there is no need to pre-set the synonym mapping relationship of the preset standard words, the preset standard word with the smallest edit distance from the target segmented word is directly selected as the candidate correction word for the target segmented word. At the same time, in order to avoid the problem of over-correction, it is necessary to screen out the target segmented words that meet the preset edit ratio threshold set by the user as the first to-be-corrected words. That is, first calculate the ratio between the edit distance between the target text segmented word and the candidate correction word and the number of characters of the target segmented word as the target edit ratio, and then when the target edit ratio is less than or equal to the preset edit ratio threshold, the target segmented word is determined as one first to-be-corrected word in the to-be-corrected text. In addition, for the segmented words of the to-be-corrected text that belong to the preset standard words, they can be excluded from the first to-be-corrected words before the edit distance is determined; alternatively, after the edit distances of all segmented words are determined, the segmented words with an edit distance of 0 can be excluded from the first to-be-corrected words. Finally, the terminal replaces the first to-be-corrected word with the corresponding candidate correction word to obtain the initial corrected text of the to-be-corrected text.

[0077] As an example, the segmented word in the to-be-corrected text is "ab", and the preset standard words include "ac" and "cd". Then, the number of steps required to convert "ab" to "ac" is 1, and the number of steps required to convert "ab" to "cd" is 2, so "ac" should be determined as the candidate correction word for "ab".

[0078] However, correcting text solely based on a single edit distance may lead to the problem of over-correction: the segmented word "reason" appears in the to-be-corrected text, and there is no such segmented word or its synonyms (such as "cause", "origin") in the preset standard words. Then the edit distance required to convert "reason" into any two-character word in the preset standard words is 2, so the terminal will correct the word "reason" to any two-character word in the preset standard words. To this end, the terminal needs to calculate the target edit ratio for converting "reason" into a two-character word in the preset standard words, which is 2 / 2 = 100% (edit distance / number of characters of "reason"). When the preset edit ratio threshold is set to 70%, the terminal will not convert "reason" to any two-character word in the preset standard words.

[0079] In this embodiment, firstly, the candidate standard words are directly determined from the preset standard words based on the edit distance, which can avoid the limitation of the synonym mapping relationship and perform text correction more comprehensively. At the same time, by calculating the target edit ratio and screening out the first to-be-corrected words based on the preset edit ratio threshold, the replacement of irrelevant words is restricted, the problem of over-correction is avoided, and the accuracy of text correction is improved.

[0080] In an exemplary embodiment, as Figure 2As shown, before step S103, which corrects the second word to be corrected in the initial correction text based on the similarity between the second word to be corrected and the preset standard words, to obtain the target correction text, a similarity determination step is also included, specifically including the following steps:

[0081] Step S201: Determine the second word to be corrected in the initial correction text, and construct the word network of the initial correction text based on the adjacency relationship between the word segments of the initial correction text;

[0082] Step S202: Based on the word network, preset standardized word vectors, and pre-trained word vector model, obtain the word vector of the second word to be corrected;

[0083] Step S203: Determine the similarity between the second word to be corrected and the preset standard word based on the word vector of the second word to be corrected and the preset standard word vector.

[0084] Among them, the preset standard word vector is the word vector corresponding to the preset standard words. It can be obtained by performing one-hot encoding on the preset standard words. That is, each preset standard word represents a vector dimension, and the preset standard word vector of each preset standard word is a vector with the corresponding dimension as 1 and the values ​​of other dimensions as 0.

[0085] For example, the terminal constructs a word network for the initial correction text based on the word segmentation and the adjacency relationships between the segments. That is, each distinct word segment in the initial correction text is treated as a network node in the word network; then, if two words are adjacent in the initial correction text, the network nodes corresponding to these two words are connected in the word network. Next, the terminal processes the word network, describing the feature information of each network node through direct or indirect connections between the network nodes. Specifically, based on the word network, preset standardized word vectors, and a pre-trained word vector model, the terminal obtains the word vector of the second word to be corrected. Finally, the terminal uses the dot product between the word vector of the second word to be corrected and the preset standardized word vector as the similarity between the second word to be corrected and the preset standardized word.

[0086] In this embodiment, first, by constructing a word network, the adjacent relationships between segmented words in the initially corrected text can be effectively captured, so that more contextual information is obtained, which helps to more accurately understand the position and semantic features of each segmented word in the text. By mapping the second to-be-corrected word into the word vector space constructed by preset standard words, the second to-be-corrected word can be compared with the preset standard word vectors to quantify the similarity between them, which more accurately reflects the semantic relationship between the second to-be-corrected word and the standard word, makes the decision more reliable, and helps to improve the accuracy of text correction. In addition, in this way, words between different languages can also be corrected, for example, correcting "Apple" to "苹果".

[0087] In an exemplary embodiment, the above step S202, obtaining the word vector of the second to-be-corrected word according to the word network, the preset standard word vectors and the pre-trained word vector model, further includes: in the word network, determining segmented words that have a connection relationship with the second to-be-corrected word and belong to the preset standard words, as adjacent standard words of the second to-be-corrected word; determining the word vectors of the adjacent standard words from the preset standard word vectors; inputting the word vectors of the adjacent standard words into the pre-trained word vector model to obtain the word vector of the second to-be-corrected word.

[0088] Exemplarily, the terminal determines, according to the word network, segmented words that have a connection relationship with the second to-be-corrected word and belong to the preset standard words, as adjacent standard words of the second to-be-corrected word. Then, the preset standard word vectors corresponding to the adjacent standard words of the second to-be-corrected word are used to jointly describe the second to-be-corrected word, that is, the word vectors of the adjacent standard words are input into the pre-trained word vector model to obtain the word vector of the second to-be-corrected word.

[0089] For example, a certain second to-be-corrected word is u. In the word network, according to the connection line of point u, expanding one layer outward from point u to obtain the points among the adjacent points that belong to the preset standard words, which are recorded as Then based on the Mean Aggregator, the features of the points (i.e., the preset standard vectors) are aggregated to obtain the aggregation feature A(u) of point u (i.e., the word vector of the second to-be-corrected word).

[0090]

[0091] Wherein, σ(·) is a nonlinear transformation function, for example, σ(x)=1 / (1+e -x ), W is the weight matrix to be learned, and mean(·) represents calculating the mean value of the vectors.

[0092] In this embodiment, by determining the adjacent standardized words of the second word to be corrected, and obtaining the word vectors of the adjacent standardized words from the preset standardized word vectors, the word vectors of the adjacent standardized words contain the semantic information of the preset standardized words, which can better understand the semantic relationship between the preset standardized words and the word to be corrected in the text. Then, by aggregating the word vectors of the adjacent standardized words, the contextual information of the second word to be corrected and the semantic information of the adjacent standardized words can be integrated to more comprehensively understand the semantics of the second word to be corrected. This allows the correction process to more intelligently determine whether correction is needed and how to correct the second word to be corrected based on the context and the semantics of the preset standardized words.

[0093] In an exemplary embodiment, before obtaining the word vector of the second word to be corrected based on the word network, preset standard word vectors, and pre-trained word vector model in step S202, the method further includes: selecting word segments belonging to preset standard words from the word network as sample words; determining word segments that have a connection relationship with the sample words and belong to preset standard words from the word network as adjacent standard words of the sample words; inputting the word vectors of the adjacent standard words of the sample words into the word vector model to be trained to obtain the predicted word vector of the sample words; and iteratively training the word vector model to be trained based on the predicted word vector of the sample words and the true word vector of the sample words to obtain the pre-trained word vector model.

[0094] The word vectors of adjacent standard words of the sample words and the actual word vectors of the sample words are both obtained by querying the preset standard word vectors.

[0095] For example, before obtaining the word vector of the second word to be corrected, the terminal needs to train a pre-trained word vector model. Based on the word network, the terminal determines the word segments belonging to preset standard words as sample words. Then, the terminal determines the word segments from the word network that have a connection relationship with the sample words and belong to preset standard words as adjacent standard words of the sample words. Then, similar to obtaining the word vector of the second word to be corrected, the word vectors of the adjacent standard words of the sample words are input into the word vector model to be trained to obtain the predicted word vector of the sample words. The loss function of the word vector model during training can be the mean squared error (MSE) or mean absolute error (MAE) between the predicted word vectors and the true vectors of the sample words. Based on the loss function, the terminal iteratively trains the word vector model to be trained, thereby obtaining the pre-trained word vector model.

[0096] For example, if a sample word is 'a', in the word network, based on the lines connecting point 'a', one layer is expanded outward from point 'a' to obtain the points among the adjacent points that belong to the preset standard words, denoted as 'a'. Then, based on the Mean Aggregator, for The features of points (i.e., predefined normalized vectors) are aggregated to obtain the aggregated features of point a. (i.e., predicting word vectors).

[0097]

[0098] Where σ(·) is a nonlinear transformation function, for example σ(x)=1 / (1+e -x ), W i Let W0 be the weight matrix during the training process (where W0 is the initial weight matrix), and mean(·) represents the mean of the vector.

[0099] Then, through calculation With the true vector v of point a a MSE as the loss function:

[0100]

[0101] Where ||·||2 represents the L2 norm.

[0102] In this embodiment, the word vector model to be trained is trained using the text to be corrected. The training process does not require additional training data, making it convenient and quick to complete the model training. Furthermore, the pre-trained word vector model obtained is more targeted to the text to be corrected, improving the versatility of text correction, especially for the correction processing of texts to be corrected that include multiple strongly related documents.

[0103] In an exemplary embodiment, step S103 above, which corrects the second word to be corrected in the initial correction text based on the similarity between the second word to be corrected in the initial correction text and the preset standard words, to obtain the target correction text of the text to be corrected, further includes: determining the target standard word with the highest similarity to the second word to be corrected from the preset standard words; and correcting the second word to be corrected in the initial correction text to the target standard word if the similarity between the second word to be corrected and the target standard word is greater than a preset similarity threshold, to obtain the target correction text of the text to be corrected.

[0104] For example, the terminal calculates the similarity between the second word to be corrected and all preset standard words to determine the target standard word with the highest similarity. Then, the terminal needs to determine whether the similarity between the second word to be corrected and the target standard word reaches a preset similarity threshold. If it does, the second word to be corrected in the initial correction text is corrected to the target standard word; otherwise, no correction is performed on the second word to be corrected in the initial correction text. Based on the similarity threshold, this avoids the situation where the target standard word with the highest similarity is still a replacement word unrelated to the second word to be corrected.

[0105] In this embodiment, by finding the target standardized word with the highest similarity and correcting it according to the similarity threshold setting, it is possible to more accurately determine whether to correct the second word to be corrected, thereby improving the accuracy of the correction.

[0106] In an exemplary embodiment, before step S103, which corrects the second word to be corrected in the initial correction text based on the similarity between the second word to be corrected in the initial correction text and the preset standard words, to obtain the target correction text, the method further includes: selecting any two word segments with the same connection relationship from the word network of the initial correction text; and correcting the second word segment in the initial correction text to the corresponding first word segment if the first word segment in any two word segments belongs to the preset standard words and the second word segment does not belong to the preset standard words, thereby obtaining the processed initial correction text.

[0107] Further, in an exemplary embodiment, step S103 above, which corrects the second word to be corrected in the initial correction text based on the similarity between the second word to be corrected in the initial correction text and the preset standard words, to obtain the target correction text of the text to be corrected, further includes: correcting the second word to be corrected in the processed initial correction text based on the similarity between the second word to be corrected in the processed initial correction text and the preset standard words, to obtain the target correction text of the text to be corrected.

[0108] The second word to be corrected in the processed initial correction text refers to the words in the processed initial correction text other than the corrected word of the first word to be corrected and the first word segmentation.

[0109] In this context, the "first" and "second" in the first and second participles do not indicate order information; they merely serve to distinguish nouns.

[0110] For example, before performing similarity-based correction, the terminal can pre-correct the initial correction text based on the context of the words. The terminal constructs a corresponding word network based on the word segmentation of the initial correction text and filters out any two word segments with completely identical connections from the word network. If one of these two word segments belongs to a preset standard word (denoted as A), and the other does not belong to a preset standard word (denoted as B), the word segment B in the initial correction text is corrected to the corresponding word segment A, resulting in the processed initial correction text. Subsequent text correction processing based on similarity can be performed based on this processed initial correction text.

[0111] For example, such as Figure 3 As shown, points A and B have the same connection in the word network, so the usage contexts of the word segments corresponding to these two points are basically the same and they can be substituted for each other.

[0112] In this embodiment, the above method achieves better correction accuracy when the text to be corrected contains sufficient textual information, especially for texts with multiple strongly related documents, correcting multiple non-standard expressions of the same object. Furthermore, this method can be considered a more stringent, yet more efficient, similarity-based correction process, reducing subsequent similarity-based correction steps and thus improving overall correction efficiency.

[0113] In another exemplary embodiment, such as Figure 4 As shown, this application also provides a text correction method, which includes the following steps:

[0114] Step S401: For any word segment of the text to be corrected, the preset standard word with the smallest edit distance to any word segment is selected as the candidate correction word for any word segment.

[0115] Step S402: Determine the target editing ratio of any word segment based on the editing distance between any word segment and the candidate correction words, and the number of characters in any word segment.

[0116] The target edit ratio is used to represent the edit ratio corresponding to correcting any word segment into a candidate corrected word.

[0117] Step S403: If the target editing ratio is less than or equal to the preset editing ratio threshold, any word segment is identified as the first word to be corrected in the text to be corrected.

[0118] Step S404: Correct the first word to be corrected into a candidate word to be corrected, and obtain the initial corrected text of the text to be corrected.

[0119] Step S405: Select any two word segments with the same connection relationship from the word network of the initial correction text.

[0120] In step S406, if the first segment of any two segmented words belongs to a preset standard word and the second segment does not belong to a preset standard word, the second segment in the initial correction text is corrected to the corresponding first segment to obtain the processed initial correction text, which is then used as the initial correction text for subsequent steps.

[0121] Step S407: Construct a word network for the initial corrected text based on the adjacency relationships between the word segments of the initial corrected text.

[0122] Step S408: Select word segments belonging to preset standard words from the word network as sample words, and determine word segments that have a connection relationship with the sample words and belong to preset standard words from the word network as adjacent standard words of the sample words.

[0123] Step S409: Input the word vectors of the adjacent standard words of the sample word into the word vector model to be trained to obtain the predicted word vector of the sample word.

[0124] Step S410: Based on the predicted word vectors and the actual word vectors of the sample words, iteratively train the word vector model to be trained to obtain the pre-trained word vector model.

[0125] The word vectors of adjacent standard words of the sample words and the actual word vectors of the sample words are both obtained by querying the preset standard word vectors.

[0126] Step S411: Determine the second word to be corrected in the initial correction text, and in the word network, determine the word segments that have a connection relationship with the second word to be corrected and belong to the preset standard words, as the adjacent standard words of the second word to be corrected.

[0127] Among them, the second word to be corrected is the word in the initial correction text other than the corrected word of the first word to be corrected and the first segmentation.

[0128] Step S412: Determine the word vectors of adjacent standardized words from the preset standardized word vectors, and input the word vectors of adjacent standardized words into the pre-trained word vector model to obtain the word vector of the second word to be corrected.

[0129] Step S413: Determine the similarity between the second word to be corrected and the preset standard word based on the word vector of the second word to be corrected and the preset standard word.

[0130] Step S414: From the preset standard words, determine the target standard word with the highest similarity to the second word to be corrected.

[0131] Step S415: If the similarity between the second word to be corrected and the target standardized word is greater than the preset similarity threshold, the second word to be corrected in the initial corrected text is corrected to the target standardized word, thus obtaining the target corrected text of the text to be corrected.

[0132] In this embodiment, a simple method with a preset editing ratio threshold is used to limit the conversion of irrelevant words, thereby improving the accuracy of the correction and completing the initial correction work. Then, based on a word network, the semantic relationships of the word segments in the text to be corrected are described using adjacency network nodes. By calculating the similarity between the word vectors of the words to be corrected and the preset standard word vectors, the final correction result is obtained quickly and accurately, effectively improving the efficiency of text correction. Specifically, when obtaining the semantic relationships describing the word segments in the text to be corrected, an average aggregation method is used to obtain the word vectors of the words to be corrected. This method does not require additional training data and is entirely based on the text to be corrected and the preset standard words, making it convenient, fast, and more targeted.

[0133] In an exemplary embodiment, to more clearly illustrate the text correction method provided in this application, the following specific embodiment will be used to describe the text correction method in detail. In one embodiment, as follows... Figure 5 As shown, this application also provides a text correction method based on graph structure and graph neural network, which specifically includes the following steps:

[0134] Step S501: Tokenization and definition of benchmark documents.

[0135] The documents to be processed are usually composed of paragraphs of natural language descriptions, so they need to be segmented into words beforehand using a word segmentation tool.

[0136] Step S502: Correct the text based on the edit distance technique with a limit on the number of transformation steps.

[0137] In this step, this application performs preliminary correction on the words in all documents to be processed based on edit distance. Simply put, the edit distance between two words refers to the number of steps required to transform one word into another.

[0138] Step S503: Correct text based on graph structure.

[0139] In step S502, each distinct word appearing in all documents is considered a distinct point. If two words appear in the same document, the corresponding two points are connected to form a graph structure. Furthermore, when describing the relationships between words using a graph structure, if two points have completely identical relationships with other points, it means that the usage contexts of the words corresponding to the two points are basically the same, and they are very likely to have the same meaning and can be substituted for each other.

[0140] Step S504: Correct the text based on graph neural network.

[0141] After steps S502 and S503, there may still be missing text to be corrected; therefore, based on the graph structure involved in step S503, step S504 designs a graph neural network text correction method to further correct the document.

[0142] Step S505: Manual review.

[0143] Steps S502 to S504 described above can resolve most text correction problems, but a few correction failures may still occur. Therefore, manual review is required to determine whether the correction result for a particular word is reasonable; if it is unreasonable, manual correction is necessary.

[0144] The above-mentioned text correction method based on graph structure and graph neural network can achieve the following technical effects: (1) First, based on the simple edit distance technique with a transition step ratio limit, part of the text correction work is completed. Then, the remaining text correction work is completed through the more complicated graph structure-based method and graph neural network method. Finally, the manual review only requires a very small amount of work, thereby improving production efficiency. (2) Using the edit distance method with a transition step ratio limit to correct documents can limit the conversion of irrelevant words, thereby improving the correction accuracy. (3) Using graph structure to describe the relationship between words in different documents and correcting documents based on graph structure, the purpose of correcting documents from the perspective of context is achieved, which is conducive to simple and fast document correction. (4) First, the standard expression is converted into a One-Hot vector. Then, the words in the benchmark document are used as training samples. The neural network is trained based on graph structure. No additional training data is required in the entire training process. It is based entirely on the document to be processed and the benchmark document, which is both convenient and fast, thereby improving the model training efficiency.

[0145] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0146] Based on the same inventive concept, this application also provides a text correction apparatus for implementing the text correction method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more text correction apparatus embodiments provided below can be found in the limitations of the text correction method described above, and will not be repeated here.

[0147] In one exemplary embodiment, such as Figure 6 As shown, a text correction device is provided, including: a word recognition module 601, a first correction module 602, and a second correction module 603, wherein:

[0148] The word recognition module 601 is used to identify the first word to be corrected in the text to be corrected from the word segmentation based on the edit distance between the word segmentation of the text to be corrected and the preset standard words;

[0149] The first correction module 602 is used to correct the first word to be corrected in the text to be corrected according to the preset standard words, so as to obtain the initial corrected text of the text to be corrected.

[0150] The second correction module 603 is used to correct the second word to be corrected in the initial correction text based on the similarity between the second word to be corrected in the initial correction text and the preset standard words, so as to obtain the target correction text of the text to be corrected; the second word to be corrected is the word in the initial correction text other than the correction word of the first word to be corrected.

[0151] In one embodiment, the word recognition module 601 is further configured to, for any word segment, select the preset standard word with the smallest edit distance from any word segment as a candidate correction word for any word segment; determine the target edit ratio of any word segment based on the edit distance between any word segment and the candidate correction word, and the number of characters in any word segment; the target edit ratio is used to represent the edit ratio corresponding to correcting any word segment into a candidate correction word; if the target edit ratio is less than or equal to a preset edit ratio threshold, determine any word segment as the first word to be corrected in the text to be corrected.

[0152] In one embodiment, the first correction module 602 is further configured to correct the first word to be corrected into a candidate word to be corrected, thereby obtaining the initial corrected text of the text to be corrected.

[0153] In one embodiment, the text correction device further includes a similarity determination module, used to determine a second word to be corrected in the initial correction text, and to construct a word network of the initial correction text based on the adjacency relationship between the word segments of the initial correction text; to obtain the word vector of the second word to be corrected based on the word network, the preset standard word vector, and the pre-trained word vector model; the preset standard word vector is the word vector corresponding to the preset standard word; and to determine the similarity between the second word to be corrected and the preset standard word based on the word vector of the second word to be corrected and the preset standard word vector.

[0154] In one embodiment, the similarity determination module is further configured to: identify, in the word network, word segments that have a connection relationship with the second word to be corrected and belong to preset standard words, as adjacent standard words of the second word to be corrected; determine the word vectors of adjacent standard words from the preset standard word vectors; and input the word vectors of adjacent standard words into a pre-trained word vector model to obtain the word vector of the second word to be corrected.

[0155] In one embodiment, the text correction device further includes a model training module, used to select word segments belonging to preset standard words from the word network as sample words; determine word segments that have a connection relationship with the sample words and belong to preset standard words from the word network as adjacent standard words of the sample words; input the word vectors of the adjacent standard words of the sample words into the word vector model to be trained to obtain the predicted word vectors of the sample words; iteratively train the word vector model to be trained based on the predicted word vectors and the real word vectors of the sample words to obtain the pre-trained word vector model; the word vectors of the adjacent standard words of the sample words and the real word vectors of the sample words are both obtained by querying the preset standard word vectors.

[0156] In one embodiment, the second correction module 603 is further configured to determine the target standardized word with the highest similarity to the second word to be corrected from the preset standardized words; if the similarity between the second word to be corrected and the target standardized word is greater than the preset similarity threshold, the second word to be corrected in the initial correction text is corrected to the target standardized word, thereby obtaining the target corrected text of the text to be corrected.

[0157] In one embodiment, the text correction device further includes a third correction module, used to filter out any two words with the same connection relationship from the word network of the initial correction text; if the first word in any two words belongs to a preset standard word and the second word does not belong to a preset standard word, the second word in the initial correction text is corrected to the corresponding first word to obtain the processed initial correction text.

[0158] In one embodiment, the second correction module 603 is further configured to correct the second word to be corrected in the processed initial correction text based on the similarity between the second word to be corrected in the processed initial correction text and the preset standard words, so as to obtain the target correction text of the text to be corrected; the second word to be corrected in the processed initial correction text is the word in the processed initial correction text other than the correction word of the first word to be corrected and the first word segmentation.

[0159] Each module in the aforementioned text correction device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.

[0160] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 7As shown, the computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When executed by the processor, the computer program implements a text correction method. The display unit is used to form a visually visible image and can be a display screen, projection device, or virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0161] Those skilled in the art will understand that Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0162] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0163] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.

[0164] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0165] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0166] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0167] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0168] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A text correction method, characterized in that, The method includes: Based on the edit distance between the word segmentation of the text to be corrected and the preset standard words, the first word to be corrected in the text to be corrected is identified from the word segmentation; Based on the preset standard words, the first word to be corrected in the text to be corrected is corrected to obtain the initial corrected text of the text to be corrected; The second word to be corrected in the initial corrected text is determined, and a word network of the initial corrected text is constructed based on the adjacency relationship between the word segments of the initial corrected text. In the word network, word segments that have a connection relationship with the second word to be corrected and belong to the preset standard words are identified as adjacent standard words of the second word to be corrected. The word vectors of the adjacent standardized words are determined from the preset standardized word vectors; the preset standardized word vectors are the word vectors corresponding to the preset standardized words. The word vectors of the adjacent standardized words are input into a pre-trained word vector model to obtain the word vector of the second word to be corrected; Based on the word vector of the second word to be corrected and the preset standardized word vector, the similarity between the second word to be corrected and the preset standardized word is determined; Based on the similarity between the second word to be corrected in the initial correction text and the preset standard word, the second word to be corrected in the initial correction text is corrected to obtain the target correction text of the text to be corrected; the second word to be corrected is a word in the initial correction text other than the correction word of the first word to be corrected.

2. The method according to claim 1, characterized in that, The step of identifying the first word to be corrected in the text based on the edit distance between the word segmentation of the text to be corrected and the preset standardized words includes: For any given word segment, the preset standard word with the smallest edit distance to that word segment is selected as the candidate correction word for that word segment. Based on the edit distance between any word segment and the candidate correction word, and the number of characters in any word segment, the target edit ratio of any word segment is determined; the target edit ratio is used to represent the edit ratio corresponding to correcting any word segment into the candidate correction word; If the target editing ratio is less than or equal to a preset editing ratio threshold, any one of the word segments is determined as the first word to be corrected in the text to be corrected; The step of correcting the first word to be corrected in the text to be corrected according to the preset standard words, to obtain the initial corrected text of the text to be corrected, includes: The first word to be corrected is corrected to the candidate word to be corrected, thus obtaining the initial corrected text of the text to be corrected.

3. The method according to claim 1, characterized in that, Before obtaining the word vector of the second word to be corrected, the process also includes: Word segments belonging to the preset standard words are selected from the word network and used as sample words; From the word network, word segments that have a connection relationship with the sample word and belong to the preset standard words are identified as adjacent standard words of the sample word; The word vectors of the adjacent standard words of the sample word are input into the word vector model to be trained to obtain the predicted word vector of the sample word. Based on the predicted word vectors and the actual word vectors of the sample words, the word vector model to be trained is iteratively trained to obtain the pre-trained word vector model; the word vectors of the adjacent standard words of the sample words and the actual word vectors of the sample words are both obtained by querying the preset standard word vectors.

4. The method according to claim 1, characterized in that, The step of correcting the second word to be corrected in the initial corrected text based on the similarity between the second word to be corrected in the initial corrected text and the preset standardized words, to obtain the target corrected text of the text to be corrected, includes: From the preset standardized words, the target standardized word with the highest similarity to the second word to be corrected is determined; If the similarity between the second word to be corrected and the target standardized word is greater than a preset similarity threshold, the second word to be corrected in the initial corrected text is corrected to the target standardized word, thus obtaining the target corrected text of the text to be corrected.

5. The method according to claim 1, characterized in that, Before correcting the second word to be corrected in the initial corrected text based on the similarity between the second word to be corrected in the initial corrected text and the preset standardized words, to obtain the target corrected text of the text to be corrected, the method further includes: From the word network of the initial corrected text, select any two word segments with the same connection relationship; If the first word in any two word segments belongs to the preset standard word and the second word does not belong to the preset standard word, the second word in the initial corrected text is corrected to the corresponding first word to obtain the processed initial corrected text; The step of correcting the second word to be corrected in the initial corrected text based on the similarity between the second word to be corrected in the initial corrected text and the preset standardized words, to obtain the target corrected text of the text to be corrected, further includes: Based on the similarity between the second word to be corrected in the processed initial corrected text and the preset standard words, the second word to be corrected in the processed initial corrected text is corrected to obtain the target corrected text of the text to be corrected; the second word to be corrected in the processed initial corrected text is the word in the processed initial corrected text other than the corrected word of the first word to be corrected and the first word segmentation.

6. The method according to claim 1, characterized in that, The preset standard word vector is a vector obtained by one-hot encoding the preset standard words.

7. A text correction device, characterized in that, The device includes: The word recognition module is used to identify the first word to be corrected in the text to be corrected from the word segmentation based on the edit distance between the word segmentation of the text to be corrected and the preset standard words; The first correction module is used to correct the first word to be corrected in the text to be corrected according to the preset standard words, so as to obtain the initial corrected text of the text to be corrected; A similarity determination module is used to determine the second word to be corrected in the initial correction text, and to construct a word network of the initial correction text based on the adjacency relationship between word segments of the initial correction text; in the word network, to determine the word segments that have a connection relationship with the second word to be corrected and belong to the preset standard words, as adjacent standard words of the second word to be corrected; to determine the word vectors of the adjacent standard words from the preset standard word vectors; the preset standard word vectors are the word vectors corresponding to the preset standard words; to input the word vectors of the adjacent standard words into a pre-trained word vector model to obtain the word vector of the second word to be corrected; and to determine the similarity between the second word to be corrected and the preset standard words based on the word vector of the second word to be corrected and the preset standard word vectors. The second correction module is used to correct the second word to be corrected in the initial correction text based on the similarity between the second word to be corrected in the initial correction text and the preset standard words, so as to obtain the target correction text of the text to be corrected; the second word to be corrected is a word in the initial correction text other than the correction word of the first word to be corrected.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Text processing method and device

    CN114742050A

  • Speech transcription method and device, electronic equipment and storage medium

    CN115331671A