Text correction method and device, equipment, computer storage medium and program product
Patent Information
- Application Number
- CN202111346650.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-15
- Publication Date
- 2026-08-28
- Estimated Expiration
- 2041-11-15
AI Technical Summary
相关技术中,在进行文本纠错时,存在字形和发音的特征利用率较低,进而导致文本纠错的准确率较低的问题
[0032]本申请实施例具有以下有益效果:文本纠错设备能够将待纠错文本的字符信息按照树形结构进行拆解,从而得到能够完整保存字符信息的空间结构特征的字形特征,同时从字符信息的发音信息中挖掘出发音特征,针对字符信息本身挖掘出文本特征,再结合字形特征、发音特征和文本特征这三个维度的特征共同得到融合特征对待纠错文本进行纠错,以在文本纠错对字符信息发音和字形维度上的特征都能被充分的利用,从而提高了文本纠错的准确率。
Smart Images

Figure CN116167361B_ABST
Abstract
Description
Technical Field
[0001] This application relates to natural language processing technology, and more particularly to a text correction method, apparatus, device, computer storage medium, and program product. Background Technology
[0002] Text correction refers to the process of identifying erroneous characters in text and providing corresponding correct characters to facilitate users in generating higher-quality text based on the provided correct characters. Most text errors are glyph-related or pronunciation-related. In related technologies, text correction suffers from low utilization of glyph and pronunciation features, leading to lower accuracy. Summary of the Invention
[0003] This application provides a text correction method, apparatus, device, computer-readable storage medium, and program product, which can improve the accuracy of text correction.
[0004] The technical solution of this application embodiment is implemented as follows:
[0005] This application provides a text correction method, including:
[0006] Based on the tree-structured decomposition of the character information of the text to be corrected, the glyph features of the character information are determined; the glyph features include the spatial structural features of the character information.
[0007] Extract pronunciation features from the pronunciation information of the character information, and extract text features from the character information;
[0008] The glyphic features, the pronunciation features, and the text features are fused to obtain the fused features of the character information;
[0009] Based on the fusion features, the text to be corrected is corrected to obtain the corrected text corresponding to the text to be corrected.
[0010] This application provides a text correction device, including:
[0011] The feature extraction module is used to perform tree-like structural decomposition of the character information of the text to be corrected, and determine the glyph features of the character information; the glyph features include the spatial structural features of the character information; extract pronunciation features from the pronunciation information of the character information, and extract text features from the character information;
[0012] The feature fusion module is used to fuse the glyph features, the pronunciation features, and the text features to obtain the fused features of the character information;
[0013] The text correction module is used to correct errors in the text to be corrected based on the fusion features, so as to obtain the corrected text corresponding to the text to be corrected.
[0014] In some embodiments of this application, the feature extraction module is further configured to perform tree-like structural decomposition on the character information in the text to be corrected to obtain a glyph tree; and generate the glyph features of the character information based on the node features corresponding to each node in the glyph tree.
[0015] In some embodiments of this application, the feature extraction module is further configured to identify at least one radical character from the character information of the text to be corrected, and determine the character information disassembly operation based on the spatial structure of at least one radical character; identify at least one stroke shape from each radical character, and determine the disassembly operation of each radical character based on the spatial structure of at least one stroke shape; determine the character information disassembly operation as the root node, determine the disassembly operation of each radical character as the parent node under the root node, and determine at least one stroke shape as the child node corresponding to the parent node, thereby obtaining the character tree.
[0016] In some embodiments of this application, the feature extraction module is further configured to recursively derive the node features corresponding to each parent node using the stroke features of the child nodes under each parent node in the character tree, and the stroke features of each parent node; wherein, the stroke features of each parent node are the stroke features corresponding to the decomposition operation of each radical character; the node features corresponding to the root node are recursively derived using the node features of the parent nodes under the root node, and the stroke features corresponding to the decomposition operation of the character information; and the node features corresponding to the root node are determined as the character features of the character information.
[0017] In some embodiments of this application, the feature extraction module is further configured to decompose the pronunciation information of the character information into a sequence of pronunciation letters; obtain the sub-pronunciation features corresponding to each pronunciation letter in the sequence of pronunciation letters; and mine the contextual relationships for each sub-pronunciation feature of the pronunciation letter to obtain the pronunciation features.
[0018] In some embodiments of this application, the feature extraction module is further configured to: determine character features for the character information; determine the position features corresponding to the character information using the position information of the character information in the text to be corrected; fuse the character features and the position features to obtain the composite features of the character information; and extract features from the composite features to obtain the text features of the character information.
[0019] In some embodiments of this application, the feature fusion module is further configured to perform attention-based multi-channel interaction on the pronunciation features, the glyph features, and the text features to obtain interaction features; fuse the interaction features with the pronunciation features, the glyph features, and the text features respectively to obtain pronunciation interaction features, glyph interaction features, and text interaction features; and determine the pronunciation interaction features, the glyph interaction features, and the text interaction features as the fusion features of the character information.
[0020] In some embodiments of this application, the text correction module is further configured to predict, based on the text interaction features, the pronunciation interaction features, and the glyph interaction features, candidate correction characters, matching pronunciations, and matching glyphs of the character information of the text to be corrected; calculate the joint confidence of the candidate correction characters based on the confidence of the candidate correction characters, the confidence of the matching pronunciations, and the confidence of the matching glyphs; filter out erroneous characters from the character information of the text to be corrected according to the joint confidence, and determine the candidate correction characters corresponding to the erroneous characters as the target correction characters of the erroneous characters; and replace the erroneous characters using the target correction characters to obtain the corrected text of the text to be corrected.
[0021] In some embodiments of this application, the step of determining the glyph features of the character information based on the tree-like structural decomposition of the character information of the text to be corrected is achieved through a target glyph model;
[0022] The extraction of pronunciation features from the pronunciation information of the character information is achieved through a target pronunciation model, and the extraction of text features from the character information is achieved through a target text model.
[0023] The process of fusing the glyph features, pronunciation features, and text features to obtain the fused features of the character information, and the process of correcting the text to be corrected based on the fused features to obtain the corrected text corresponding to the text to be corrected, are achieved through a target prediction model.
[0024] In some embodiments of this application, the text correction device further includes: a model training module;
[0025] The model training module is used to acquire an initial text model, an initial glyph model, an initial pronunciation model, and an initial prediction model; pre-train the initial text model using first training data to obtain a pre-trained text model; the first training data is unlabeled text data with mask replacement; multi-objective pre-training is performed on the initial glyph model, the initial pronunciation model, the pre-trained text model, and the initial prediction model using second training data to obtain candidate glyph models, candidate pronunciation models, candidate text models, and candidate prediction models; wherein, the second training data is unlabeled text data with error character replacement; and the candidate glyph models, the candidate pronunciation models, the candidate text models, and the candidate prediction models are optimized using third training data to obtain the target glyph model, the target pronunciation model, the target text model, and the target prediction model; the third training data is data with labeled error text and correct text.
[0026] In some embodiments of this application, the model training module is further configured to: decompose the training characters in the second training text into a tree structure using the initial glyph model; extract training pronunciation features from the pronunciation information of the training characters using the initial pronunciation model; extract training text features from the training characters using the pre-trained text model; fuse the training glyph features, the training pronunciation features, and the training text features using the initial prediction model to obtain training fusion features of the training characters; correct errors in the second training data based on the training fusion features to obtain training corrected text; determine a training loss value based on the difference between the training corrected text and the ground truth text corresponding to the second training data; wherein the ground truth text is text data that has not undergone error character replacement; continuously adjust the parameters of the initial glyph model, the initial pronunciation model, the pre-trained text model, and the initial prediction model using the training loss value until the training termination condition is met, thereby obtaining the candidate glyph model, the candidate pronunciation model, the candidate text model, and the candidate prediction model.
[0027] This application provides a text correction device, including:
[0028] Memory, used to store executable instructions;
[0029] The processor, when executing executable instructions stored in the memory, implements the text correction method provided in the embodiments of this application.
[0030] This application provides a computer-readable storage medium storing executable instructions for inducing a processor to execute and implement the text correction method provided in this application.
[0031] This application provides a computer program product, including a computer program or instructions, which, when executed by a processor, implements the text correction method provided in this application.
[0032] The embodiments of this application have the following beneficial effects: The text correction device can decompose the character information of the text to be corrected according to a tree structure, thereby obtaining glyph features that can completely preserve the spatial structural features of the character information. At the same time, it can extract pronunciation features from the pronunciation information of the character information and extract text features from the character information itself. Then, it combines the features of the three dimensions of glyph features, pronunciation features and text features to obtain fused features for correcting the text to be corrected. This allows the features of the character information in both pronunciation and glyph dimensions to be fully utilized in text correction, thereby improving the accuracy of text correction. Attached Figure Description
[0033] Figure 1 This is a schematic diagram of the architecture of the text correction system provided in the embodiments of this application;
[0034] Figure 2 This is provided by the embodiments of this application. Figure 1 A schematic diagram of the server structure in the diagram;
[0035] Figure 3 This is a flowchart illustrating a text correction method provided in an embodiment of this application;
[0036] Figure 4 This is a schematic diagram of the tree-shaped character structure provided in the embodiments of this application;
[0037] Figure 5 This is a flowchart illustrating another text correction method provided in an embodiment of this application;
[0038] Figure 6 This is a schematic diagram illustrating the process of constructing a glyph tree provided in an embodiment of this application;
[0039] Figure 7 This is a schematic diagram of the node characteristics of the recursive parent node provided in the embodiments of this application;
[0040] Figure 8 This is a flowchart illustrating yet another text correction method provided in an embodiment of this application;
[0041] Figure 9 This is a schematic diagram of the extraction of pronunciation features provided in an embodiment of this application;
[0042] Figure 10 This is a schematic diagram of the process of extracting text features provided in the embodiments of this application;
[0043] Figure 11 This is a schematic diagram illustrating the process of generating fusion features provided in an embodiment of this application;
[0044] Figure 12 This is a flowchart illustrating another text correction method provided in an embodiment of this application;
[0045] Figure 13 This is a schematic diagram illustrating the process of constructing a model for correcting video titles, as provided in an embodiment of this application.
[0046] Figure 14 This is an overall framework diagram of the sound and shape enhancement model provided in the embodiments of this application. Detailed Implementation
[0047] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0048] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0049] In the following description, the terms "first, second, third" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0050] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0051] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.
[0052] 1) Artificial Intelligence (AI) is the theory, methods, technology, 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 achieve optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess the functions of perception, reasoning, and decision-making.
[0053] Artificial intelligence (AI) is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, as well as machine learning / deep learning, autonomous driving, and intelligent transportation.
[0054] 2) Natural Language Processing (NLP) is an important field within computer science and artificial intelligence. It studies the theories and methods for enabling effective communication between humans and computers using natural language. NLP is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field involves natural language—the language people use in daily life—and thus it has a close relationship with linguistic research. NLP technologies typically include text processing, semantic understanding, machine translation, question answering, and knowledge graphs.
[0055] 3) Machine Learning (ML) is a multidisciplinary field involving probability theory, statistical learning, approximation theory, convex analysis, and algorithm complexity theory. It specifically studies how computers can simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to endow computers with intelligence; its applications span all areas of artificial intelligence. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, and inductive learning.
[0056] 4) Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or local area network to realize data computing, storage, and sharing.
[0057] Cloud technology is a general term encompassing network technology, information technology, integration technology, management platform technology, and application technology based on the cloud computing business model. It can form resource pools, providing flexible and convenient on-demand access. Cloud computing technology will become a crucial support. Backend services of technical network systems require substantial computing and storage resources, such as video websites, image websites, and many portal websites. With the rapid development and application of the internet industry, every item may have its own identification mark in the future, requiring transmission to backend systems for logical processing. Data at different levels will be processed separately, and various industry data will all require robust system support, which can only be achieved through cloud computing.
[0058] 5) Text correction refers to the process of analyzing text, locating erroneous characters, and determining the correct characters corresponding to those erroneous characters. For example, locating typos in video titles and providing the correct Chinese characters for those typos so that users can use the correct characters to replace the typos and input higher-quality video titles.
[0059] Text correction refers to the process of identifying erroneous characters in text and providing the correct characters to help users generate higher-quality text. For example, in the case of video titles, due to user oversight or misoperation, about 3% of video titles may contain errors.
[0060] Most errors in text are glyph-related or pronunciation-related. In related technologies, there are two commonly used error correction methods for these two types of text errors.
[0061] One approach is to use graph neural networks to model the similarity between character shapes and pronunciations to obtain feature representations of Chinese character shapes and pronunciations. Then, based on these feature representations, text correction can be assisted. However, when using graph neural networks to model character shapes and pinyin, only the similarity between the shapes and pronunciations of Chinese characters is utilized. Feature mining is not performed on the character structure itself or the pronunciation itself, resulting in low utilization of character shape and pronunciation features and consequently, poor accuracy in text correction.
[0062] Another approach involves decomposing the glyphs of Chinese characters into stroke sequences and their pronunciations into letter sequences. Then, gated recurrent units (GRUs) are used to construct feature representations of the glyphs and pronunciations. These representations are then superimposed on the character feature representations to improve text correction capabilities. However, this method loses the two-dimensional spatial features of the glyphs when decomposing them into stroke sequences. Consequently, the glyph features are not fully utilized, resulting in low utilization rates of glyph and pronunciation features, and consequently, lower accuracy in text correction.
[0063] Furthermore, the above method does not utilize the feature representations of glyphs and pronunciations in the pre-training of the language model, thereby further reducing the utilization rate of glyph and pronunciation features and resulting in poor accuracy of text correction.
[0064] This application provides a text correction method, apparatus, device, computer-readable storage medium, and program product, which can improve the accuracy of text correction. The exemplary application of the text correction device provided in this application is described below. The text correction device provided in this application can be implemented as various types of terminals or as a server. The exemplary application of the text correction device as a server will be described below.
[0065] See Figure 1 , Figure 1 This is a schematic diagram of the architecture of the text correction system provided in this application embodiment. To support a text correction application, in the text correction system 100, the terminal 400 connects to the server 200 via a network 300, which can be a wide area network (WAN), a local area network (LAN), or a combination of both. The text correction system 100 also includes a database 500 for providing data support to the server 200. The database 500 can be independent of the server 200 or configured within the server 200.
[0066] Terminal 400 is used to receive the text to be corrected displayed by the user on the text input interface 410, and send the text to be corrected to server 200 via network 300.
[0067] Server 200 receives the text to be corrected sent by terminal 400; it performs tree-structure decomposition on the character information of the text to be corrected to determine the glyph features of the character information; it extracts pronunciation features from the pronunciation information of the character information and extracts text features from the character information; it fuses the glyph features, pronunciation features and text features to obtain the fused glyph features; based on the fused features, it corrects the text to be corrected to obtain the corrected text corresponding to the text to be corrected, thus completing the text correction.
[0068] Server 200 is also used to send the correction text to terminal 400, and terminal 400 is also used to display the correction text on the text input interface.
[0069] In some embodiments, server 200 may be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, 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, CDN, and big data and artificial intelligence platforms. Terminal 400 may be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, smart home appliance, in-vehicle terminal, etc., but is not limited to these. Terminals and servers can be directly or indirectly connected via wired or wireless communication, which is not limited in this embodiment of the invention.
[0070] Furthermore, the number of terminals 400 can be one or more; the number of servers 200 can be one or more (multiple servers 200 can form a server cluster for text error correction processing). That is to say, in this embodiment of the application, the number of terminals 400 and servers 200 is not limited.
[0071] Below, in conjunction with Figure 2 This section uses a server as an example to illustrate the structure of a text correction device. See [link / reference]. Figure 2 , Figure 2 This is provided by the embodiments of this application. Figure 1 A schematic diagram of the server structure in the diagram. Figure 2 The server 200 shown includes at least one processor 210, memory 250, and at least one network interface 220. The various components of server 200 are coupled together via a bus system 240. It is understood that the bus system 240 is used to implement communication between these components. In addition to a data bus, the bus system 240 also includes a power bus, a control bus, and a status signal bus. However, for clarity, ... Figure 2 The general labeled all buses as Bus System 240.
[0072] Processor 210 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0073] The memory 250 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state storage, hard disk drives, optical disk drives, etc. The memory 250 may optionally include one or more storage devices physically located away from the processor 210.
[0074] The memory 250 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), and the volatile memory may be random access memory (RAM). The memory 250 described in this application embodiment is intended to include any suitable type of memory.
[0075] In some embodiments, memory 250 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof, as illustrated below.
[0076] Operating system 251 includes system programs for handling various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, driver layer, etc., for implementing various basic business functions and handling hardware-based tasks;
[0077] The network communication module 252 is used to reach other computing devices via one or more (wired or wireless) network interfaces 220, such as Bluetooth, Wi-Fi, and Universal Serial Bus (USB).
[0078] In some embodiments, the text correction device provided in this application can be implemented in software. Figure 2 A text correction device 255 stored in memory 250 is shown. This device can be software in the form of programs or plug-ins, and includes the following software modules: a feature extraction module 2551, a feature fusion module 2552, a text correction module 2553, and a model training module 2554. These modules are logically connected and can therefore be arbitrarily combined or further separated according to their implemented functions. The functions of each module will be described below.
[0079] In other embodiments, the text correction device provided in this application can be implemented in hardware. As an example, the text correction device provided in this application can be a processor in the form of a hardware decoding processor, which is programmed to execute the text correction method provided in this application. For example, the processor in the form of a hardware decoding processor can be one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.
[0080] Exemplary, exemplary, this application embodiment provides a text correction device, including:
[0081] Memory, used to store executable instructions;
[0082] The processor, when executing executable instructions stored in the memory, implements the text correction method provided in the embodiments of this application.
[0083] In some embodiments, the terminal or server can implement the text correction method provided in this application by running a computer program. For example, the computer program can be a native program or software module in an operating system; it can be a native application (APP), i.e., a program that needs to be installed in the operating system to run; it can also be a small program, i.e., a program that only needs to be downloaded to a browser environment to run; or it can be a small program that can be embedded in any APP. In short, the above-mentioned computer program can be any form of application, module, or plugin.
[0084] This application's embodiments can be applied to various scenarios such as cloud technology, artificial intelligence, smart transportation, and vehicle-mounted systems. Furthermore, this application's embodiments are primarily applied in scenarios involving text processing, such as intelligent text input scenarios under artificial intelligence, location retrieval scenarios under smart transportation (retrieving locations through input text), and so on. Below, the text correction method provided by this application's embodiments will be described in conjunction with exemplary applications and implementations of the text correction device provided in this application's embodiments.
[0085] See Figure 3 , Figure 3is a schematic flowchart of a text error correction method provided by an embodiment of the present application. The text error correction method provided by the embodiment of the present application can be executed by a text error correction device. The description will be made in conjunction with Figure 3 the illustrated steps.
[0086] S101, performing tree-shaped structure disassembly on character information of a text to be corrected, and determining glyph features of the character information.
[0087] The embodiments of the present application are implemented in the scenario of correcting text errors. For example, the method is implemented in scenarios such as correcting a video title input by a user and correcting sentences in a novel written by a user. In the embodiment of the present application, the text error correction device first acquires the text to be error-corrected, that is, acquires the text to be corrected, then performs tree-shaped structure disassembly on each piece of character information in the text to be corrected, and then determines the glyph feature corresponding to each piece of character information based on the disassembled tree-shaped glyph structure.
[0088] It can be understood that the text to be corrected can be a short text with the number of characters less than a word number threshold, such as a video title, a user's short message, etc. The text to be corrected can also be a long text with the number of characters greater than the word number threshold, such as a full-length novel, a long article, etc., which is not limited in the present application. The character information can be Chinese characters, English characters, and other characters with a two-dimensional spatial structure.
[0089] It should be noted that disassembly of character information into a tree-shaped structure essentially uses a tree-shaped structure to store the spatial structure composition of the glyph of the character information. For example, a root node in the tree-shaped structure stores the character, a parent node in the tree-shaped structure records radicals that form the character, and a child node in the tree-shaped structure records the stroke composition of the character, etc. In this way, the two-dimensional spatial features of the glyph can be completely retained, so the glyph features obtained based on the tree-shaped glyph structure also retain the two-dimensional spatial structure of the glyph, which can better indicate whether the glyphs are similar. That is, the glyph features include the spatial structure features of the character information.
[0090] For example, Figure 4 is a schematic diagram of a tree-shaped glyph structure provided by an embodiment of the present application. For the Figure 4 character information therein, for example, "pin" (poor) 4-1 can be composed of "fen" (divide) 4-11 and "bei" (shell) 4-12, while "fen" 4-11 can be further composed of "ba" 4-111 and "dao" 4-112, and "bei" 4-12 is composed of "men" (gate) 4-121 and "ren" (person) 4-122. In this way, the tree-shaped glyph structure of "pin" can be obtained. After the text error correction device disassembles "pin" 4-1 into a tree-shaped glyph structure, the glyph features generated based on the tree-shaped glyph structure can still retain the two-dimensional spatial structure of the character information.
[0091] S102. Extract pronunciation features from the pronunciation information of character information, and extract text features from the character information.
[0092] The text correction device acquires the pronunciation information of each character, then extracts features from the pronunciation information to obtain pronunciation features. Simultaneously, the text correction device also extracts features from each character to obtain text features.
[0093] It is understandable that the pronunciation information of character information can be obtained by acquiring the pinyin letters entered by the user when inputting the character information, or by searching for standard pronunciation information for the character information on the Internet. Furthermore, the pronunciation information is the pronunciation of the character information, which can be a sequence of pinyin letters, or a sequence of phonetic symbols such as vowels and consonants; this application does not limit this.
[0094] In some embodiments, the text correction device can decompose pronunciation information into a sequence of pronunciation letters (e.g., pinyin letters, vowels, etc.), and then extract sequence features from this sequence to obtain pronunciation features. In other embodiments, the text correction device can also match pronunciation information with preset pronunciations to determine the preset features corresponding to the matched preset pronunciations as the pronunciation features of the character information. The preset features of the preset pronunciations can be manually constructed or learned by the text correction device using machine learning methods such as clustering or artificial neural networks.
[0095] In some embodiments, the text correction device can utilize a deep learning model to extract character-level features from character information, thereby obtaining text features. In other embodiments, the text correction device can also determine text features based on the position of character information in the text to be corrected and the context of the character information; this application does not limit this to specific embodiments.
[0096] It should be noted that the order in which glyph features, pronunciation features, and text features are extracted does not affect the final text correction process. Therefore, in the embodiments of this application, the text correction device may execute S101 first and then S102, or it may execute S102 first and then S101, or it may execute S101 and S102 simultaneously. This application does not impose any limitations on this.
[0097] S103. The glyph features, pronunciation features, and text features are fused to obtain the fused features of character information.
[0098] After obtaining glyphic features, pronunciation features, and text features, the text correction device can perform multi-channel feature interaction on the glyphic features, pronunciation features, and text features to obtain fused features that can integrate the two-dimensional spatial structure of the glyphic shape, pronunciation, and the features of the character information itself, thereby enhancing the feature representation capability of each character information.
[0099] In some embodiments, the text correction device can directly concatenate glyph features, pronunciation features, and text features to obtain a fused feature for each character.
[0100] In other embodiments, the text correction device may simultaneously input glyph features, pronunciation features, and text features into a multi-channel feature extraction model to extract features using the multi-channel feature extraction model, and then directly use the extracted features as fusion features, or perform residual fusion of the extracted features with glyph features, pronunciation features, and text features respectively to obtain fusion features for each character information. This application does not limit this.
[0101] S104. Based on the fusion features, perform error correction on the text to be corrected to obtain the corrected text corresponding to the text to be corrected.
[0102] After obtaining the fused features, the text correction device can identify these features to determine the position of the erroneous character in the text to be corrected, as well as the corresponding correct character. The correct character is then used to correct the erroneous character, resulting in the corrected text.
[0103] It should be noted that, in some embodiments, the text correction device can determine the adjacent fusion features of adjacent characters of each character information, i.e., context features, based on the fusion features of each character information. Then, it can use the context features to predict the character position of each character. Then, based on whether the predicted character is consistent with the actual character at each character position (e.g., the character originally entered by the user), if they are inconsistent, the character position is determined to be the position of the character to be corrected. At this time, the predicted character is the correct character.
[0104] In other embodiments, the text correction device can also utilize the fusion features of each character information to predict the predicted character, the matching pronunciation, and the matching glyph corresponding to each character information. Then, based on the confidence levels of the predicted character, the matching pronunciation, and the matching glyph, it can filter out erroneous characters from the text to be corrected, and then determine the predicted character corresponding to the erroneous character as the correct character for replacement, thereby generating the corrected text.
[0105] Understandably, compared to related technologies that use graph neural networks to model the similarity of character shapes and pronunciations to achieve text correction, or decompose Chinese characters into stroke sequences and pronunciations into letter sequences to achieve text correction, the text correction device in this application can decompose the character information of the text to be corrected according to a tree structure, thereby obtaining character shape features that can completely preserve the spatial structural features of character information. At the same time, it can extract pronunciation features from the pronunciation information of character information, extract text features from the character information itself, and then combine the features of character shape features, pronunciation features, and text features to obtain fused features for correcting the text to be corrected. This ensures that the features of character information in both pronunciation and character shape dimensions can be fully utilized in text correction, thereby improving the accuracy of text correction.
[0106] based on Figure 3 See Figure 5 , Figure 5 This is a flowchart illustrating another text correction method provided in an embodiment of this application. In some embodiments of this application, based on the tree-structured decomposition of the character information of the text to be corrected, the glyph features of the character information are determined. The specific implementation process of S101 may include: S1011-S1012, as follows:
[0107] S1011. Decompose the character information in the text to be corrected into a tree structure to obtain a character tree.
[0108] In some embodiments, the text correction device performs a tree-like structural decomposition on each character information in the text to be corrected, that is, using the character information as the root node, the radical of the character information as the parent node, and the strokes of the radical as the child nodes to form a multi-branch tree. The multi-branch tree formed is the character tree.
[0109] In other embodiments, the text correction device can further decompose each character information according to its radicals and the strokes of the radicals, determine the decomposition operation (e.g., top-bottom decomposition, left-right decomposition, etc.) for the character information as the root node, then determine the decomposition operation of the radical as the parent node, and take the strokes that make up the radical as the child nodes to form a multi-branch tree, thereby obtaining the character tree.
[0110] S1012. Generate character features based on the node features corresponding to each node in the character tree.
[0111] Next, the text correction device determines the node features corresponding to each node in the glyph tree and extracts the node features corresponding to the root node of the glyph tree as the glyph features of the character information. In this way, the spatial structural features of the character information are preserved in the glyph features.
[0112] It can be understood that the text error correction device may acquire node features of child nodes, that is, the feature representation corresponding to strokes, then reversely recursively obtain node features of parent nodes, that is, node features of radicals or decomposition operations, by using the node features of the child nodes, and repeat this process until recursing to the root node, and directly determine the node features of the root node as the glyph features.
[0113] In the embodiments of the present application, the text error correction device can first decompose character information into a glyph tree to represent the two-dimensional spatial structure of the character information through the glyph tree, and then mine glyph features from the node features of each node of the glyph tree, so that the spatial structure features of the character information are retained, and the glyph features of the character information are fully utilized.
[0114] In some embodiments of the present application, the specific implementation process of performing tree-shaped structural decomposition on the character information in the text to be corrected to obtain a glyph tree, that is, S1011, may include S1011a-S1011c (not shown in the accompanying drawings), which is as follows:
[0115] S1011a: identifying at least one radical character from the character information of the text to be corrected, and determining a decomposition operation for the character information according to the spatial structure of the at least one radical character.
[0116] The text error correction device first performs radical recognition on each piece of character information in the text to be corrected, so as to determine the radical characters that form the character information, and meanwhile determines the decomposition operation for the character information according to the spatial structure between different radical characters, for example, upper-lower structure, left-right structure and the like, that is, determines how to decompose to obtain at least one radical character.
[0117] S1011b: identifying at least one stroke shape from each radical character, and determining a decomposition operation for each radical character based on the spatial structure of the at least one stroke shape.
[0118] Then, the text error correction device continues to perform step-by-step recognition on the radical characters until the stroke shapes forming the radical characters are recognized, and then determines how to decompose to obtain the stroke shapes, thereby determining the decomposition operation for each radical character.
[0119] It should be noted that in some embodiments, radical characters are directly composed of stroke shapes. For example, the radical character "人" is directly composed of "丿" and , and "乃" is composed of "ㄋ" and "丿". In this case, the text error correction device directly determines the decomposition operation when the radical character is decomposed into stroke shapes.
[0120] In some other embodiments, radical characters are not directly composed of stroke shapes, but are composed of simpler characters. For example, the radical "分" of the character "贫" is composed of "八" and "刀", and "贝" is composed of "门" and "人". In this case, the text error correction device disassembles the radical characters level by level, and determines the disassembly operation corresponding to the constituent characters of each level of the radical characters until the radical characters are disassembled into stroke shapes. All these disassembly operations are disassembly operations for radical characters.
[0121] S1011c, determining the disassembly operation of character information as a root node, determining the disassembly operation of each radical character as a parent node under the root node, and determining at least one stroke shape as a child node corresponding to the parent node, so as to obtain a character shape tree.
[0122] The text error correction device determines the disassembly operation of character information as a root node, determines the disassembly operation of each radical character as a parent node, and determines each stroke shape as a child node, so that a character shape tree can be constructed. It can be understood that when a radical character is composed of simpler characters, the text error correction device constructs the character shape tree according to the principle that: the disassembly operation of complex characters that cannot be directly disassembled into stroke shapes is determined as a high-level parent node, and the disassembly operation of simple characters that can be directly disassembled into stroke shapes is determined as a low-level parent node (low-level parent nodes can be regarded as child nodes of high-level parent nodes, and low-level parent nodes are the most direct parent nodes of child nodes).
[0123] For example, Figure 6 is a schematic diagram of the process of constructing a character shape tree provided by the embodiments of the present application. Referring to Figure 6 , for the character information "贫", the text error correction device determines its disassembly operation, that is, top-bottom disassembly 6-1, as the root node. At this time, the first-level disassembly 6-A is completed, and two radical characters "分" and "贝" of "贫" 6-1 are obtained. Then, the text error correction device performs top-bottom disassembly 6-2 on "分", and performs semi-enclosed disassembly 6-3 on "贝", then determines top-bottom disassembly 6-2 and semi-enclosed disassembly 6-3 as first-level parent nodes, completes the second-level disassembly 6-B, and obtains simpler constituent characters "八" and "刀" of "分", as well as simpler constituent characters "门" and "人" of "贝". Then, the text error correction device continues to perform left-right disassembly 6-4 on "八", independent character disassembly 6-5 on "刀", left-right disassembly 6-6 on "门", and left-right disassembly 6-7 on "人", then determines left-right disassembly 6-4, independent character disassembly 6-5, left-right disassembly 6-6 and left-right disassembly 6-7 as second-level parent nodes, and takes "丿" obtained by disassembly, "", "丿", "丨", "", "丿" and Once identified as a child node, the third-level decomposition 6-C is completed. This yields the final glyph tree.
[0124] In this embodiment, the text correction device determines the character information decomposition operation as the root node, the radical character decomposition operation as the parent node, and the stroke shape as the child node, so as to form the most basic stroke shapes that can clearly define the character information and the composition of the stroke shapes in two-dimensional space, thus preserving the two-dimensional spatial structure of the character information.
[0125] In some embodiments of this application, the specific implementation process of generating character information glyph features based on the node features corresponding to each node in the glyph tree, i.e., S1012, may include: S1012a-S1012c (not shown in the figures), as follows:
[0126] S1012a. Using the stroke features of the child nodes under each parent node in the character tree, and the stroke features of each parent node, recursively derive the node features corresponding to each parent node.
[0127] Since the spatial structure of radical characters must not only represent what kind of stroke shapes they are composed of, but also how the stroke shapes are combined (i.e., the combination method corresponding to the decomposition operation), when the text correction device recursively examines the node features of each parent node, it must not only clarify the features of all child nodes under each parent node, but also clarify the features of each parent node, i.e., the decomposition operation of each radical character itself.
[0128] It should be noted that the node features of child nodes under each parent node are the stroke shape features. The text correction device can obtain the node features of child nodes under each parent node in the character tree by querying the stroke shape feature table. The decomposition of radical characters can be considered a special type of stroke; therefore, the text correction device can obtain the stroke features of the parent node by looking up the stroke features corresponding to the decomposition of radical characters. In other words, the stroke features of the parent node are the stroke features corresponding to the decomposition of each radical character. Furthermore, the stroke features in the stroke shape feature table are updated during the training process of the character model.
[0129] Of course, the text correction device can also encode the stroke shape through an encoder to determine the stroke features of the child node, and encode the decomposition operations of the radical character and the character information through an encoder to determine the stroke features of the parent node. This application does not limit this.
[0130] In some embodiments, the text error correction device may obtain the node feature corresponding to the parent node by directly splicing the node feature of each child node, the node feature of sibling nodes, and the disassembly feature corresponding to the disassembly operation of radical characters.
[0131] In other embodiments, the text error correction device may also input the node features of each child node under each parent node and the stroke feature of the parent node into a feature extraction model respectively, then perform activation processing on the features extracted by the feature extraction model to obtain processed features of each child node respectively, and then multiply the processed features of each child node to obtain the node feature of each parent node.
[0132] For example, based on Figure 6 , refer to Figure 7 , Figure 7 it is a schematic diagram of node features of recursive parent nodes provided by the embodiments of the present application. For the parent node of left-right disassembly 6-7, the text error correction device respectively determines the stroke features of all its child nodes, that is, the stroke feature 7-1 of "丿" and the stroke feature 7-2 of, and the stroke feature 7-3 of left-right disassembly 6-7. Then the stroke feature 7-1 and the stroke feature 7-3 are combined and input into the fully connected layer 7-41, and the processed feature is obtained through the activation function 7-42 (e.g., Tanh function). The stroke feature 7-2 and the stroke feature 7-3 are combined and input into the fully connected layer 7-51, and the processed feature is obtained through the activation function 7-52 (e.g., Sigmoid function). Finally, the two processed features are multiplied 7-6, so that the node feature 7-7 of the parent node of left-right disassembly 6-7 can be obtained.
[0133] It should be noted that when the parent nodes in the glyph tree are divided into multiple levels, the text error correction device first recursively obtains the node feature of the parent node at the upper level of the child node, that is, the node feature of the most direct parent node of the child node, then uses the node features of these parent nodes as new child nodes, and continues to recursively obtain the node features of parent nodes at higher levels until corresponding node features are recursively obtained for all parent nodes.
[0134] S1012b, using the node features of the parent nodes under the root node and the stroke features corresponding to the disassembly operation of character information, recursively obtain the node feature corresponding to the root node.
[0135] It can be understood that the text error correction device can obtain the node feature corresponding to the root node by performing the same processing process as S1012a on the node features of all parent nodes under the root node and the stroke features corresponding to the disassembly of character information.
[0136] S1012c: Determine the node features corresponding to the root node as the glyph features of the character information.
[0137] In this embodiment of the application, the text correction device will recursively calculate from the child nodes of the character tree to the root node of the character tree, that is, to perform recursive calculations on the character tree from bottom to top, so as to obtain the character features that can integrate the stroke features and character information of different child nodes and the stroke features of radical characters, ensuring that the two-dimensional spatial structure of the character is preserved in the character features.
[0138] based on Figure 3 See Figure 8 , Figure 8 This is a flowchart illustrating another text correction method provided in an embodiment of this application. In some embodiments of this application, the specific process of extracting pronunciation features from the pronunciation information of character information, i.e., S102, may include: S1021-S1023, as follows:
[0139] S1021. Decompose the pronunciation information of the character information into a sequence of pronunciation letters.
[0140] Text correction devices can break down pronunciation information into phonetic letters based on the language type of the character information, thus obtaining a sequence of phonetic letters. For example, when the language type of the character information is Chinese, the text correction device will break down the pronunciation information into a sequence of pinyin letters; when the language type of the character information is English, the text correction device will break down the pronunciation information into a sequence of phonetic symbols.
[0141] S1022. Obtain the sub-pronunciation features corresponding to each pronunciation letter in the pronunciation letter sequence.
[0142] Text correction devices can obtain sub-pronunciation features by querying a pronunciation feature table for each letter in a sequence of pronunciation letters, or by encoding each pronunciation character; this application does not limit the scope of the sub-pronunciation features. It is understood that the pronunciation feature table is updated during the training process of the pronunciation model.
[0143] S1023. For each pronunciation letter, the contextual relationships are mined to obtain pronunciation features.
[0144] Text correction devices can uniformly input the sub-pronunciation features of each phonological letter into a deep learning model for contextual analysis, such as a bidirectional long short-term memory network (Bi-LSTM) or a bidirectional gated recurrent unit (Bi-GRU).
[0145] For example, Figure 9 is a schematic diagram of extracting pronunciation features provided by the embodiments of the present application. Referring to Figure 9 , the text error correction device first disassembles the pronunciation information "tiān" of the character information "day" to obtain a pronunciation letter sequence 9-1 composed of "t", "i", "ā" and "n", and then inputs each pronunciation letter in the pronunciation letter sequence 9-1 into the Bi-GRU model 9-2 to mine contextual connections, and obtain the final pronunciation feature 9-3.
[0146] In the embodiments of the present application, the text error correction device can first disassemble the pronunciation information, and then mine the mining features of the character information based on the features of the pronunciation letters in the disassembled pronunciation letter sequence, so as to facilitate subsequent fusion with glyph features and text features to generate fused features.
[0147] In some embodiments of the present application, extracting text features from character information, that is, the specific implementation process of S102, may further include: S1024-S1027 (not shown in the accompanying drawings), as follows:
[0148] S1024: For character information, determine character features.
[0149] S1025: Use the position information of the character information in the text to be error-corrected to determine the position feature corresponding to the character information.
[0150] The text error correction device can use each piece of character information to find the character feature corresponding to the character information from the character information feature table, and then use the position information of each character information in the text to be error-corrected to find the position feature corresponding to the position information from the position information feature table.
[0151] Of course, the text error correction device can also encode each piece of character information to obtain character features, and encode the position information of each character information in the text to be error-corrected to determine the position features.
[0152] It can be understood that both the character information feature table and the position information feature table are continuously updated along with the training of the target text model. Wherein, the target text model is used for extracting text features.
[0153] It should be noted that the position information can represent the position where the character information is located in the text to be error-corrected, for example, which character the character information is in the text to be error-corrected, or which word group the character information is in the text to be error-corrected.
[0154] S1026: Fuse the composite features of the character information by using the character features and the position features.
[0155] Text correction devices can fuse the character features and positional features of each character information by splicing or summing. The resulting feature is the composite feature of each character information.
[0156] S1027 performs feature extraction on the composite features to obtain the text features of the character information.
[0157] Finally, the text correction device can input the composite features into a trained text model capable of learning text representations, and determine the features output by the text model as the text features of the character information. The text correction device can also extract the text features of the character information from the composite features through operations such as downsampling.
[0158] It is understood that the deep learning model can be either the BERT model or the textCNN (text convolutional neural network) model, and this application does not limit it.
[0159] For example, Figure 10 This is a schematic diagram of the text feature extraction process provided in the embodiments of this application. For each character information 10-2 in the text to be corrected 10-1, the text correction device determines the character feature 10-3 and the position feature 10-4, and then inputs the composite feature generated based on the character feature 10-3 and the position feature 10-4 into the trained text model 10-5 for feature extraction to obtain the text features of the character information.
[0160] In this embodiment, the text correction device determines the text features of the character information in the text to be corrected based on both character features and the positional features corresponding to the character information. This allows the text features to encompass both the character itself and the position of the character, resulting in a greater amount of information in the text features of the character information.
[0161] In some embodiments of this application, glyph features, pronunciation features, and text features are fused to obtain fused features of character information. The specific implementation process of S103 may include: S1031-S1033 (not shown in the figures), as follows:
[0162] S1031. Perform attention-based multi-channel interaction on pronunciation features, glyph features, and text features to obtain interaction features.
[0163] In some embodiments, the text correction device can directly perform multi-channel interaction on pronunciation features, glyph features, and text features, for example, by directly inputting them into a deep learning model for multi-channel interaction to obtain interactive features. In other embodiments, the text correction device can also first perform attention calculations on pronunciation features, glyph features, and text features to determine attention parameters for pronunciation features, glyph features, and text features during multi-channel interaction. Then, based on these attention parameters, the device performs multi-channel interaction on pronunciation features, glyph features, and text features to enhance attention to useful features and suppress useless features during multi-channel interaction, thereby obtaining interactive features.
[0164] In other embodiments, the text correction device may first extract features from glyph features and pronunciation features, and then perform regularization processing on the extracted features so that the extracted features conform to a certain distribution, thereby obtaining regularized glyph features and regularized pronunciation features. Finally, the regularized glyph features, regularized pronunciation features and text features are interacted in multiple channels to obtain interactive features.
[0165] S1032. The interaction features are fused with the pronunciation features, glyph features and text features respectively to obtain the pronunciation interaction features, glyph interaction features and text interaction features.
[0166] After obtaining the interaction features, the text correction device can directly concatenate or accumulate the interaction features with the pronunciation features, glyph features, and text features respectively to obtain the pronunciation interaction features, glyph interaction features, and text interaction features. In other words, in this embodiment, the text correction device improves the modeling capability of glyph features, pronunciation features, and text features by performing residual fusion of the interaction features with the pronunciation features, glyph features, and text features respectively.
[0167] S1033. The pronunciation interaction features, character shape interaction features, and text interaction features are identified as the fusion features of character information.
[0168] For example, Figure 11 This is a schematic diagram illustrating the process of generating fusion features provided in an embodiment of this application. See also... Figure 11The text correction device processes the pronunciation feature 11-1 and the glyph feature 11-2 using a feedforward neural network 11-3 and a regularization layer 11-4, respectively. The output regularized glyph feature and regularized pronunciation feature, together with the text feature 11-5, are input into a model composed of N multi-channel interaction models 11-6 to output interaction features. Then, the interaction features are fused with the regularized glyph feature, regularized pronunciation feature, and text feature 11-7, respectively, to obtain the pronunciation interaction feature 11-91, glyph interaction feature 11-92, and text interaction feature 11-93 for each character information 11-8, which is the fused feature, for subsequent prediction processing.
[0169] In this embodiment, the text correction device can first perform multi-channel interaction on pronunciation features, glyph features, and text features, and then fuse the interaction features with the pronunciation features, glyph features, and text features respectively to enhance the modeling ability of pronunciation features, glyph features, and text features, and obtain pronunciation interaction features, glyph interaction features, and text interaction features with better feature representation, so that the subsequent text correction process is more accurate.
[0170] based on Figure 3 See Figure 12 , Figure 12 This is a flowchart illustrating another text correction method provided in an embodiment of this application. In some embodiments of this application, based on fusion features, error correction is performed on the text to be corrected to obtain the corrected text corresponding to the text to be corrected. The specific implementation process of S104 may include: S1041-S1044, as follows:
[0171] S1041. Based on text interaction features, pronunciation interaction features and glyph interaction features, predict the candidate error correction characters, the matching pronunciations of the candidate error correction characters, and the matching glyphs of the character information of the text to be corrected.
[0172] Text correction devices can use text interaction features to predict and classify, identify candidate characters for each character in the text to be corrected, predict the matching pronunciation of the candidate characters based on pronunciation interaction features, and predict the matching glyph of the candidate characters based on glyph interaction features.
[0173] Understandably, candidate correction characters refer to the characters that are predicted to appear at the positions corresponding to the character information. When the predicted characters are different from the actual character information, it means that the character information may be incorrect. Next, it is necessary to combine the matching pronunciation and matching glyph of the candidate correction characters to comprehensively determine whether the error is in the original character information of the text to be corrected or in the predicted candidate correction characters.
[0174] It should be noted that, in other embodiments, the text correction device may also fuse text interaction features, pronunciation interaction features, and glyph interaction features into a single fused interaction feature, and utilize this fused interaction feature to simultaneously predict candidate correction characters, match pronunciations, and match glyphs. This application does not impose any limitations on this.
[0175] S1042. Calculate the joint confidence of the candidate error-correcting character based on the confidence of the matching pronunciation and the confidence of the matching glyph.
[0176] When predicting candidate characters for correction, matching pronunciations, and matching glyphs, text correction devices generate corresponding confidence scores. These confidence scores indicate the reliability of the predicted results. The device can calculate the joint confidence score by summing and normalizing the confidence scores of the candidate characters, matching pronunciations, and matching glyphs, or by averaging these scores.
[0177] S1043. Based on the joint confidence level, filter out the erroneous characters from the character information of the text to be corrected, and determine the candidate correction characters corresponding to the erroneous characters as the target correction characters of the erroneous characters.
[0178] In some embodiments, after calculating the joint confidence score for each candidate error-correcting character, the text correction device compares the joint confidence scores of these candidate error-correcting characters, selects the N largest joint confidence scores, and then determines whether the N largest joint confidence scores exceed a confidence threshold. If the N largest joint confidence scores exceed the confidence threshold, the character information corresponding to the N largest joint confidence scores is identified as an error character, and the candidate error-correcting characters corresponding to the N largest joint confidence scores are identified as the target error-correcting characters.
[0179] It is understood that the value of N can be set according to the actual situation. For example, the value of N can be set to 1 or 2, etc. This application embodiment does not limit this.
[0180] Of course, in other embodiments, the text correction device may also determine all character information corresponding to joint confidence scores greater than the confidence threshold as error characters, and determine all candidate correction characters corresponding to joint confidence scores greater than the confidence threshold as target correction characters.
[0181] S1044. Using the target error correction character, replace the erroneous character to obtain the error correction text of the text to be corrected.
[0182] Text correction devices use target correction characters to replace erroneous characters in the text to be corrected. The text after the erroneous characters are replaced is the corrected text. In this way, the text correction device completes the error correction process for the text to be corrected.
[0183] In this embodiment, the text correction device can predict candidate correction characters, match pronunciations, and match glyphs based on text interaction features, pronunciation interaction features, and glyph interaction features with stronger modeling capabilities for pronunciation features, glyph features, and text features. Then, based on the confidence levels of the candidate correction characters, matching pronunciations, and matching glyphs, it determines whether the character information has an error. When an error occurs, it uses the candidate correction characters to replace the error, thereby realizing text correction using features with stronger representation capabilities and improving the accuracy of text correction.
[0184] In some embodiments of this application, the determination of glyph features of character information based on tree-like structural decomposition of the character information to be corrected is achieved through a target glyph model. The target glyph model includes a structural decomposition sub-model and a glyph feature extraction sub-model. The structural decomposition sub-model is used to decompose the character information into a tree structure to obtain a glyph tree, and the glyph feature extraction sub-model is used to generate glyph features of the character information based on the node features of each node in the glyph tree.
[0185] In some embodiments of this application, the extraction of pronunciation features from the pronunciation information of character information is achieved through a target pronunciation model. The target pronunciation model can learn the pronunciation features by breaking down the pronunciation information into a sequence of phonological letters and then learning the contextual relationships between the phonological letters in the corresponding sequence.
[0186] In some embodiments of this application, text features are extracted from character information using a target text model. The trained target text model may include a feature lookup sub-model and a text feature extraction sub-model. The feature lookup sub-model is used to find character features based on the character information and to find positional features based on the positional information of the character information. The text feature extraction sub-model is used to fuse the character features and positional features to obtain composite features.
[0187] In some embodiments of this application, the fusion of glyph features, pronunciation features, and text features to obtain fused character information features, and the correction of the text to be corrected based on the fused features to obtain the corrected text, are achieved through a target prediction model. The trained target prediction model can include a multi-channel interaction sub-model and a correction sub-model. The multi-channel interaction sub-model is used to perform multi-channel interaction on glyph features, pronunciation features, and text features to fuse them and obtain fused features. The correction sub-model is used to correct errors based on the text to be corrected to obtain the corrected text.
[0188] In some embodiments of this application, before determining the glyph features of the character information based on the tree-structured decomposition of the character information of the text to be corrected, i.e. before S101, the method may further include: S105-S108 (not shown in the figures), as follows:
[0189] S105. Obtain the initial text model, initial glyph model, initial pronunciation model, and initial prediction model.
[0190] It should be noted that the initial text model, initial glyph model, initial pronunciation model, and initial prediction model are all untrained models. Their parameters are determined through random initialization and need to be adjusted in subsequent pre-training and training processes.
[0191] S106. Using the first training data, pre-train the initial text model to obtain a pre-trained text model.
[0192] Generally, labeled data is limited, while the initial text model typically has a large number of parameters. Therefore, large-scale pre-training is necessary before formal training to achieve good text feature extraction results. Thus, text correction devices first acquire initial training data and use it to pre-train the initial text model. This allows for preliminary adjustments to the model parameters, giving it a preliminary ability to extract text features and preventing overfitting and poor model performance during subsequent training with smaller datasets.
[0193] It should be noted that the first training data is unlabeled text data with mask replacement. The first training data can be large-scale text web page data crawled from the Internet. This data is unlabeled. In order to be used to pre-train the initial text model, the text correction device will use a mask to replace some characters in the crawled text web page data. Then, the initial text model is used to predict the masked parts. The loss value is calculated using the predicted value and the real value of the masked replacement. The parameters in the initial text model are adjusted using the loss value until the training termination condition is met (e.g., the number of iterations reaches a preset number, or the accuracy reaches a preset accuracy), and the pre-trained text model is obtained.
[0194] In some embodiments, in addition to using masks to replace some characters in text webpage data, the text correction device can also replace a small number of characters with other characters, so that the first training data contains both masks and random errors, thereby improving the pre-training effect of the initial text model.
[0195] For example, a text correction device can select 15% of the characters from text network data to replace them to generate the first training data. In this first training data, 80% of the 15% of characters are replaced with a mask, 10% of the 15% are replaced with other characters, and the remainder are left unchanged.
[0196] S107. Using the second training data, perform multi-objective pre-training on the initial glyph model, initial pronunciation model, pre-trained text model, and initial prediction model to obtain candidate glyph model, candidate pronunciation model, candidate text model, and candidate prediction model.
[0197] Since the initial glyph model, pronunciation model, and prediction model all have relatively small parameter counts, large-scale pre-training is unnecessary. Good performance can be achieved directly through pre-training with a small amount of unlabeled data containing errors. Therefore, after obtaining the pre-trained text model, the text correction device begins multi-objective pre-training on all models using the second training data. After multi-objective pre-training, candidate glyph models, candidate pronunciation models, candidate text models, and candidate prediction models are obtained. This reduces the time spent on large-scale pre-training and improves the ability to extract glyph features, pronunciation features, and predict results.
[0198] It should be noted that the second training data is unlabeled text data with incorrect character replacements. The difference between the second and first training data is that the second training data does not use masks to replace characters in the text dataset (which can be extracted from text web page data or collected video title data), but instead uses characters with similar pronunciations and similar shapes to replace characters in the dataset. Furthermore, the second training data is smaller than the first training data.
[0199] For example, a text correction device can perform error replacement on 20% of the characters in a text dataset. Specifically, 60% of these 20% of characters are replaced with characters that are similar in pronunciation, 30% of these 20% of characters are replaced with other characters that are similar in shape, 5% of these 20% are replaced with random characters, and the remaining 5% remain unchanged. This yields the second training data.
[0200] S108. Using the third training data, the candidate character shape model, candidate pronunciation model, candidate text model, and candidate prediction model are optimized to obtain the target character shape model, target pronunciation model, target text model, and target prediction model.
[0201] It should be noted that the third training data consists of labeled error-prone and correct text. That is, in this step, the text correction device uses the labeled third training data to perform targeted optimization of the candidate glyph model, candidate pronunciation model, candidate text model, and candidate prediction model. Furthermore, the third training data can be text data from specific application scenarios, such as labeled data for video titles or text data from article editing scenarios.
[0202] When the text correction device uses third training data to optimize candidate glyph models, candidate pronunciation models, candidate text models, and candidate predictions, it first uses the candidate glyph model to decompose the characters of the erroneous text in the third training data into a tree structure, and generates optimized glyph features from the decomposed glyph tree. Then, it uses the candidate pronunciation model to extract optimized pronunciation features from the pronunciation of the characters in the erroneous text, and uses the candidate text model to extract optimized text features from the characters in the erroneous text. Finally, it uses the candidate prediction model to fuse the optimized glyph features, optimized pronunciation features, and optimized text features to obtain optimized fused features. Then, it performs text correction on the erroneous text based on the optimized fused features, calculates the optimization loss value based on the difference between the optimized and corrected text, and continuously adjusts the parameters of the candidate glyph model, candidate pronunciation model, candidate text model, and candidate prediction model using the optimization loss value until the optimization is completed, resulting in the target glyph model, target pronunciation model, target text model, and target prediction model.
[0203] In this embodiment, the text correction device can first pre-train an initial text model using first training data to reduce the computational load during large-scale text pre-training and improve text feature extraction capabilities. Then, it can perform multi-objective pre-training on the initial glyph model, initial pronunciation model, pre-trained text model, and initial prediction model using second training data to ensure that glyph feature extraction capabilities, pronunciation feature extraction capabilities, and result prediction capabilities are improved, and text feature extraction capabilities are further enhanced. Finally, it can optimize the candidate glyph model, candidate pronunciation model, candidate text model, and candidate prediction model using third training data to further strengthen the glyph feature extraction capabilities, pronunciation feature extraction capabilities, result prediction capabilities, and text feature extraction capabilities using labeled data, thereby achieving better modeling results for glyph and pronunciation text.
[0204] In some embodiments of this application, using the second training data, multi-objective pre-training is performed on the initial glyph model, initial pronunciation model, pre-trained text model, and initial prediction model to obtain candidate glyph models, candidate pronunciation models, candidate text models, and candidate prediction models. The specific implementation process of S107 may include: S1071-S1075 (not shown in the accompanying drawings), as follows:
[0205] S1071. Using the initial glyph model, the training characters in the second training text are decomposed into a tree structure, and the training glyph features of the training characters are determined.
[0206] S1072. Using the initial pronunciation model, extract training pronunciation features from the pronunciation information of the training characters, and using the pre-trained text model, extract training text features from the training characters.
[0207] S1073. Using the initial prediction model, the training glyph features, training pronunciation features, and training text features are fused to obtain the training fused features of the training characters. Based on the training fused features, the second training data is corrected to obtain the training corrected text.
[0208] S1074. Based on the difference between the training error correction text and the ground truth text corresponding to the second training data, determine the training loss value.
[0209] It should be noted that the truth text is text data that has not undergone error character replacement. Since the second training data is obtained by performing error replacement on the text data in the text dataset, the truth text is the original text dataset corresponding to the second training data.
[0210] S1075. Continuously adjust the parameters of the initial glyph model, initial pronunciation model, pre-trained text model, and initial prediction model using the training loss value until the training termination condition is met, and obtain the candidate glyph model, candidate pronunciation model, candidate text model, and candidate prediction model.
[0211] The text correction device uses the training loss value to calculate the adjustment components corresponding to the parameters of the initial glyph model, initial pronunciation model, pre-trained text model, and initial prediction model. Then, it uses these adjustment components and the original parameters to determine the new parameters, thus achieving one parameter adjustment. This process is repeated iteratively until the training termination condition is met, such as when the number of iterations reaches a preset number or the prediction accuracy reaches a preset accuracy. At this point, the pre-training process ends, resulting in candidate glyph models, candidate pronunciation models, candidate text models, and candidate prediction models.
[0212] In this embodiment, the text correction device uses second training data to perform multi-objective pre-training on the initial glyph model, initial pronunciation model, pre-trained text model, and initial prediction model. This improves the glyph feature extraction capability, pronunciation feature extraction capability, and result prediction capability, and further enhances the text feature extraction capability, resulting in candidate glyph models, candidate pronunciation models, candidate text models, and candidate prediction models, which facilitate subsequent targeted optimization using labeled data.
[0213] The following will describe an exemplary application of the embodiments of this application in a real-world application scenario.
[0214] This application embodiment describes a scenario where a server (text correction device) constructs a model capable of correcting errors in video titles (text to be corrected). See also... Figure 13 , Figure 13 This is a schematic diagram illustrating the process of constructing a model for correcting video titles, as provided in an embodiment of this application. The process may include:
[0215] S201, Construction of the sound-shape enhancement error correction model.
[0216] This process can mainly include the following steps:
[0217] 1) Character Shape Feature Modeling. For Chinese character shapes (character information), the server can decompose them into a tree structure (tree structure decomposition). Compared to decomposing them into stroke sequences, the tree structure better preserves the two-dimensional spatial features of the character shape and is better able to represent whether character shapes are similar. The server can first decompose the Chinese character shape according to radicals (at least one radical character), and then further decompose it into blocks, that is, decompose the radicals into strokes (at least one stroke shape) to obtain a stroke tree (character shape tree). Then, the server uses character shape gating units to recursively construct feature representations (character shape features) from the stroke tree. The representation of each leaf node (child node) of the character shape tree (the node feature of the child node) is the representation of the stroke sequence (the feature of the stroke shape), which can be obtained by querying the stroke sequence vector table (the stroke shape feature table). The non-leaf nodes (parent nodes) of the character tree represent decomposition operations (the decomposition operation of radical characters is determined as the parent node under the root node). A decomposition operation can be viewed as a special type of stroke, and its representation (the stroke feature of the parent node) can be obtained by querying the stroke sequence vector table. The final representation of a non-leaf node in the character tree (the node feature of the parent node) is a fusion of the representations of its two children and the stroke representation of the current decomposition operation. Therefore, the process of obtaining the node representation in the character tree is a recursive calculation from the bottom to the top of the character tree, using the representation of the root node (the node feature corresponding to the root node) as the character representation of the current character (the character feature of the character information).
[0218] 2) Phonetic Feature Modeling. The pronunciation part (pronunciation information of character information) is decomposed into a sequence of phonetic letters (pronunciation letter sequence). The representation of each phonetic letter in the sequence is input into a bidirectional GRU for modeling to obtain the final representation of the pronunciation part (pronunciation features). The representation of each phonetic letter (pronunciation letter) (sub-pronunciation feature) is obtained by querying the corresponding vector table (pronunciation feature table). This pronunciation vector table is updated and learned during the model training process.
[0219] 3) Chinese character feature modeling. The features of Chinese characters (text features) are obtained by superimposing character vectors (character features) and the position vectors of the characters in the video title (position features). Both character vectors and position vectors can be obtained by querying the corresponding vector tables. Similarly, these vector tables are updated and learned during the model training process.
[0220] 4) Multi-channel fusion of glyph and pinyin representations. In the above process, the server performs multi-channel separate modeling of glyphs, pronunciations, and Chinese character representations. Then, glyph features and pinyin features are fused with the Chinese character representations through multi-channel interaction. Specifically, the server can calculate the attention between character representations and pronunciation representations, and glyph representations, and then calculate multi-channel interactive representations (interaction features). These interactive representations are then fused with residual connections to character representations, pronunciation representations, and glyph representations respectively, resulting in the final fused representation (producing pronunciation interaction features, glyph interaction features, and text interaction features). This multi-channel interactive fusion enhances the modeling ability of glyph and pinyin representations, thereby improving the feature modeling capabilities of glyph and pronunciation representations. Multi-channel interaction can be achieved by stacking N layers of multi-channel interactive fusion models, further enhancing the model's representational capabilities.
[0221] 5) Multi-objective task construction. In the output of the model, the server not only predicts the target character ti (candidate error correction character) at position i (i.e., the position where the character information is located), but also predicts the target pronunciation pi (matching pronunciation) and the target glyph cluster gi (matching glyph). Then, based on the predicted probabilities (confidence) of the three objectives ti, pi, and gi, the character with the highest joint probability (joint confidence) and meeting a certain threshold is selected as the final video title correction candidate (target error correction character).
[0222] For example, Figure 14 This is an overall framework diagram of the sound-shape enhancement model provided in the embodiments of this application. See also... Figure 14 For each Chinese character (14-11) in the video title (14-1), the server will first perform a process similar to... Figure 6 The glyph tree is constructed in this way, and then according to... Figure 7 The process recursively proceeds from the bottom to the top of the glyph tree to obtain the glyph representation 14-111 for each character. Simultaneously, for each Chinese character 14-111, a similar approach is used... Figure 9 The pronunciation representation was extracted in a certain way, resulting in pronunciation representations 14-112, according to... Figure 10The character representation is extracted using a method shown in the figure. Then, the character representation is input into a model consisting of N stacked multi-channel interactive fusion models 14-4. The glyph representation 14-111 and the pronunciation representation 14-112 are input into a model 14-3 consisting of a feedforward neural network and a regularization function. The output of this model is then input into the model consisting of N stacked multi-channel interactive fusion models 14-4. The output of the model consisting of N stacked multi-channel interactive fusion models 14-4 is the interactive representation. The interactive representation and the output of model 14-3 (comprising the character representation, feedforward neural network, and regularization function) are then subjected to residual fusion 14-5 to obtain the final feature representation of each Chinese character 14-11. Finally, based on this feature representation, the server can predict the target character ti, the target pronunciation pi, and the target glyph cluster gi.
[0223] S202, Pre-training of the sound and shape enhancement error correction model.
[0224] After the server builds the sound-shape enhancement and error correction model, it needs to pre-train the model. This pre-training includes two stages:
[0225] 1) The Chinese character model (initial text model) is pre-trained on large-scale data. This stage only applies to the Chinese character model, for example... Figure 14 The BERT model is pre-trained. During this process, the server crawls a large amount of Chinese webpage data and performs certain mask replacements on this data (to obtain the first training data). For example, 15% of the characters in the crawled Chinese webpage data are replaced, 80% of these are replaced with masks, 10% are randomly replaced with other characters, and the remaining 10% remain unchanged. Then, the Chinese character model is used to predict the replaced parts for large-scale pre-training. This pre-training process allows the Chinese character model to be initialized to a relatively good state.
[0226] 2) Joint training of glyphs and pronunciations is performed on the constructed dataset with errors. Compared to Chinese characters, the overall data volume of glyphs and pronunciations is relatively small. For example, the data volume of pinyin letters is in the hundreds, and the data volume of glyphs is also in the hundreds. Therefore, it is not necessary to perform large-scale pre-training of glyphs and pronunciations in stage 1), thereby reducing the computational cost of stage 1).
[0227] The server performs multi-objective pre-training on a constructed dataset containing errors, that is, by training on the dataset containing errors (the second training data) according to... Figure 14The data processing flow of the model shown obtains glyph representation, pronunciation representation, and character representation, which are then fused through multi-channel processing to obtain the final fused representation. This fused representation is then used to predict the target character, the target pronunciation, and the target glyph clustering. Combined with the original text data (ground truth text) from the dataset containing errors, the loss (training loss value) is calculated to improve performance. Figure 14 The model shown is pre-trained so that Figure 14 The model shown has learned each representation module quite well, and is able to predict the correct target character, target character shape cluster, and target pronunciation.
[0228] The dataset containing errors is obtained by randomly replacing similar errors in text data, such as similar pronunciations or similar character shapes. Compared to the replacement method in stage 1), the replacement method in this step is more in line with the error correction scenario and can strengthen the learning of character shape and pronunciation representations.
[0229] The server can replace 20% of the text data with characters that have similar pronunciations or shapes; of these, 60% are replaced with other characters that have similar pronunciations, 30% are replaced with other characters that have similar shapes, 5% are randomly replaced with other characters, and 5% remain unchanged, thus constructing a dataset containing errors (second training data).
[0230] S203, the sound and shape enhancement model is trained in a targeted manner in the video title error correction scenario.
[0231] The server performs targeted optimization on the pre-trained model using pre-labeled video title data. Specifically, it uses data with labeled error-correct titles (error text and correct text) to fine-tune the model. Figure 14 The model shown undergoes multi-objective joint training of glyphs, pronunciation, and characters to improve its adaptation to video title scenarios. This training process is similar to pre-training stage 2). The loss function for targeted training is shown in equation (1):
[0232] L = L t +L p +L g (1)
[0233] Among them, L t L is the loss value for word prediction. p L is the loss value for pronunciation prediction. g L is the loss value for clustering prediction of the target character shape, and L is the loss value during targeted training (optimized loss value).
[0234] Among them, L t The calculation process is shown in equation (2), L p The calculation process is shown in equation (3), L gThe calculation process is shown in equation (4):
[0235]
[0236]
[0237]
[0238] Among them, t i Let X be the predicted word at position i, X be the video title, n be the total number of characters in the video title, and l be the predicted word at position i. i For the real character at position i, P t p represents the conditional probability that the predicted character based on the video title is the actual character; i Predict pronunciation for position i, r i For the actual pronunciation of position i, P p g represents the conditional probability that the predicted pronunciation based on the video title is the actual pronunciation. i For the predicted glyph clustering at position i, u i For the true glyph clustering at position i, P g This represents the conditional probability that the predicted character cluster based on the video title is the same as the true character cluster.
[0239] After the model converges, the server can use the converged model for title correction, that is, to combine the probabilities of multiple targets predicted by the joint model and select the one with the highest joint probability (joint confidence) that meets a certain threshold as the correction candidate (target correction character) for the video title.
[0240] The above method allows for the complete preservation of the two-dimensional spatial features of character shapes through a glyph tree. Then, by constructing a multi-channel interactive fusion model of glyphs and pronunciation, the modeling capability for both glyphs and pronunciation is enhanced, thereby improving the effectiveness of video title error correction. Simultaneously, combining multi-objective pre-training tasks involving pronunciation, glyphs, and characters improves the model's error correction capability for Chinese, reducing the proportion of errors in video platform titles.
[0241] The following description continues to illustrate the exemplary structure of the text correction device 255 provided in the embodiments of this application as a software module. In some embodiments, such as Figure 2 As shown, the software modules stored in the text correction device 255 in the memory 250 may include:
[0242] The feature extraction module 2551 is used to perform tree-like structural decomposition on the character information of the text to be corrected, and determine the glyph features of the character information; the glyph features include the spatial structural features of the character information; extract pronunciation features from the pronunciation information of the character information, and extract text features from the character information;
[0243] The feature fusion module 2552 is used to fuse the glyph features, the pronunciation features, and the text features to obtain the fused features of the character information;
[0244] The text correction module 2553 is used to correct errors in the text to be corrected based on the fusion features, so as to obtain the corrected text corresponding to the text to be corrected.
[0245] In some embodiments of this application, the feature extraction module 2551 is further configured to perform tree-like structural decomposition on the character information in the text to be corrected to obtain a character tree; and generate the character features of the character information based on the node features corresponding to each node in the character tree.
[0246] In some embodiments of this application, the feature extraction module 2551 is further configured to identify at least one radical character from the character information of the text to be corrected, and determine the character information disassembly operation based on the spatial structure of at least one radical character; identify at least one stroke shape from each radical character, and determine the disassembly operation of each radical character based on the spatial structure of at least one stroke shape; determine the character information disassembly operation as the root node, determine the disassembly operation of each radical character as the parent node under the root node, and determine at least one stroke shape as the child node corresponding to the parent node, thereby obtaining the character tree.
[0247] In some embodiments of this application, the feature extraction module 2551 is further configured to recursively derive the node features corresponding to each parent node using the stroke features of the child nodes under each parent node in the character tree, and the stroke features of each parent node; wherein, the stroke features of each parent node are the stroke features corresponding to the decomposition operation of each radical character; using the node features of the parent nodes under the root node, and the stroke features corresponding to the decomposition operation of the character information, the node features corresponding to the root node are recursively derived; and the node features corresponding to the root node are determined as the character features of the character information.
[0248] In some embodiments of this application, the feature extraction module 2551 is further configured to decompose the pronunciation information of the character information into a sequence of pronunciation letters; obtain the sub-pronunciation features corresponding to each pronunciation letter in the sequence of pronunciation letters; and mine the contextual relationships for each sub-pronunciation feature of the pronunciation letter to obtain the pronunciation features.
[0249] In some embodiments of this application, the feature extraction module 2551 is further configured to: determine character features for the character information; determine the position features corresponding to the character information using the position information of the character information in the text to be corrected; fuse the character features and the position features to obtain the composite features of the character information; and extract features from the composite features to obtain the text features of the character information.
[0250] In some embodiments of this application, the feature fusion module 2552 is further configured to perform attention-based multi-channel interaction on the pronunciation features, the glyph features, and the text features to obtain interaction features; fuse the interaction features with the pronunciation features, the glyph features, and the text features respectively to obtain pronunciation interaction features, glyph interaction features, and text interaction features; and determine the pronunciation interaction features, the glyph interaction features, and the text interaction features as the fusion features of the character information.
[0251] In some embodiments of this application, the text correction module 2553 is further configured to predict, based on the text interaction features, the pronunciation interaction features, and the glyph interaction features, candidate correction characters, matching pronunciations, and matching glyphs of the character information of the text to be corrected; calculate the joint confidence of the candidate correction characters based on the confidence of the candidate correction characters, the confidence of the matching pronunciations, and the confidence of the matching glyphs; filter out erroneous characters from the character information of the text to be corrected according to the joint confidence, and determine the candidate correction characters corresponding to the erroneous characters as the target correction characters of the erroneous characters; and replace the erroneous characters using the target correction characters to obtain the corrected text of the text to be corrected.
[0252] In some embodiments of this application, the step of determining the glyph features of the character information based on the tree-like structural decomposition of the character information of the text to be corrected is achieved through a target glyph model;
[0253] The extraction of pronunciation features from the pronunciation information of the character information is achieved through a target pronunciation model, and the extraction of text features from the character information is achieved through a target text model.
[0254] The process of fusing the glyph features, pronunciation features, and text features to obtain the fused features of the character information, and the process of correcting the text to be corrected based on the fused features to obtain the corrected text corresponding to the text to be corrected, are achieved through a target prediction model.
[0255] In some embodiments of this application, the text correction device 255 further includes: a model training module 2554;
[0256] The model training module 2554 is used to acquire an initial text model, an initial glyph model, an initial pronunciation model, and an initial prediction model; pre-train the initial text model using first training data to obtain a pre-trained text model; the first training data is unlabeled text data with mask replacement; multi-objective pre-training is performed on the initial glyph model, the initial pronunciation model, the pre-trained text model, and the initial prediction model using second training data to obtain candidate glyph models, candidate pronunciation models, candidate text models, and candidate prediction models; wherein, the second training data is unlabeled text data with error character replacement; and the candidate glyph models, the candidate pronunciation models, the candidate text models, and the candidate prediction models are optimized using third training data to obtain target glyph models, target pronunciation models, target text models, and target prediction models; the third training data is data with labeled error text and correct text.
[0257] In some embodiments of this application, the model training module 2554 is further configured to: decompose the training characters in the second training text into a tree structure using the initial glyph model; extract training pronunciation features from the pronunciation information of the training characters using the initial pronunciation model; extract training text features from the training characters using the pre-trained text model; fuse the training glyph features, the training pronunciation features, and the training text features using the initial prediction model to obtain training fusion features of the training characters; and correct errors in the second training data based on the training fusion features to obtain training corrected text; determine a training loss value based on the difference between the training corrected text and the ground truth text corresponding to the second training data; wherein the ground truth text is text data that has not undergone error character replacement; and continuously adjust the parameters of the initial glyph model, the initial pronunciation model, the pre-trained text model, and the initial prediction model using the training loss value until the training termination condition is met, thereby obtaining the candidate glyph model, the candidate pronunciation model, the candidate text model, and the candidate prediction model.
[0258] This application provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a text correction device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the text correction device to perform the text correction method described in this application.
[0259] This application provides a computer-readable storage medium storing executable instructions. When these executable instructions are executed by a processor, they cause the processor to execute the text correction method provided in this application. For example, ... Figure 3 The text correction method shown.
[0260] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EP ROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or it may be a variety of devices including one or any combination of the above-mentioned memories.
[0261] In some embodiments, executable instructions may take the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a standalone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.
[0262] As an example, executable instructions may, but do not necessarily, correspond to files in a file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple collaborating files (e.g., a file that stores one or more modules, subroutines, or code sections).
[0263] As an example, executable instructions can be deployed to execute on a single text correction device, or on multiple text correction devices located at one location, or on multiple text correction devices distributed across multiple locations and interconnected via a communication network.
[0264] In summary, through the embodiments of this application, the text correction device can decompose the character information of the text to be corrected according to a tree structure, thereby obtaining glyph features that can completely preserve the spatial structural features of the character information. At the same time, it can extract pronunciation features from the pronunciation information of the character information, extract text features from the character information itself, and then combine the glyph features, pronunciation features and text features to obtain fused features for correcting the text. This ensures that the features of the character information in both pronunciation and glyph dimensions can be fully utilized in text correction, thereby improving the accuracy of text correction.
[0265] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of this application are included within the scope of protection of this application.
Claims
1. A text error correction method, characterized in that, The text correction method includes: Based on the tree-structured decomposition of the character information of the text to be corrected, the glyph features of the character information are determined; the glyph features include the spatial structural features of the character information. Extract pronunciation features from the pronunciation information of the character information, and extract text features from the character information; An attention-based multichannel interaction is performed on the pronunciation features, the glyph features, and the text features to obtain interaction features; The interactive features are fused with the pronunciation features, the glyph features, and the text features respectively to obtain pronunciation interactive features, glyph interactive features, and text interactive features; The pronunciation interaction features, the character shape interaction features, and the text interaction features are determined as the fusion features of the character information; Based on the fusion features, the text to be corrected is corrected to obtain the corrected text corresponding to the text to be corrected.
2. The method according to claim 1, characterized in that, The process of decomposing the character information of the text to be corrected into a tree structure to determine the glyph features of the character information includes: The character information in the text to be corrected is decomposed into a tree structure to obtain a character tree; The glyph features of the character information are generated based on the node features corresponding to each node in the glyph tree.
3. The method according to claim 2, characterized in that, The step of performing a tree-structured decomposition of the character information in the text to be corrected to obtain a character tree includes: Identify at least one radical character from the character information of the text to be corrected, and determine the character information disassembly operation based on the spatial structure of at least one radical character; Identify at least one stroke shape from each radical character, and determine the disassembly operation of each radical character based on the spatial structure of at least one stroke shape; The character information is decomposed into a root node, each radical character is decomposed into a parent node under the root node, and at least one stroke shape is determined as a child node corresponding to the parent node, thus obtaining the character tree.
4. The method according to claim 3, characterized in that, The process of generating the glyph features of the character information based on the node features corresponding to each node in the glyph tree includes: Using the stroke features of the child nodes under each parent node in the character tree, and the stroke features of each parent node, the node features corresponding to each parent node are recursively derived; wherein, the stroke features of each parent node are the stroke features corresponding to the decomposition operation of each radical character. By utilizing the node features of the parent node under the root node and the stroke features corresponding to the character information decomposition operation, the node features corresponding to the root node are recursively derived. The node features corresponding to the root node are determined as the glyph features of the character information.
5. The method according to any one of claims 1 to 4, characterized in that, Extracting pronunciation features from the pronunciation information of the character information includes: The pronunciation information of the character information is decomposed into a sequence of pronunciation letters; Obtain the sub-pronunciation features corresponding to each pronunciation letter in the pronunciation letter sequence; The pronunciation features are obtained by mining the contextual relationships of the sub-pronunciation features of each of the pronunciation letters.
6. The method according to any one of claims 1 to 4, characterized in that, Extracting text features from the character information includes: Based on the character information, character features are determined; Using the position information of the character information in the text to be corrected, the positional features corresponding to the character information are determined; By utilizing the character features and the positional features, a composite feature of the character information is fused together; Feature extraction is performed on the composite features to obtain the text features of the character information.
7. The method according to claim 1, characterized in that, The step of correcting the text to be corrected based on the fusion features to obtain the corrected text corresponding to the text to be corrected includes: Based on the text interaction features, the pronunciation interaction features, and the glyph interaction features, candidate error correction characters, matching pronunciations, and matching glyphs of the character information of the text to be corrected are predicted. The joint confidence of the candidate error-correcting character is calculated based on the confidence of the matched pronunciation and the confidence of the matched glyph. Based on the joint confidence level, erroneous characters are filtered out from the character information of the text to be corrected, and the candidate correction characters corresponding to the erroneous characters are determined as the target correction characters of the erroneous characters. The target error correction character is used to replace the erroneous character, resulting in the corrected text of the text to be corrected.
8. The method according to claim 7, characterized in that, The process of decomposing the character information of the text to be corrected into a tree structure to determine the glyph features of the character information is achieved through a target glyph model. The extraction of pronunciation features from the pronunciation information of the character information is achieved through a target pronunciation model, and the extraction of text features from the character information is achieved through a target text model. The process of performing attention-based multi-channel interaction on the pronunciation features, glyph features, and text features to obtain interaction features, fusing these interaction features with the pronunciation features, glyph features, and text features respectively to obtain pronunciation interaction features, glyph interaction features, and text interaction features, determining these interaction features as the fusion features of the character information, and correcting the text to be corrected based on the fusion features to obtain the corrected text corresponding to the text to be corrected, is achieved through a target prediction model.
9. The method according to claim 8, characterized in that, Before determining the glyph features of the character information based on the tree-structured decomposition of the text to be corrected, the method further includes: Obtain the initial text model, initial glyph model, initial pronunciation model, and initial prediction model; The initial text model is pre-trained using the first training data to obtain a pre-trained text model; the first training data is unlabeled text data with mask replacement. Using the second training data, the initial glyph model, the initial pronunciation model, the pre-trained text model, and the initial prediction model are pre-trained using a multi-objective method to obtain candidate glyph models, candidate pronunciation models, candidate text models, and candidate prediction models; wherein, the second training data is unlabeled text data with erroneous character replacements. Using the third training data, the candidate glyph model, the candidate pronunciation model, the candidate text model, and the candidate prediction model are optimized to obtain the target glyph model, the target pronunciation model, the target text model, and the target prediction model; the third training data consists of data labeled with incorrect and correct text.
10. The method according to claim 9, characterized in that, The step of using the second training data to perform multi-objective pre-training on the initial glyph model, the initial pronunciation model, the pre-trained text model, and the initial prediction model to obtain candidate glyph models, candidate pronunciation models, candidate text models, and candidate prediction models includes: Using the initial glyph model, a tree-like structure is decomposed for the training characters in the second training data, and the training glyph features of the training characters are determined. The initial pronunciation model is used to extract training pronunciation features from the pronunciation information of the training characters, and the pre-trained text model is used to extract training text features from the training characters. The initial prediction model is used to fuse the training glyph features, the training pronunciation features, and the training text features to obtain the training fusion features of the training characters. Based on the training fusion features, the second training data is corrected to obtain the training corrected text. The training loss value is determined based on the difference between the training error-corrected text and the ground truth text corresponding to the second training data; wherein, the ground truth text is text data that has not undergone error character replacement. The parameters of the initial glyph model, the initial pronunciation model, the pre-trained text model, and the initial prediction model are continuously adjusted using the training loss value until the training termination condition is met, thus obtaining the candidate glyph model, the candidate pronunciation model, the candidate text model, and the candidate prediction model.
11. A text correction device, characterized in that, The text correction device includes: The feature extraction module is used to perform tree-like structural decomposition of the character information of the text to be corrected, and determine the glyph features of the character information; the glyph features include the spatial structural features of the character information; extract pronunciation features from the pronunciation information of the character information, and extract text features from the character information; The feature fusion module is used to perform attention-based multi-channel interaction on the pronunciation features, the glyph features, and the text features to obtain interaction features; to fuse the interaction features with the pronunciation features, the glyph features, and the text features respectively to obtain pronunciation interaction features, glyph interaction features, and text interaction features; and to determine the pronunciation interaction features, glyph interaction features, and text interaction features as the fusion features of the character information. The text correction module is used to correct errors in the text to be corrected based on the fusion features, so as to obtain the corrected text corresponding to the text to be corrected.
12. The apparatus according to claim 11, characterized in that, The text correction module is further configured to predict, based on the text interaction features, the pronunciation interaction features, and the glyph interaction features, candidate correction characters, matching pronunciations, and matching glyphs of the character information of the text to be corrected; calculate the joint confidence of the candidate correction characters based on the confidence of the candidate correction characters, the confidence of the matching pronunciations, and the confidence of the matching glyphs; and, based on the joint confidence, filter out erroneous characters from the character information of the text to be corrected, and determine the candidate correction characters corresponding to the erroneous characters as the target correction characters of the erroneous characters. The target error correction character is used to replace the erroneous character, resulting in the corrected text of the text to be corrected.
13. A text correction device, characterized in that, The text correction device includes: Memory, used to store executable instructions; A processor, when executing executable instructions stored in the memory, implements the text correction method according to any one of claims 1 to 10.
14. A computer-readable storage medium storing executable instructions, characterized in that, When the executable instructions are executed by the processor, they implement the text correction method according to any one of claims 1 to 10.
15. A computer program product comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the text correction method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Confusion statement generation method, terminal equipment and computer readable storage medium
CN113536776A
Text error correction method and device, computer equipment and computer readable storage medium
CN113569561A