Text correction method and device, equipment and storage medium
By using a contextual semantic recognition model to correct grammatical errors in pet insurance claim texts, the problem of claim anomalies caused by input errors was solved, and the accuracy of word error recognition and correction was improved.
Patent Information
- Application Number
- CN202311348123.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-16
- Publication Date
- 2026-01-27
- Estimated Expiration
- 2043-10-16
AI Technical Summary
In the pet insurance claims process, grammatical errors often appear in the text files entered and collected, leading to claims irregularities. Existing technology is unable to effectively correct various types of text errors.
A text correction method based on a context semantic recognition model is adopted. The text to be corrected is obtained by generating a file frame, and then the text is processed and segmented. The pre-trained context semantic recognition model is used to perform semantic prediction, replace the wrong words, and generate the correct text after correction.
It improves the accuracy of identifying misspelled words in the text to be corrected, enhances the accuracy of semantic understanding, and improves the text correction capability.
Smart Images

Figure CN117315703B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of digital finance and artificial intelligence technology, and in particular to a text correction method, apparatus, electronic device and readable storage medium. Background Technology
[0002] As people's lives further develop, they are paying more and more attention to their spiritual needs. Keeping pets to satisfy these needs is becoming increasingly common. Moreover, many families are not only keeping cats and dogs, but also raising ornamental fish, birds, reptiles, and rodents. Consequently, pet illnesses and accidental injuries are becoming more frequent. This diversity in pet species and diseases leads to an increase in the types of insurance available. Therefore, when handling pet accident claims, customer service personnel need to obtain a large amount of claim materials. Inevitably, input errors or collection errors may occur, causing claim irregularities. A text correction method could be proposed to detect and automatically correct textual grammatical errors in a large number of different types of claim documents. Summary of the Invention
[0003] This invention provides a text correction method, apparatus, electronic device, and readable storage medium, the main purpose of which is to solve the problem of erroneous text in different types of claims documents.
[0004] To achieve the above objectives, the present invention provides a text correction method, comprising:
[0005] Upon receiving an error correction request sent by an authorized first terminal, a first file frame associated with the first terminal is generated. The first file frame is used to obtain the text to be corrected entered by the user.
[0006] The text to be corrected is processed to obtain the corresponding first predicted text set;
[0007] Extract the fields that do not match the text to be corrected in the first predicted text set, perform word segmentation processing, and generate a set of incorrect words to be predicted;
[0008] The set of incorrect words to be predicted and the text to be corrected are input into a pre-trained context semantic recognition model to perform semantic prediction on the text to be corrected, and generate the corresponding second predicted word.
[0009] The second predicted word is used to replace the erroneous words in the text to be predicted and corrected, resulting in the corrected text.
[0010] Optionally, before performing text processing on the text to be corrected to obtain the corresponding first predicted text set, the following steps are included:
[0011] Obtain the original training text set.
[0012] Use a random function to determine the replaceable entity words in each original training text in the original training text set;
[0013] Based on the replaceable entity words, word substitution is performed on each of the original prototype training texts to generate a set of replaced texts;
[0014] The permuted text set is incorporated into the training text set to obtain a complete training text set;
[0015] The context semantic recognition model is trained using the complete training text set to obtain a trained context semantic recognition model.
[0016] Optionally, the step of performing word substitution on each prototype original training text based on the replaceable entity words to generate a substitution text set further includes:
[0017] Obtain a pre-stored dictionary of similar words and a dictionary of homophones. The homophone dictionary includes the relationship between homophones with the same pinyin and different character forms. The similar word dictionary includes the similar character form relationship and similar character form relationship between homophones and homophones with different radicals.
[0018] Based on the relationship between the same pinyin characters, the replaceable entity words are used to replace the words to obtain the first replacement text set;
[0019] Based on the similar character shape relationship, the replaceable entity words are replaced to obtain a second replacement text set;
[0020] The first and second permutation texts are combined to obtain the permutation text set.
[0021] Optionally, the step of summarizing the first permutation text and the second permutation text to obtain the permutation text set further includes:
[0022] Based on the similar characters in the similar character shape relationship, the replaced entity words in the first replacement text set are replaced again to obtain the third replacement text set;
[0023] Based on the homophones in the aforementioned homophone relationships, the replaced entity words in the second replacement text set are replaced again to obtain the fourth replacement text set;
[0024] The third and fourth permutation text sets are combined to obtain the permutation text set.
[0025] Optionally, training the context semantic recognition model using the complete training text set to obtain a trained context semantic recognition model includes:
[0026] The complete training text set is input into the neural network model to be trained to obtain the prediction result;
[0027] Based on the prediction results and the true results in each text of the complete training text set, a first loss function is determined, wherein the true results are used to indicate whether a word in each text of the pre-annotated complete training text set has been replaced.
[0028] The second loss function is determined using the original training text set and the complete training text set.
[0029] The neural network model to be trained is fine-tuned based on the first loss function and the second loss function to obtain a trained context semantic recognition model.
[0030] Optionally, the step of performing text processing on the text to be corrected to obtain the corresponding first predicted text set includes:
[0031] The text to be corrected is segmented into phrases to obtain multiple phrases;
[0032] Candidate texts corresponding to the text to be corrected are generated based on the multi-grammar of each character in each phrase;
[0033] The candidate texts that match the preset semantic probabilities are aggregated to obtain the first predicted text set.
[0034] Optionally, the step of inputting the set of incorrect words to be predicted and the text to be corrected into a pre-trained contextual semantic recognition model to perform semantic prediction on the text to be corrected and generate a corresponding second predicted word includes:
[0035] The context semantic recognition model is used to encode the text to be corrected and the set of incorrect words to be predicted to obtain a first semantic vector and a set of character vectors of words to be corrected.
[0036] Multiply the first semantic vector by the character vector set to be corrected and the word vector set to be corrected to obtain the candidate correction probability of each character in the word vector set to be corrected for each character set to be corrected.
[0037] The character vector to be corrected is selected from the candidate with the highest probability of error correction and decoded to generate the second prediction word.
[0038] To address the above problems, the present invention also provides a text correction device, the device comprising:
[0039] Text acquisition module: used to generate a first file frame associated with the first terminal when receiving an error correction request sent by an authorized first terminal, the first file frame being used to acquire the text to be corrected entered by the user;
[0040] Text processing module: used to process the text to be corrected to obtain the corresponding first predicted text set;
[0041] Field comparison module: used to extract fields that do not match the text to be corrected in the first predicted text set, perform word segmentation processing, and generate a set of incorrect words to be predicted;
[0042] Semantic prediction module: used to input the set of miswords to be predicted and the text to be corrected into a pre-trained context semantic recognition model to perform semantic prediction on the text to be corrected and generate the corresponding second prediction word;
[0043] Text replacement module: Used to replace the erroneous words in the text to be predicted and corrected with the second predicted word, so as to obtain the corrected text.
[0044] To address the above problems, the present invention also provides an electronic device, the electronic device comprising:
[0045] Memory, storing at least one computer program; and
[0046] The processor executes the computer program stored in the memory to implement the text correction method described above.
[0047] To address the aforementioned problems, the present invention also provides a computer-readable storage medium storing at least one computer program, which is executed by a processor in an electronic device to implement the text correction method described above.
[0048] This invention improves the error correction capability of the text to be corrected by performing semantic-based text prediction, and enhances the accuracy of semantic understanding of the semantic recognition model by combining bidirectional gated recurrent units and attention mechanisms. Furthermore, by constructing a contextual semantic recognition model to perform semantic-based target misspelling identification in the text to be corrected, the accuracy of misspelling identification in the text to be corrected is further improved. Therefore, the text correction method, device, electronic device, and computer-readable storage medium proposed in this invention can improve the accuracy of target misspelling in the text to be corrected. Attached Figure Description
[0049] Figure 1 This is a flowchart illustrating a text correction method provided in an embodiment of the present invention;
[0050] Figure 2This is a functional block diagram of a text correction device provided in an embodiment of the present invention;
[0051] Figure 3 This is a schematic diagram of the structure of an electronic device that implements the text correction method according to an embodiment of the present invention.
[0052] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0053] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0054] This invention provides a text correction method. The execution subject of the text correction method includes, but is not limited to, at least one of the following: a server, a terminal, or other electronic devices configured to execute the method provided in this invention. In other words, the text correction method can be executed by software or hardware installed on a terminal device or a server device, and the software may be a blockchain platform. The server includes, but is not limited to, a single server, a server cluster, a cloud server, or a cloud server cluster. The server can be an independent server or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0055] Reference Figure 1 The diagram shown is a flowchart illustrating a text correction method according to an embodiment of the present invention. In this embodiment, the text correction method includes the following steps S1-S5:
[0056] S1. Upon receiving an error correction request sent by an authorized first terminal, a first file frame associated with the first terminal is generated. The first file frame is used to obtain the text to be corrected entered by the user.
[0057] The aforementioned first terminal is an authorized terminal, that is, a registered terminal that is allowed to send error correction requests. When an error correction request is received, a first file box for receiving the file to be corrected is generated, and the user enters the file to be corrected in the first file box.
[0058] In one optional application scenario, the first terminal displays a login interface. After the user enters their account and password on the login interface and clicks the login control displayed on the login interface, the user sends an error correction request to the server based on the error correction needs. Based on the generation of the error correction request, the login interface is redirected to generate a first text box to obtain the text to be corrected that the user subsequently enters.
[0059] S2. Perform text processing on the text to be corrected to obtain the corresponding first predicted text set.
[0060] In this embodiment, it should be explained that the text to be corrected can be the text entered based on pet insurance, which may include: text describing the pet's condition before purchasing insurance, text describing the user's needs and intentions, text of inquiries related to pet insurance, text of receipts and documents for claims, etc. There are no limitations on this. Professional terms related to pet insurance are extracted, including proper nouns for pet types, nouns for corresponding pet diseases, nouns for accident situations, and nouns for insurance categories.
[0061] In this step, text processing is performed on the text to be corrected based on proper nouns to obtain the predicted extended text based on proper nouns. An n-gram can be used to calculate the grammatical probability score for each proper noun in the text to be corrected, and all related proper nouns are summarized and embedded into the text to be corrected for word replacement to obtain N predicted texts.
[0062] In this embodiment, in order to increase the confidence level of the text to be corrected, similar text processing is performed on the text to be corrected to obtain similar character information corresponding to each entity character in the text to be corrected.
[0063] In a preferred embodiment, the text to be corrected is processed using a pre-trained semantic recognition model. It should be noted that the semantic recognition model is constructed using the SEQ2SEQ semantic recognition method based on the GRU model.
[0064] In a preferred embodiment, a convolution operation can be performed on the acquired text to be corrected to obtain the similar character information, wherein the similar character information includes easily confused characters and similarity weights between easily confused characters; based on the similar character information including easily confused characters and similarity weights between easily confused characters, text prediction is performed to obtain a first predicted text set.
[0065] S3. Extract the fields that do not match the text to be corrected in the first predicted text set and perform word segmentation to generate a set of incorrect words to be predicted.
[0066] In this step, each first predicted text in the first predicted text set with the same text length as the text to be corrected is selected for text comparison. Among them, the word groups in the sentence segments with inconsistent texts are selected and summarized to obtain the set of words to be predicted.
[0067] For example: The text to be corrected is "Notify every member", and the first predicted text is "Notify not a single member". When traversing to the character "知", extract "通知到" and "知到" as the words to be predicted for errors. When traversing to the character "每", take "没一" and "没一个" as the words to be predicted for errors. The semantic meanings of each word to be predicted for errors can be different.
[0068] S4. Input the set of words to be predicted for errors and the text to be corrected into a pre-trained context semantic recognition model to perform semantic prediction on the text to be corrected, and generate corresponding second predicted words.
[0069] In this embodiment,
[0070] Use the context semantic recognition model to perform feature encoding on the text to be corrected and the set of words to be predicted for errors, and obtain a first semantic vector and a set of character vectors of the words to be corrected for errors;
[0071] Multiply the first semantic vector and the set of character vectors of the words to be corrected for errors to obtain the candidate correction probabilities of each character in the set of character vectors of the words to be corrected for errors;
[0072] Select the character vector of the word to be corrected for errors corresponding to the candidate correction probability with the highest probability for decoding, and generate a second predicted word.
[0073] S5. Use the second predicted word to replace the error word in the text to be corrected for errors to obtain the corrected correct text.
[0074] In this embodiment, take the second predicted word output by the context semantic recognition model as the word predicted for error, and select the word predicted for error as the replacement word corresponding to the target error word in the text to be corrected for errors, and extract the position of the target error word in the text to be corrected for errors for error word replacement. When the second predicted word is the same as the target error word in the text to be corrected for errors, do not perform the error word replacement operation.
[0075] In another preferred embodiment, it further includes the training step of the context semantic recognition model. It should be noted that in the embodiment, Seq2Seq+Attention is used to construct the context semantic recognition model. Among them, in order to further meet the encoding requirements for semantic features, the encoder uses at least one of models such as BGRU (Bi-directional Gated Recurrent Unit, bidirectional gated recurrent unit), Transformer (a model based on the multi-head attention mechanism), etc. to perform encoding on the semantic feature sequence.
[0076] The context semantic recognition model to be trained also includes a decoder. The decoder includes time series neural network layers such as LSTM, Attention, and BGRU, which are used to decode the outputs of the encoder and the attention layer. The computer device determines the similarity between the semantic probability of the error-correction word at the previous position and the semantic feature sequence of the error-correction text through the attention layer of the context semantic recognition model, and then the computer device determines the semantic probability of the error-correction word at the previous position through the decoder in the speech recognition model.
[0077] Further, by obtaining the original training text set, using a random function to determine the replaceable entity words in each original training text in the original training text set; performing word replacement on each prototype original training text based on the replaceable entity words to generate a replacement text set; incorporating the replacement text set into the training text set to obtain a complete training text set; and using the complete training text set to train the context semantic recognition model to obtain a trained context semantic recognition model.
[0078] Among them, performing word replacement on each prototype original training text based on the replaceable entity words to generate a replacement text set includes:
[0079] In this step, obtain a pre-stored similar word dictionary and a homophone dictionary. The homophone dictionary includes the relationship between homophonic characters with the same pinyin and different glyphs, and the similar word dictionary includes the relationship between similar glyphs of the same type of characters with different radicals; perform word replacement on the replaceable entity words based on the homophonic character relationship to obtain a first replacement text set; perform word replacement on the replaceable entity words based on the similar glyph relationship to obtain a second replacement text set; and summarize the first replacement text and the second replacement text to obtain a replacement text set.
[0080] Specifically, obtain a pre-stored similar word dictionary and a homophone dictionary. The homophone dictionary can be created by sorting the dictionary by pinyin, finding homophonic characters with different glyphs, and establishing the corresponding relationship between the same pinyin and different glyphs. This corresponding relationship includes the corresponding relationship between pinyin and characters, and can also include the corresponding relationship between characters and words containing the character. For example, for the pinyin "ci", the homophonic characters with different glyphs corresponding to it include: ci, ci, ci...; ci, ci, ci... are homophonic characters. Another example is that the words corresponding to "ci" include: ci yu, ci ju, ci tiao, ming ci, dong ci...
[0081] The similar word dictionary can be created by sorting the dictionary by pinyin, finding similar characters of each Chinese character, such as characters of the same type but with different radicals, and establishing the corresponding relationship between the same type of characters and different radicals. This corresponding relationship includes the corresponding relationship between the same type of characters with different radicals, each character and words containing the character, and can also include the corresponding relationship between characters and words containing the character.
[0082] Further, homophonic words with the same pronunciation as the selected entity word are obtained as substitution words, or similar words in a pre-stored similar word dictionary are found as substitution words for the selected entity word. For example: when the entity word is "word", the entity word is split, and the radical of the substitution word is obtained as the radical "讠", and the homotype word is "si". By searching in the similar word dictionary, the entity words are obtained as "1. word; 2. serve; 3. heir...". Another example, when the selected entity word is "quick claim settlement", the pinyin string "lipeikuai" of "insurance claim settlement payment" is obtained, and the corresponding candidate words "1. Li Peikai" are displayed.
[0083] Further, a complete training text set is obtained through the above method to improve the training of the context semantic recognition model. After serializing the complete training text set and inputting it into the neural network model to be trained, the corresponding dimensionality coefficients are obtained using the fully connected layer of the context semantic recognition model, and the dimensionality coefficients are input into the normalized exponential (softmax) function to obtain the weights representing the context semantics of each training text in the complete training text set, and the corresponding weight values. By setting different weight values for different context sentences, the part of the context sentences that provides effective information for the translation of the target sentence in multiple context sentences is highlighted, so as to make the recognition of semantic features more accurate.
[0084] Further, in another preferred embodiment, based on the similar words in the similar glyph relationship, the replaced entity words in the first replacement text set are replaced again to obtain the third replacement text set; based on the homophonic words in the same pinyin word relationship, the replaced entity words in the second replacement text set are replaced again to obtain the fourth replacement text set; the third replacement text set and the fourth replacement text set are summarized to obtain the replacement text set, and the second replacement text set and the fourth replacement text set are used to enrich the replacement text data.
[0085] Further, in this embodiment, the prediction results and the true results in each text of the complete training text set are obtained, and the first loss function is determined. The true result is used to represent whether the words in each text of the pre-annotated complete training text set are replaced; using the prototype original training text set and the complete training text set, the second loss function is determined. The neural network model to be trained is fine-tuned according to the first loss function and the second loss function, so as to obtain the trained context semantic recognition model.
[0086] In an optional embodiment of the present invention, the first loss function loss1 can be calculated by the cross-entropy loss function, and the second loss function loss2 can be calculated by the contrastive loss function. The total loss loss = loss1 + loss2 is used as the total loss function of the model. The neural network model is iteratively trained until the loss value meets the preset loss threshold (e.g., less than the preset loss threshold), and a well-trained context semantic recognition model is obtained, which can greatly improve the accuracy and stability of model recognition.
[0087] This invention improves the error correction capability of the text to be corrected by performing semantic-based text prediction, and enhances the accuracy of semantic understanding of the semantic recognition model by combining a bidirectional gated recurrent unit and an attention mechanism. Furthermore, by constructing a contextual semantic recognition model to perform semantic-based target misspelling identification in the text to be corrected, the accuracy of misspelling identification in the text to be corrected is further improved. Therefore, the text correction method, device, electronic device, and computer-readable storage medium proposed in this invention can improve the accuracy of target misspelling in the text to be corrected.
[0088] like Figure 2 The diagram shown is a functional block diagram of a text correction device provided in an embodiment of the present invention.
[0089] The text correction device 100 of this invention can be installed in an electronic device. Depending on the functions implemented, the text correction device 100 may include a text acquisition module 101, a text processing module 102, a field comparison module 103, a semantic prediction module 104, and a text replacement module 105. The module described in this invention can also be referred to as a unit, which refers to a series of computer program segments that can be executed by the processor of an electronic device and can perform a fixed function, and which are stored in the memory of the electronic device.
[0090] In this embodiment, the functions of each module / unit are as follows:
[0091] The text acquisition module 101 is used to generate a first file frame associated with the first terminal when receiving an error correction request sent by an authorized first terminal. The first file frame is used to acquire the text to be corrected entered by the user.
[0092] The text processing module 102 is used to perform text processing on the text to be corrected to obtain the corresponding first predicted text set.
[0093] The field comparison module 103 is used to extract fields that do not match the first predicted text set and the text to be corrected, perform word segmentation processing, and generate a set of incorrect words to be predicted.
[0094] The semantic prediction module 104 is used to input the set of incorrect words to be predicted and the text to be corrected into a pre-trained context semantic recognition model to perform semantic prediction on the text to be corrected and generate a corresponding second prediction word.
[0095] The text replacement module 105 is used to replace the erroneous words in the text to be predicted and corrected with the second predicted word, so as to obtain the correct text after correction.
[0096] In detail, the text correction device 100 also includes an acquisition sub-unit, a replacement sub-unit, a generation sub-unit, a summarization sub-unit, and a fine-tuning sub-unit.
[0097] The acquisition subunit is used to acquire the original training text set.
[0098] The replacement subunit is used to determine the replaceable entity words in each original training text in the original training text set using a random function.
[0099] The generating subunit is used to perform word substitution on each of the original prototype training texts based on the replaceable entity words, and generate a set of substituted texts.
[0100] The summarization subunit is used to merge the permutation text set into the training text set to obtain a complete training text set.
[0101] The fine-tuning subunit is used to train the context semantic recognition model using the complete training text set to obtain a trained context semantic recognition model.
[0102] This invention improves the error correction capability of the text to be corrected by performing semantic-based text prediction, and enhances the accuracy of semantic understanding of the semantic recognition model by combining bidirectional gated recurrent units and attention mechanisms. Furthermore, by constructing a contextual semantic recognition model to perform semantic-based target misspelling identification in the text to be corrected, the accuracy of misspelling identification in the text to be corrected is further improved. Therefore, the text correction method, device, electronic device, and computer-readable storage medium proposed in this invention can improve the accuracy of target misspelling in the text to be corrected.
[0103] like Figure 3 The diagram shown is a structural schematic of an electronic device that implements the text correction method according to an embodiment of the present invention.
[0104] The electronic device may include a processor 10, a memory 11, a communication interface 12 and a bus 13, and may also include a computer program, such as a target identification program, stored in the memory 11 and capable of running on the processor 10.
[0105] The memory 11 includes at least one type of readable storage medium, such as flash memory, portable hard drive, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 11 can be an internal storage unit of an electronic device, such as a portable hard drive. In other embodiments, the memory 11 can be an external storage device of the electronic device, such as a plug-in portable hard drive, smart media card (SMC), secure digital card (SD), flash card, etc. Furthermore, the memory 11 can include both internal and external storage units of the electronic device. The memory 11 can be used not only to store application software and various types of data installed on the electronic device, such as the code of a target object recognition program, but also to temporarily store data that has been output or will be output.
[0106] In some embodiments, the processor 10 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits with the same or different functions, including combinations of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 10 is the control unit of the electronic device, connecting various components of the entire electronic device through various interfaces and lines. It executes programs or modules (such as object recognition programs) stored in the memory 11, and calls data stored in the memory 11 to perform various functions of the electronic device and process data.
[0107] The communication interface 12 is used for communication between the aforementioned electronic device and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a Wi-Fi interface, Bluetooth interface, etc.), typically used to establish communication connections between the electronic device and other electronic devices. The user interface may be a display, an input unit (such as a keyboard), or optionally, a standard wired or wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen, etc. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the electronic device and to display a visual user interface.
[0108] The bus 13 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus 13 can be divided into an address bus, a data bus, a control bus, etc. The bus 13 is configured to enable communication between the memory 11 and at least one processor 10, etc.
[0109] Figure 3 Only electronic devices with components are shown; those skilled in the art will understand that... Figure 3 The structure shown does not constitute a limitation on the electronic device and may include fewer or more components than shown, or combine certain components, or have different component arrangements.
[0110] For example, although not shown, the electronic device may also include a power supply (such as a battery) to power the various components. Preferably, the power supply can be logically connected to the at least one processor 10 through a power management device, thereby enabling functions such as charging management, discharging management, and power consumption management. The power supply may also include one or more DC or AC power supplies, recharging devices, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be described in detail here.
[0111] Furthermore, the electronic device may also include a network interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a Wi-Fi interface, a Bluetooth interface, etc.), which is typically used to establish communication connections between the electronic device and other electronic devices.
[0112] Optionally, the electronic device may further include a user interface, which may be a display, an input unit (such as a keyboard), and optionally, a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen, etc. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the electronic device and to display a visual user interface.
[0113] It should be understood that the embodiments described are for illustrative purposes only and are not limited to this structure in the scope of the patent application.
[0114] The target identification program stored in the memory 11 of the electronic device is a combination of multiple instructions, which, when run in the processor 10, can achieve the following:
[0115] Upon receiving an error correction request sent by an authorized first terminal, a first file frame associated with the first terminal is generated. The first file frame is used to obtain the text to be corrected entered by the user.
[0116] The text to be corrected is processed to obtain the corresponding first predicted text set;
[0117] Extract the fields that do not match the text to be corrected in the first predicted text set, perform word segmentation processing, and generate a set of incorrect words to be predicted;
[0118] The set of incorrect words to be predicted and the text to be corrected are input into a pre-trained context semantic recognition model to perform semantic prediction on the text to be corrected, and generate the corresponding second predicted word.
[0119] The second predicted word is used to replace the erroneous words in the text to be predicted and corrected, resulting in the corrected text.
[0120] Specifically, the specific implementation method of the processor 10 for the above instructions can be referred to the description of the relevant steps in the corresponding embodiment of the accompanying drawings, and will not be repeated here.
[0121] Furthermore, if the modules / units integrated into the electronic device are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, or a read-only memory (ROM).
[0122] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor of an electronic device, can perform the following:
[0123] Upon receiving an error correction request sent by an authorized first terminal, a first file frame associated with the first terminal is generated. The first file frame is used to obtain the text to be corrected entered by the user.
[0124] The text to be corrected is processed to obtain the corresponding first predicted text set;
[0125] Extract the fields that do not match the text to be corrected in the first predicted text set, perform word segmentation processing, and generate a set of incorrect words to be predicted;
[0126] The set of incorrect words to be predicted and the text to be corrected are input into a pre-trained context semantic recognition model to perform semantic prediction on the text to be corrected, and generate the corresponding second predicted word.
[0127] The second predicted word is used to replace the erroneous words in the text to be predicted and corrected, resulting in the corrected text.
[0128] In the several embodiments provided by this invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.
[0129] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0130] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.
[0131] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0132] Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within the invention. No appended diagram markings in the claims should be construed as limiting the scope of the claims.
[0133] The embodiments of this invention can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0134] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0135] The blockchain referred to in this invention is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.
[0136] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in a system claim may also be implemented by a single unit or device through software or hardware. The term "second class" is used to indicate names and does not indicate any specific order.
[0137] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A text error correction method, characterized in that, The method includes: Upon receiving an error correction request sent by an authorized first terminal, a first file frame associated with the first terminal is generated. The first file frame is used to obtain the text to be corrected entered by the user. The text to be corrected is convolved to obtain similar character information. Based on the easily confused characters and the similarity weights between the easily confused characters in the similar character information, text prediction is performed to obtain a first predicted text set. Alternatively, the text to be corrected is divided into phrases to obtain multiple phrases. Based on the multi-grammar of each character in each phrase, candidate texts corresponding to the text to be corrected are generated. The candidate texts that meet the preset semantic probability are summarized to obtain a first predicted text set. Extract the fields that do not match the text to be corrected in the first predicted text set, perform word segmentation processing, and generate a set of incorrect words to be predicted; Using a pre-trained context semantic recognition model, feature encoding and candidate error correction probabilities are performed on the text to be corrected and the set of words to be predicted, to obtain the candidate error correction probabilities of each character in the character vector set of words to be corrected. The character vector corresponding to the candidate error correction probability with the highest probability is selected from the candidate error correction probabilities of each character in the character vector set of words to be corrected for decoding to generate the second predicted word. The second predicted word is used to replace the erroneous words in the text to be predicted and corrected, resulting in the corrected text.
2. The method as described in claim 1, characterized in that, Before performing text processing on the text to be corrected to obtain the corresponding first predicted text set, the method further includes: Obtain the original training text set. Use a random function to determine the replaceable entity words in each original training text in the original training text set; Based on the replaceable entity words, word substitution is performed on each of the original training texts to generate a set of replaced texts; The permuted text set is incorporated into the training text set to obtain a complete training text set; The context semantic recognition model is trained using the complete training text set to obtain a trained context semantic recognition model.
3. The method as described in claim 2, characterized in that, The step of performing word substitution on each of the original training texts based on the replaceable entity words to generate a substitution text set includes: Obtain a pre-stored dictionary of similar words and a dictionary of homophones, wherein the dictionary of homophones includes the relationship between homophones with the same pinyin and different character forms, and the dictionary of similar words includes the relationship between similar character forms and similar character forms with the same character form and different radicals; Based on the relationship between homophones, the replaceable entity words are replaced with words to obtain a first replacement text set; Based on the similar glyph relationship, the replaceable entity words are replaced with words to obtain a second replacement text set; The first and second permutation texts are combined to obtain the permutation text set.
4. The method as described in claim 3, characterized in that, The step of summing the first and second permuted texts to obtain the permuted text set further includes: Based on the similar characters in the similar character shape relationship, the replaced entity words in the first replacement text set are replaced again to obtain the third replacement text set; Based on the homophones in the aforementioned homophone relationships, the replaced entity words in the second replacement text set are replaced again to obtain the fourth replacement text set; The third and fourth permutation text sets are combined to obtain the permutation text set.
5. The method as described in claim 4, characterized in that, The step of training the context semantic recognition model using the complete training text set to obtain the trained context semantic recognition model includes: The complete training text set is input into the neural network model to be trained to obtain the prediction result; Based on the prediction results and the actual results in each text of the complete training text set, a first loss function is determined, wherein the actual results are used to indicate whether a word in each text of the pre-annotated complete training text set has been replaced; Using the original training text set and the complete training text set, determine the second loss function; The neural network model to be trained is fine-tuned based on the first loss function and the second loss function to obtain a trained context semantic recognition model.
6. The method as described in claim 1, characterized in that, The process involves using a pre-trained context semantic recognition model to encode features and calculate candidate error correction probabilities for the text to be corrected and the set of words to be predicted, resulting in the candidate error correction probability for each character in the character vector set of the words to be corrected. This includes: The context semantic recognition model is used to encode the text to be corrected and the set of incorrect words to be predicted to obtain a first semantic vector and a set of character vectors of words to be corrected. Multiply the first semantic vector and the set of character vectors of the word to be corrected to obtain the candidate error correction probability of each character in the set of character vectors of the word to be corrected.
7. A text correction device, characterized in that, The device includes: Text acquisition module: used to generate a first file frame associated with the first terminal when receiving an error correction request sent by an authorized first terminal, the first file frame being used to acquire the text to be corrected entered by the user; Text processing module: used to perform convolution operation on the text to be corrected to obtain similar character information, perform text prediction based on easily confused characters and similarity weights between easily confused characters in the similar character information to obtain a first predicted text set, or, to perform phrase division on the text to be corrected to obtain multiple phrases, generate candidate texts corresponding to the text to be corrected based on the multi-grammar of each character in each phrase, and summarize the candidate texts that meet the preset semantic probability to obtain a first predicted text set. Field comparison module: used to extract fields that do not match the text to be corrected in the first predicted text set, perform word segmentation processing, and generate a set of incorrect words to be predicted; The semantic prediction module is used to use a pre-trained context semantic recognition model to perform feature encoding and calculate candidate error correction probabilities on the text to be corrected and the set of incorrect words to be predicted, so as to obtain the candidate error correction probabilities of each character in the character vector set of the word to be corrected, and select the character vector corresponding to the candidate error correction probability with the highest probability from the candidate error correction probabilities of each character in the character vector set of the word to be corrected for decoding to generate the second predicted word. Text replacement module: used to replace the erroneous words in the text to be predicted and corrected with the second predicted word, so as to obtain the corrected text.
8. An electronic device, characterized in that, The electronic device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the text correction method as described in any one of claims 1 to 5.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the text correction method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Text recognition method and device, electronic equipment and storage medium
CN111753822A
Text error correction method and device, equipment and storage medium
CN116258137A