Chinese text automatic error correction system and method based on knowledge base
Through deep learning technology based on the knowledge base, pre-trained word semantic encoders and one-hot encoders are used to semantically encode and tag Chinese texts, solving the problem that traditional methods are difficult to deal with complex errors and realizing the intelligence of Chinese texts. Error correction improves the accuracy and flexibility of error correction.
Patent Information
- Application Number
- CN202410444832.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-15
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2044-04-15
AI Technical Summary
Traditional Chinese text correction methods are difficult to effectively handle complex errors, such as word order errors and grammatical errors, and lack flexibility to cover all possible error types.
Deep learning technology based on knowledge base is used to semantically encode and tag Chinese texts through pre-trained word semantic encoders and one-hot encoders. The encoder-decoder structure is used for automatic correction and fusion of semantic and grammatical information.
It achieves intelligent, effective processing and correction of Chinese texts, avoids the inefficiency of traditional methods and the difficulty in dealing with complex error types, and improves the accuracy and flexibility of correction.
Smart Images

Figure CN118228722B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of Chinese text error proofing, and in particular to a Chinese text automatic error proofing system and method based on a knowledge base. Background Art
[0002] With the rapid development of information technology, people frequently communicate with text in their daily lives and work, so ensuring the accuracy of Chinese text is crucial. Chinese text proofreading is an important task in the field of natural language processing, which aims to identify and correct errors in Chinese text, including typos, word order errors, and grammatical errors.
[0003] However, traditional Chinese text proofreading methods are usually based on rules and statistical models. These methods require a large number of manually designed rules or large-scale annotated data, lack flexibility, and are difficult to cover all possible error types. They also have limited processing capabilities for complex errors. In addition, traditional proofreading methods perform poorly when dealing with complex errors, such as word order errors or grammatical errors. This is because these errors may involve the semantics and part-of-speech information of the text, and traditional Chinese text proofreading methods often cannot capture this information well and have difficulty dealing with complex error types.
[0004] Therefore, an automatic error correction scheme for Chinese text based on a knowledge base is desired. Summary of the invention
[0005] The present disclosure is made in view of the above problems. One object of the present disclosure is to provide a Chinese text automatic error correction system and method based on a knowledge base.
[0006] The embodiment of the present disclosure provides a method for automatic error correction of Chinese text based on a knowledge base, which comprises:
[0007] Get the Chinese sentences to be proofread;
[0008] Performing word segmentation processing on the Chinese sentence to be proofread to obtain a sequence of Chinese words to be proofread;
[0009] Using a pre-trained word semantic encoder to semantically encode each Chinese word to be proofread in the sequence of Chinese words to be proofread to obtain a sequence of semantic encoding feature vectors of the Chinese words to be proofread, wherein the pre-trained word semantic encoder is trained by a knowledge base;
[0010] Performing part-of-speech tagging and one-hot encoding processing on each Chinese word to be proofread in the sequence of Chinese words to be proofread to obtain a sequence of word-granular part-of-speech one-hot encoding feature vectors;
[0011] The Chinese text is proofread based on the sequence of semantic encoding feature vectors of the Chinese words to be proofread and the sequence of word-granularity part-of-speech one-hot encoding feature vectors to generate a proofread Chinese text.
[0012] For example, according to the knowledge base-based automatic Chinese text error correction method of an embodiment of the present disclosure, each Chinese word to be proofread in the sequence of Chinese words to be proofread is subjected to part-of-speech tagging and one-hot encoding processing to obtain a sequence of word-granular part-of-speech one-hot encoding feature vectors, including:
[0013] Performing part-of-speech tagging on each Chinese word to be proofread in the sequence of Chinese words to be proofread to obtain a sequence of word-granular part-of-speech descriptions;
[0014] The sequence of word-granularity part-of-speech descriptions is encoded using a part-of-speech encoder based on a one-hot encoder to obtain a sequence of word-granularity part-of-speech one-hot encoded feature vectors.
[0015] For example, according to the knowledge base-based automatic Chinese text error correction method of an embodiment of the present disclosure, the Chinese text error correction is performed based on the sequence of semantic encoding feature vectors of the Chinese words to be proofread and the sequence of word-granularity part-of-speech one-hot encoding feature vectors to generate the corrected Chinese text, including:
[0016] Concatenate the sequence of semantic encoding feature vectors of the Chinese words to be proofread and the sequence of word-granularity part-of-speech one-hot encoding feature vectors to obtain a sequence of semantic encoding feature vectors of the Chinese words to be proofread that contain part-of-speech information;
[0017] The error-corrected Chinese text is generated based on the sequence of semantic encoding feature vectors of the Chinese words to be proofread that contain part-of-speech information.
[0018] For example, according to the knowledge base-based automatic Chinese text error correction method of an embodiment of the present disclosure, generating the error-corrected Chinese text based on the sequence of semantic encoding feature vectors of the Chinese words to be corrected containing part-of-speech information includes:
[0019] Performing feature optimization on each of the Chinese word semantic coding feature vectors to be proofread containing part of speech information in the sequence of Chinese word semantic coding feature vectors to be proofread containing part of speech information to obtain a sequence of optimized Chinese word semantic coding feature vectors to be proofread containing part of speech information;
[0020] The optimized sequence of semantic encoding feature vectors of the Chinese words to be proofread containing part-of-speech information is passed through a decoder-based text automatic error-proofing generator to obtain the error-proofed Chinese text.
[0021] For example, according to the knowledge base-based automatic error correction method for Chinese text according to an embodiment of the present disclosure, wherein, each of the semantic encoding feature vectors of the Chinese words to be proofread containing part of speech information in the sequence of semantic encoding feature vectors of the Chinese words to be proofread containing part of speech information is feature optimized to obtain a sequence of semantic encoding feature vectors of the Chinese words to be proofread containing part of speech information after optimization, including:
[0022] Respectively calculating the weighting coefficient of each semantic coding feature vector of the Chinese word to be proofread containing part of speech information in the sequence of semantic coding feature vectors of the Chinese word to be proofread containing part of speech information to obtain a weighting coefficient vector composed of a plurality of weighting coefficients;
[0023] Using each weighting coefficient in the weighting coefficient vector as a weighting factor, weighted optimization is performed on each of the Chinese word semantic coding feature vectors to be proofread that contain part-of-speech information in the sequence of Chinese word semantic coding feature vectors to be proofread that contain part-of-speech information to obtain the sequence of optimized Chinese word semantic coding feature vectors to be proofread that contain part-of-speech information.
[0024] The embodiment of the present disclosure also provides a Chinese text automatic error correction system based on a knowledge base, which includes:
[0025] The module for acquiring data to be proofread is used to acquire Chinese sentences to be proofread;
[0026] A word segmentation module, used for performing word segmentation processing on the Chinese sentence to be proofread to obtain a sequence of Chinese words to be proofread;
[0027] A semantic encoding module, used for semantically encoding each Chinese word to be proofread in the sequence of Chinese words to be proofread using a pre-trained word semantic encoder to obtain a sequence of semantic encoding feature vectors of the Chinese words to be proofread, wherein the pre-trained word semantic encoder is trained by a knowledge base;
[0028] A one-hot encoding module, used for performing part-of-speech tagging and one-hot encoding processing on each Chinese word to be proofread in the sequence of Chinese words to be proofread to obtain a sequence of one-hot encoding feature vectors of word granularity part-of-speech;
[0029] The text correction module is used to correct Chinese text based on the sequence of semantic encoding feature vectors of the Chinese words to be corrected and the sequence of word-granularity part-of-speech one-hot encoding feature vectors to generate a corrected Chinese text.
[0030] For example, according to the Chinese text automatic error correction system based on the knowledge base of an embodiment of the present disclosure, the one-hot encoding module includes:
[0031] A tagging unit, used for performing part-of-speech tagging on each Chinese word to be proofread in the sequence of Chinese words to be proofread to obtain a sequence of word-granularity part-of-speech descriptions;
[0032] The part-of-speech encoding unit is used to encode the sequence of word-granularity part-of-speech descriptions using a part-of-speech encoder based on a one-hot encoder to obtain a sequence of word-granularity part-of-speech one-hot encoded feature vectors.
[0033] For example, according to the Chinese text automatic error correction system based on the knowledge base of an embodiment of the present disclosure, the text error correction module includes:
[0034] A vector concatenation unit, used for concatenating the sequence of semantic encoding feature vectors of the Chinese words to be proofread and the sequence of word-granularity part-of-speech one-hot encoding feature vectors to obtain a sequence of semantic encoding feature vectors of the Chinese words to be proofread containing part-of-speech information;
[0035] The text generation unit is used to generate the error-corrected Chinese text based on the sequence of semantic encoding feature vectors of the Chinese words to be proofread that contain part-of-speech information.
[0036] For example, according to the Chinese text automatic error correction system based on the knowledge base of an embodiment of the present disclosure, the text generation unit includes:
[0037] A feature optimization subunit, configured to perform feature optimization on each of the Chinese word semantic coding feature vectors to be proofread containing part of speech information in the sequence of Chinese word semantic coding feature vectors to be proofread containing part of speech information, so as to obtain a sequence of optimized Chinese word semantic coding feature vectors to be proofread containing part of speech information;
[0038] The decoding subunit is used to pass the optimized sequence of semantic encoding feature vectors of the Chinese words to be proofread containing part-of-speech information through a text automatic error proofing generator based on a decoder to obtain the proofread Chinese text.
[0039] For example, in the Chinese text automatic error correction system based on the knowledge base according to an embodiment of the present disclosure, the feature optimization subunit is used to:
[0040] Respectively calculating the weighting coefficient of each semantic coding feature vector of the Chinese word to be proofread containing part of speech information in the sequence of semantic coding feature vectors of the Chinese word to be proofread containing part of speech information to obtain a weighting coefficient vector composed of a plurality of weighting coefficients;
[0041] Using each weighting coefficient in the weighting coefficient vector as a weighting factor, weighted optimization is performed on each of the Chinese word semantic coding feature vectors to be proofread that contain part-of-speech information in the sequence of Chinese word semantic coding feature vectors to be proofread that contain part-of-speech information to obtain the sequence of optimized Chinese word semantic coding feature vectors to be proofread that contain part-of-speech information.
[0042] According to the knowledge base-based automatic Chinese text error correction system and method of the embodiments of the present disclosure, the Chinese sentences to be proofread are collected, and natural language processing technology based on deep learning is introduced at the back end to perform semantic encoding and part-of-speech tagging on the Chinese sentences based on word granularity, so as to use the encoder-decoder structure to automatically proofread the Chinese text. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following briefly introduces the drawings of the embodiments of the present disclosure. Obviously, the drawings described below only relate to some embodiments of the present disclosure, and are not intended to limit the present disclosure.
[0044] Figure 1 A schematic diagram of the application architecture of the knowledge base-based Chinese text automatic error correction method in an embodiment of the present disclosure is shown;
[0045] Figure 2 A flow chart of a method for automatic error correction of Chinese text based on a knowledge base in an embodiment of the present disclosure is shown;
[0046] Figure 3 A flowchart of sub-step S540 of the method for automatic error correction of Chinese text based on a knowledge base in an embodiment of the present disclosure is shown;
[0047] Figure 4 A flowchart of sub-step S550 of the method for automatic error correction of Chinese text based on a knowledge base in an embodiment of the present disclosure is shown;
[0048] Figure 5 A flowchart of sub-step S552 of the method for automatic error correction of Chinese text based on a knowledge base in an embodiment of the present disclosure is shown;
[0049] Figure 6 A flowchart of sub-step S5521 of the method for automatic error correction of Chinese text based on a knowledge base in an embodiment of the present disclosure is shown;
[0050] Figure 7 A schematic diagram of the structure of a Chinese text automatic error correction system based on a knowledge base in an embodiment of the present disclosure is shown;
[0051] Figure 8 An application scenario diagram of the Chinese text automatic error correction method based on the knowledge base in the embodiment of the present disclosure is shown;
[0052] Fig. 9 A schematic diagram of a storage medium according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0053] The technical solutions in the embodiments of the present disclosure will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present disclosure, rather than all embodiments. Based on the embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work also fall within the scope of protection of the present disclosure.
[0054] The terms used in this specification are those general terms currently widely used in the art in consideration of the functions of the present disclosure, but these terms may vary according to the intention of a person of ordinary skill in the art, precedents, or new technologies in the art. In addition, specific terms may be selected by the applicant, and in this case, their detailed meanings will be described in the detailed description of the present disclosure. Therefore, the terms used in the specification should not be understood as simple names, but rather as an overall description based on the meaning of the terms and the present disclosure.
[0055] Although the present disclosure makes various references to certain modules in the system according to embodiments of the present disclosure, any number of different modules can be used and run on a user terminal and / or server. The modules are illustrative only, and different aspects of the systems and methods can use different modules.
[0056] Flowcharts are used in this disclosure to illustrate the operations performed by the system according to the embodiments of the present disclosure. It should be understood that the preceding or following operations are not necessarily performed precisely in order. On the contrary, various steps may be processed in reverse order or simultaneously as required. At the same time, other operations may also be added to these processes, or one or more operations may be removed from these processes.
[0057] Figure 1 A schematic diagram of the application architecture of the knowledge base-based Chinese text automatic error correction method in an embodiment of the present disclosure is shown, including a server 100 and a terminal device 200.
[0058] The terminal device 200 and the server 100 can be connected via the Internet to achieve mutual communication. Optionally, the above-mentioned Internet uses standard communication technology and / or protocol. The Internet is usually the Internet, but it can also be any network, including but not limited to any combination of a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a dedicated network or a virtual private network. In some embodiments, the data exchanged through the network is represented by technologies and / or formats including Hyper Text Markup Language (HTML), Extensible Markup Language (XML), etc. In addition, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet Protocol Security (IPsec) can also be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technologies can also be used to replace or supplement the above-mentioned data communication technologies.
[0059] The server 100 can provide various network services for the terminal device 200, wherein the server 100 can be a single server, a server cluster consisting of several servers, or a cloud computing center. Specifically, the server 100 may include a processor 110 (Center Processing Unit, CPU), a memory 120, an input device 130, and an output device 140, etc. The input device 130 may include a keyboard, a mouse, a touch screen, etc., and the output device 140 may include a display device, such as a liquid crystal display (Liquid Crystal Display, LCD), a cathode ray tube (Cathode Ray Tube, CRT), etc.
[0060] The memory 120 may include a read-only memory (ROM) and a random access memory (RAM), and provides the processor 110 with program instructions and data stored in the memory 120. In the embodiment of the present disclosure, the memory 120 may be used to store the program of the Chinese text automatic error correction method based on the knowledge base in the embodiment of the present disclosure.
[0061] The processor 110 calls the program instructions stored in the memory 120, and the processor 110 is used to execute the steps of any one of the knowledge base-based Chinese text automatic error correction methods in the embodiments of the present disclosure according to the obtained program instructions.
[0062] In addition, the application architecture diagram in the embodiment of the present disclosure is intended to more clearly illustrate the technical solution in the embodiment of the present disclosure, and does not constitute a limitation on the technical solution provided in the embodiment of the present disclosure. Of course, for other application architectures and business applications, the technical solution provided in the embodiment of the present disclosure is also applicable to similar problems.
[0063] The following is a non-restrictive description of the knowledge base-based Chinese text automatic error correction method provided according to at least one embodiment of the present disclosure through several examples or embodiments. As described below, different features in these specific examples or embodiments can be combined with each other without conflicting with each other to obtain new examples or embodiments, and these new examples or embodiments also fall within the scope of protection of the present disclosure.
[0064] In view of the above technical problems, in the technical solution of the present application, a method for automatic error correction of Chinese text based on a knowledge base is proposed, which can collect Chinese sentences to be proofread, and introduce natural language processing technology based on deep learning at the back end to perform semantic encoding and part-of-speech tagging based on word granularity on the Chinese sentences, so as to use the structure of encoder-decoder to automatically correct Chinese text, for example, replace wrong words, adjust word order, modify grammatical structure, etc. In addition, in the error correction method, by using the knowledge base to train the word semantic encoder, the rich semantic and grammatical information in the knowledge base can be used to help the model better understand the text and identify errors. In this way, automatic error correction of Chinese text can be realized, avoiding the low efficiency and difficulty in coping with complex Chinese text error types caused by traditional error correction schemes, and can effectively and intelligently process and correct errors in Chinese text.
[0065] Figure 2 The flowchart of the method for automatic error correction of Chinese text based on the knowledge base in the embodiment of the present disclosure is shown. For example, the method for automatic error correction of Chinese text based on the knowledge base can be executed by a server, which can be Figure 1 The server 100 shown in FIG. Figure 2As shown, according to the embodiment of the present disclosure, the automatic Chinese text error correction method based on the knowledge base includes the steps of: S510, obtaining a Chinese sentence to be proofread; S520, performing word segmentation processing on the Chinese sentence to be proofread to obtain a sequence of Chinese words to be proofread; S530, using a pre-trained word semantic encoder to semantically encode each Chinese word to be proofread in the sequence of Chinese words to be proofread to obtain a sequence of semantic encoding feature vectors of the Chinese words to be proofread, wherein the pre-trained word semantic encoder is trained through a knowledge base; S540, performing part-of-speech tagging and one-hot encoding processing on each Chinese word to be proofread in the sequence of Chinese words to be proofread to obtain a sequence of word-granularity part-of-speech one-hot encoding feature vectors; and, S550, performing Chinese text error correction based on the sequence of semantic encoding feature vectors of the Chinese words to be proofread and the sequence of word-granularity part-of-speech one-hot encoding feature vectors to generate a proofread Chinese text.
[0066] Specifically, in the technical solution of the present application, first, obtain the Chinese sentence to be proofread. Then, considering that Chinese is a language with words as the basic unit, each word represents an independent semantic unit, therefore, the Chinese sentence to be proofread contains a large amount of word granularity semantic information. Based on this, in order to better understand the semantics of the sentence and identify problems such as wrong words, disordered word order, and grammatical structure errors between words, it is necessary to perform word segmentation on the Chinese sentence to be proofread to obtain a sequence of Chinese words to be proofread. In other words, when performing text proofreading, it is crucial to identify the semantics of each word. Word segmentation can accurately determine the boundaries and semantic information of each word, which helps to locate errors and make corrections in a targeted manner. It is worth mentioning that the vocabulary sequence obtained after word segmentation can be used as the basic unit of features. In subsequent processing, these words can be used to extract semantic information, part of speech information, etc., so as to help the model better understand the text content.
[0067] Then, considering that in the process of Chinese text error proofing, it is necessary to semantically encode each Chinese word to be proofread in the sequence of Chinese words to be proofread, so as to understand and capture the semantic information of each Chinese word. In particular, since the knowledge base contains rich semantic and grammatical information, a large amount of semantics in the knowledge base can be used to help the model better understand the text and identify errors. Based on this, in the technical solution of the present application, a pre-trained word semantic encoder is further used to semantically encode each Chinese word to be proofread in the sequence of Chinese words to be proofread to obtain a sequence of semantic encoding feature vectors of Chinese words to be proofread, wherein the pre-trained word semantic encoder is trained through the knowledge base. By using the pre-trained word semantic encoder to semantically encode each Chinese word to be proofread, the ambiguity and contextual information of the vocabulary can be better considered to help the model better understand the meaning of the vocabulary in different contexts. In addition, the training word semantic encoder is trained through the knowledge base, which can integrate a large amount of language knowledge and semantic information. Such a training method helps to improve the model's ability to understand the semantics of vocabulary.
[0068] Furthermore, considering that in the process of Chinese text proofreading, it is necessary not only to encode the semantic information of each word, but also to determine the part of speech and grammatical function of each word in the sentence, such as noun, verb, adjective, etc., in order to judge its position in the sentence, so as to better understand the structure and grammatical relationship of the sentence. This helps to more accurately judge whether there are confusion in word order and grammatical errors in the sentence, such as mismatch of word classes, improper word order and other problems. Therefore, in the technical solution of the present application, each Chinese word to be proofread in the sequence of Chinese words to be proofread is further tagged with part of speech to obtain a sequence of word-granular part of speech description. Through part of speech tagging, problems such as confusion in word order and grammatical errors in the sentence can be more easily discovered and corrected.
[0069] Furthermore, in order to convert the part-of-speech information of each word in the text into a numerical feature that can be understood and processed by the model, so as to carry out subsequent text processing and analysis, in the technical solution of the present application, a part-of-speech encoder based on a one-hot encoder is used to encode the sequence of word-granularity part-of-speech descriptions to obtain a sequence of word-granularity part-of-speech one-hot encoded feature vectors. It should be understood that one-hot encoding is a commonly used part-of-speech encoding and representation method that can convert discrete part-of-speech tags into sparse numerical feature vectors. Specifically, each part-of-speech tag corresponds to a unique position. In the process of one-hot encoding, the position is set to 1 and the remaining positions are set to 0, thereby realizing the numerical representation of the part-of-speech information.
[0070] Accordingly, in step S540, if Figure 3As shown, each Chinese word to be proofread in the sequence of Chinese words to be proofread is subjected to part-of-speech tagging and one-hot encoding processing to obtain a sequence of word-granularity part-of-speech one-hot encoding feature vectors, including: S541, performing part-of-speech tagging on each Chinese word to be proofread in the sequence of Chinese words to be proofread to obtain a sequence of word-granularity part-of-speech descriptions; and, S542, using a part-of-speech encoder based on a one-hot encoder to encode the sequence of word-granularity part-of-speech descriptions to obtain a sequence of word-granularity part-of-speech one-hot encoding feature vectors.
[0071] It should be understood that step S540 is a key link in the automatic error correction method of Chinese text, which involves part-of-speech tagging and unique-hot encoding of each word in the Chinese text. This process is further subdivided into two sub-steps, namely S541 and S542. Part-of-speech tagging is a basic task in natural language processing, and its purpose is to assign a correct part-of-speech to each word in the text. In step S541, a pre-trained part-of-speech tagging model is used to identify the part-of-speech of each Chinese word, such as noun, verb, adjective, etc. The result of part-of-speech tagging is a sequence of word-granular part-of-speech descriptions, that is, each word is followed by a corresponding part-of-speech description. Part-of-speech tagging is very important for subsequent text correction because it can help the system better understand the structure of the sentence and the relationship between words. For example, if a verb in a sentence is followed by a noun, the system can infer that the noun is likely to be the object of the verb. If it is found that the part-of-speech of some words does not conform to grammatical rules or context, the system can mark it as a potential error. After obtaining the sequence of word-granular part-of-speech descriptions, it is necessary to convert these part-of-speech descriptions into a form that can be processed by the machine learning model. One-hot encoding is a commonly used numerical conversion method that can convert the description of each part-of-speech into a binary vector. In general, the part-of-speech tagging and one-hot encoding processing in step S540 are an indispensable part of the automatic error correction method. They provide important feature information for the subsequent correction steps, allowing the model to more accurately identify and correct errors in the text.
[0072] Next, in order to integrate the part-of-speech information into the semantic coding feature vector of each word in the Chinese sentence, thereby providing a more comprehensive and richer word-granularity semantic feature representation, in the technical solution of the present application, the sequence of the semantic coding feature vectors of the Chinese words to be proofread and the sequence of the word-granularity part-of-speech unique hot coding feature vectors are further spliced to obtain a sequence of the semantic coding feature vectors of the Chinese words to be proofread containing part-of-speech information. It should be understood that since the part-of-speech information and semantic information of each word in the sentence each provide different aspects of the language features of the words, the semantic information can provide the semantic understanding features of the words or phrases in the sentence, and the part-of-speech information can provide clues about the role and grammatical function of the word in the sentence, which helps the model better understand the context of the word in the context. Therefore, splicing the part-of-speech information and semantic information of each word in the sentence can provide a richer and more comprehensive feature representation for each word, so that the model can more accurately understand the meaning of the sentence, and help the model better understand and deal with the ambiguity in the sentence.
[0073] Then, the sequence of semantic coding feature vectors of Chinese words to be proofread containing part-of-speech information is passed through a decoder-based text automatic error correction generator to obtain the proofread Chinese text. In other words, the combined features of the spliced word semantic information and part-of-speech information are used to identify and correct spelling errors, grammatical errors or semantic errors in the text, and generate the proofread Chinese text. It is worth mentioning that the semantic coding feature vectors of Chinese words to be proofread containing part-of-speech information can help the model better understand the grammatical structure and semantic relationship in the text, so as to more accurately identify and correct errors. In this way, automatic error correction of Chinese text can be achieved, avoiding the low efficiency and difficulty in dealing with complex Chinese text error types brought by traditional error correction schemes, and can effectively and intelligently process and proofread errors in Chinese text.
[0074] Accordingly, in step S550, if Figure 4 As shown, Chinese text is proofread based on the sequence of semantic coding feature vectors of Chinese words to be proofread and the sequence of word-granularity part-of-speech one-hot coding feature vectors to generate proofread Chinese text, including: S551, concatenating the sequence of semantic coding feature vectors of Chinese words to be proofread and the sequence of word-granularity part-of-speech one-hot coding feature vectors to obtain a sequence of semantic coding feature vectors of Chinese words to be proofread that contain part-of-speech information; and, S552, generating the proofread Chinese text based on the sequence of semantic coding feature vectors of Chinese words to be proofread that contain part-of-speech information.
[0075] Among them, in step S552, if Figure 5As shown, based on the sequence of semantic coding feature vectors of Chinese words to be proofread that contain part-of-speech information, generating the proofread Chinese text, includes: S5521, performing feature optimization on each semantic coding feature vector of Chinese words to be proofread that contains part-of-speech information in the sequence of semantic coding feature vectors of Chinese words to be proofread that contain part-of-speech information to obtain a sequence of optimized semantic coding feature vectors of Chinese words to be proofread that contain part-of-speech information; and, S5522, passing the sequence of optimized semantic coding feature vectors of Chinese words to be proofread that contain part-of-speech information through a decoder-based text automatic proofreading generator to obtain the proofread Chinese text.
[0076] It is worth mentioning that the decoder is an important component in natural language processing (NLP), especially in the sequence-to-sequence (Seq2Seq) model. In the application disclosed in the present invention, the main function of the decoder is to convert the information output by the encoder (in this scenario, it is the optimized semantic encoding feature vector sequence of the Chinese words to be proofread containing part-of-speech information) into the final target output, that is, the corrected Chinese text. In the knowledge base-based automatic error correction method for Chinese text, the role of the decoder is to convert the semantic encoding feature vector sequence of the word containing part-of-speech information into a more natural, accurate, and grammatically correct Chinese text. In this way, the decoder can effectively use the information provided by the encoder to generate high-quality corrected text.
[0077] In the above technical scheme, each semantic coding feature vector of the Chinese word to be proofread containing part-of-speech information in the sequence of semantic coding feature vectors of the Chinese word to be proofread containing part-of-speech information represents a combination of the encoded text semantic features and the part-of-speech coding features of the corresponding Chinese word to be proofread. Therefore, taking into account the source text semantic differences and the corresponding part-of-speech differences of each Chinese word to be proofread itself, after amplifying the feature semantic distribution differences through feature coding, each semantic coding feature vector of the Chinese word to be proofread containing part-of-speech information in the sequence of semantic coding feature vectors of the Chinese word to be proofread containing part-of-speech information will have a more significant feature distribution distinctiveness corresponding to different words.
[0078] Therefore, when the sequence of semantic encoding feature vectors of Chinese words to be proofread containing part-of-speech information is passed through a decoder to regress to the text semantic probability density domain of the decoded text, it is expected to maintain the distinctiveness of the feature distribution of each semantic encoding feature vector of Chinese words to be proofread containing part-of-speech information while improving the mapping probability certainty to the text semantic probability density domain of the decoded text, thereby improving the text quality of the proofread Chinese text.
[0079] Based on this, the applicant of the present application respectively calculates the weight coefficient of each semantic coding feature vector of the Chinese word to be proofread containing part of speech information in the sequence of semantic coding feature vectors of the Chinese word to be proofread containing part of speech information.
[0080] Accordingly, in one example, in step S5521, Figure 6 As shown, feature optimization is performed on each of the Chinese word semantic coding feature vectors to be proofread containing part-of-speech information in the sequence of Chinese word semantic coding feature vectors to be proofread containing part-of-speech information to obtain a sequence of optimized Chinese word semantic coding feature vectors to be proofread containing part-of-speech information, including: S55211, respectively calculating the weighting coefficient of each Chinese word semantic coding feature vector to be proofread containing part-of-speech information in the sequence of Chinese word semantic coding feature vectors to be proofread containing part-of-speech information to obtain a weighting coefficient vector composed of multiple weighting coefficients; and, S55212, using each weighting coefficient in the weighting coefficient vector as a weighting factor to perform weighted optimization on each of the Chinese word semantic coding feature vectors to be proofread containing part-of-speech information in the sequence of Chinese word semantic coding feature vectors to be proofread containing part-of-speech information to obtain the sequence of optimized Chinese word semantic coding feature vectors to be proofread containing part-of-speech information.
[0081] Wherein, in step S55211, the weight coefficient of each Chinese word semantic coding feature vector to be proofread containing part-of-speech information in the sequence of Chinese word semantic coding feature vectors to be proofread containing part-of-speech information is calculated respectively to obtain a weight coefficient vector composed of multiple weight coefficients, including: using the following coefficient calculation formula to calculate the weight coefficient of each Chinese word semantic coding feature vector to be proofread containing part-of-speech information in the sequence of Chinese word semantic coding feature vectors to be proofread containing part-of-speech information to obtain a weight coefficient vector composed of multiple weight coefficients; wherein the coefficient calculation formula is:
[0082]
[0083] Among them, v i-max and v i-j are respectively the i-th semantic coding feature vector V of the Chinese word to be proofread containing part of speech information in the sequence of the semantic coding feature vectors of the Chinese word to be proofread containing part of speech information i The maximum eigenvalue and the jth eigenvalue of , L is the length of the eigenvector, log represents the logarithm with base 2, exp[·] represents the exponential operation of a value, and the exponential operation of the value represents the calculation of the value of the natural exponential function with the value as the power, and α is the weight hyperparameter, ω i is the i-th weighting coefficient.
[0084] Specifically, the semantic encoding feature vector V of each Chinese word to be proofread containing part-of-speech information is respectivelyi The semantic feature distribution is based on the majority voting mechanism in the form of semantic feature crowdsourcing to seek the maximum individual information expectation of each feature vector under the distribution subordinate probability model of the semantic encoding feature vector of each Chinese word to be proofread containing part-of-speech information relative to the semantic probability density domain mapping space of the decoded text. In this way, by using the coefficient ω i For each Chinese word to be proofread that contains part-of-speech information, the semantic encoding feature vector V i Weighting is performed to optimize the semantic encoding feature vector V of the Chinese word to be proofread containing part-of-speech information i , it is possible to use the semantic coding feature vector V of each Chinese word to be proofread containing part-of-speech information as i The confidence of each feature value local information is jointly estimated relative to the distribution of the decoded text semantic probability density domain mapping space, so as to maintain the semantic encoding feature vector V of each Chinese word to be proofread containing part of speech information. i While improving the distinguishability of the text semantic feature distribution, it also improves the certainty of its probability mapping relative to the semantic probability density domain of the decoded text, thereby improving the text quality of the proofread Chinese text.
[0085] Based on the above embodiments, see Figure 7 , which is a schematic diagram of the structure of a Chinese text automatic error correction system 800 based on a knowledge base in an embodiment of the present disclosure. The knowledge base-based Chinese text automatic error proofing system 800 includes: a to-be-proofread data acquisition module 810, used to acquire Chinese sentences to be proofread; a word segmentation module 820, used to perform word segmentation processing on the Chinese sentences to be proofread to obtain a sequence of Chinese words to be proofread; a semantic encoding module 830, used to use a pre-trained word semantic encoder to semantically encode each Chinese word to be proofread in the sequence of Chinese words to be proofread to obtain a sequence of semantic encoding feature vectors of the Chinese words to be proofread, wherein the pre-trained word semantic encoder is trained through a knowledge base; a one-hot encoding module 840, used to perform part-of-speech tagging and one-hot encoding processing on each Chinese word to be proofread in the sequence of Chinese words to be proofread to obtain a sequence of word-granularity part-of-speech one-hot encoding feature vectors; and a text error proofing module 850, used to perform Chinese text error proofing based on the sequence of semantic encoding feature vectors of the Chinese words to be proofread and the sequence of word-granularity part-of-speech one-hot encoding feature vectors to generate error-proofed Chinese text.
[0086] In one example, in the above-mentioned knowledge base-based Chinese text automatic error correction system 800, the one-hot encoding module 840 includes: a tagging unit, used to perform part-of-speech tagging on each Chinese word to be proofread in the sequence of Chinese words to be proofread to obtain a sequence of word-granularity part-of-speech descriptions; and a part-of-speech encoding unit, used to encode the sequence of word-granularity part-of-speech descriptions using a part-of-speech encoder based on a one-hot encoder to obtain a sequence of word-granularity part-of-speech one-hot encoded feature vectors.
[0087] In one example, in the above-mentioned knowledge base-based Chinese text automatic proofreading system 800, the text proofreading module 850 includes: a vector concatenation unit, used to concatenate the sequence of the semantic encoding feature vectors of the Chinese words to be proofread and the sequence of the word-granularity part-of-speech one-hot encoding feature vectors to obtain a sequence of the semantic encoding feature vectors of the Chinese words to be proofread containing part-of-speech information; and a text generation unit, used to generate the proofread Chinese text based on the sequence of the semantic encoding feature vectors of the Chinese words to be proofread containing part-of-speech information.
[0088] In one example, in the above-mentioned knowledge base-based Chinese text automatic error correction system 800, the text generation unit includes: a feature optimization subunit, used to perform feature optimization on each of the Chinese word semantic coding feature vectors to be proofread containing part-of-speech information in the sequence of Chinese word semantic coding feature vectors to be proofread containing part-of-speech information to obtain a sequence of optimized Chinese word semantic coding feature vectors to be proofread containing part-of-speech information; and a decoding subunit, used to pass the sequence of optimized Chinese word semantic coding feature vectors to be proofread containing part-of-speech information through a decoder-based text automatic error correction generator to obtain the proofread Chinese text.
[0089] In one example, in the above-mentioned knowledge base-based Chinese text automatic error correction system 800, the feature optimization subunit is used to: respectively calculate the weight coefficient of each Chinese word semantic coding feature vector to be proofread containing part-of-speech information in the sequence of Chinese word semantic coding feature vectors to be proofread containing part-of-speech information to obtain a weighted coefficient vector composed of multiple weighted coefficients; and, use each weighted coefficient in the weighted coefficient vector as a weighting factor to perform weighted optimization on each Chinese word semantic coding feature vector to be proofread containing part-of-speech information in the sequence of Chinese word semantic coding feature vectors to be proofread containing part-of-speech information to obtain the sequence of optimized Chinese word semantic coding feature vectors to be proofread containing part-of-speech information.
[0090] Here, those skilled in the art can understand that the specific functions and operations of each module in the above-mentioned knowledge base-based Chinese text automatic error correction system 800 have been described in the above reference. Figures 2 to 6The invention has been introduced in detail in the description of the knowledge base-based Chinese text automatic error correction method, and therefore, its repeated description will be omitted.
[0091] Figure 8 FIG. 1 is an application scenario diagram of the Chinese text automatic error correction method based on the knowledge base according to the embodiment of the present disclosure. Figure 8 As shown, in this application scenario, first, the Chinese sentence to be proofread is obtained (for example, Figure 8 D), then, the Chinese sentence to be proofread is input to a server (for example, Figure 8 In S) shown in , the server can use the knowledge base-based Chinese text automatic error correction algorithm to process the Chinese sentence to be proofread to obtain a proofread Chinese text.
[0092] Based on the above embodiment, another exemplary embodiment of an electronic device is also provided in the embodiments of the present disclosure. In some possible implementations, the electronic device in the embodiments of the present disclosure may include a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the steps of the automatic error correction method for Chinese text based on the knowledge base in the above embodiment can be implemented when the processor executes the program.
[0093] For example, the electronic device is disclosed in the present invention Figure 1 Taking the server 100 in the example as an example, the processor in the electronic device is the processor 110 in the server 100, and the memory in the electronic device is the memory 120 in the server 100.
[0094] An embodiment of the present disclosure also provides a computer-readable storage medium. Fig. 9 FIG. 1 is a schematic diagram of a computer-readable storage medium 1000 according to an embodiment of the present disclosure. Fig. 9 As shown, the computer-readable storage medium 1000 stores computer-executable instructions 1001. When the computer-executable instructions 1001 are executed by the processor, the Chinese text automatic error correction method based on the knowledge base according to the embodiment of the present disclosure described with reference to the above figures can be executed. The computer-readable storage medium includes, but is not limited to, for example, volatile memory and / or non-volatile memory. The volatile memory may include, for example, a random access memory (RAM) and / or a cache memory (cache), etc. The non-volatile memory may include, for example, a read-only memory (ROM), a hard disk, a flash memory, etc.
[0095] The embodiment of the present disclosure also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the Chinese text automatic error correction method based on the knowledge base according to the embodiment of the present disclosure.
[0096] Those skilled in the art will appreciate that the contents disclosed in this disclosure may be subject to various modifications and improvements. For example, the various devices or components described above may be implemented by hardware, or by software, firmware, or a combination of some or all of the three.
[0097] In addition, although the present disclosure makes various references to certain units in the system according to embodiments of the present disclosure, any number of different units may be used and run on the client and / or server. The units are illustrative only, and different aspects of the systems and methods may use different units.
[0098] Those skilled in the art will appreciate that all or part of the steps in the above method can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk. Optionally, all or part of the steps in the above embodiment can also be implemented using one or more integrated circuits. Accordingly, each module / unit in the above embodiment can be implemented in the form of hardware or in the form of a software functional module. The present disclosure is not limited to any particular form of combination of hardware and software.
[0099] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present disclosure belongs. It should also be understood that terms such as those defined in common dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant technology and should not be interpreted in an idealized or highly formal sense, unless explicitly defined as such herein.
[0100] The above is an explanation of the present disclosure and should not be considered as a limitation thereof. Although several exemplary embodiments of the present disclosure have been described, it will be readily understood by those skilled in the art that many modifications may be made to the exemplary embodiments without departing from the novel teachings and advantages of the present disclosure. Therefore, all such modifications are intended to be included within the scope of the present disclosure as defined in the claims. It should be understood that the above is an explanation of the present disclosure and should not be considered as being limited to the specific embodiments disclosed, and modifications to the disclosed embodiments and other embodiments are intended to be included within the scope of the appended claims. The present disclosure is defined by the claims and their equivalents.
Claims
1. A knowledge base-based automatic error correction method for Chinese texts. It is characterized in that include: Get the Chinese sentences to be proofread; Performing word segmentation processing on the Chinese sentence to be proofread to obtain a sequence of Chinese words to be proofread; Using a pre-trained word semantic encoder to semantically encode each Chinese word to be proofread in the sequence of Chinese words to be proofread to obtain a sequence of semantic encoding feature vectors of the Chinese words to be proofread, wherein the pre-trained word semantic encoder is trained by a knowledge base; Performing part-of-speech tagging and one-hot encoding processing on each Chinese word to be proofread in the sequence of Chinese words to be proofread to obtain a sequence of word-granular part-of-speech one-hot encoding feature vectors; Proofreading Chinese text based on the sequence of semantic encoding feature vectors of the Chinese words to be proofread and the sequence of word-granularity part-of-speech one-hot encoding feature vectors to generate a proofread Chinese text; The Chinese text is corrected based on the sequence of semantic encoding feature vectors of the Chinese words to be corrected and the sequence of one-hot encoding feature vectors of the word granularity part of speech to generate a corrected Chinese text, including: Concatenate the sequence of semantic encoding feature vectors of the Chinese words to be proofread and the sequence of word-granularity part-of-speech one-hot encoding feature vectors to obtain a sequence of semantic encoding feature vectors of the Chinese words to be proofread that contain part-of-speech information; Generate the error-corrected Chinese text based on the sequence of semantic encoding feature vectors of the Chinese words to be proofread that contain part-of-speech information; The step of generating the error-corrected Chinese text based on the sequence of semantic encoding feature vectors of the Chinese words to be proofread that contain part-of-speech information comprises: Performing feature optimization on each of the Chinese word semantic coding feature vectors to be proofread containing part of speech information in the sequence of Chinese word semantic coding feature vectors to be proofread containing part of speech information to obtain a sequence of optimized Chinese word semantic coding feature vectors to be proofread containing part of speech information; Passing the optimized sequence of semantic encoding feature vectors of the Chinese words to be proofread containing part-of-speech information through a decoder-based text automatic error-proofing generator to obtain the error-proofed Chinese text; Among them, performing feature optimization on each of the Chinese word semantic coding feature vectors to be proofread containing part of speech information in the sequence of Chinese word semantic coding feature vectors to be proofread containing part of speech information to obtain a sequence of optimized Chinese word semantic coding feature vectors to be proofread containing part of speech information includes: Respectively calculating the weighting coefficient of each semantic coding feature vector of the Chinese word to be proofread containing part of speech information in the sequence of semantic coding feature vectors of the Chinese word to be proofread containing part of speech information to obtain a weighting coefficient vector composed of a plurality of weighting coefficients; Using each weighting coefficient in the weighting coefficient vector as a weighting factor, weighted optimization is performed on each of the Chinese word semantic coding feature vectors to be proofread containing part of speech information in the sequence of Chinese word semantic coding feature vectors to be proofread containing part of speech information to obtain the sequence of Chinese word semantic coding feature vectors to be proofread containing part of speech information after optimization; Wherein, respectively calculating the weight coefficient of each of the semantic coding feature vectors of the Chinese words to be proofread that contain part-of-speech information in the sequence of the semantic coding feature vectors of the Chinese words to be proofread that contain part-of-speech information to obtain a weight coefficient vector composed of a plurality of weight coefficients, including: respectively calculating the weight coefficient of each of the semantic coding feature vectors of the Chinese words to be proofread that contain part-of-speech information in the sequence of the semantic coding feature vectors of the Chinese words to be proofread that contain part-of-speech information using the following coefficient calculation formula to obtain a weight coefficient vector composed of a plurality of weight coefficients; wherein, the coefficient calculation formula is: ; in, and are the first A semantic encoding feature vector of the Chinese word to be proofread containing part-of-speech information The maximum eigenvalue and Eigenvalues, is the length of the eigenvector, represents the logarithm with base 2, represents an exponential operation of a value, wherein the exponential operation of the value represents the calculation of the value of a natural exponential function with the value as a power, and is the weight hyperparameter, It is A weighting factor.
2. The method for automatic error correction of Chinese text based on a knowledge base according to claim 1, It is characterized in that Performing part-of-speech tagging and one-hot encoding processing on each Chinese word to be proofread in the sequence of Chinese words to be proofread to obtain a sequence of word-granular part-of-speech one-hot encoding feature vectors, including: Performing part-of-speech tagging on each Chinese word to be proofread in the sequence of Chinese words to be proofread to obtain a sequence of word-granular part-of-speech descriptions; The sequence of word-granularity part-of-speech descriptions is encoded using a part-of-speech encoder based on a one-hot encoder to obtain a sequence of word-granularity part-of-speech one-hot encoded feature vectors.
