A method for generating Chinese easily confused words based on knowledge graph
Through a knowledge graph-based method, the Chinese word knowledge ontology is defined and combined with deep learning models, the cross-domain problem of Chinese easy-to-mix word generation is solved, and the accuracy and generalization of Chinese text error correction are improved.
Patent Information
- Application Number
- CN202211609449.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-14
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2042-12-14
AI Technical Summary
The existing Chinese easy-to-miscellaneous word generation method lacks unified standards, is difficult to generalize across fields, and relies on expert experience, resulting in insufficient Chinese text error correction performance.
The knowledge graph-based method is used to define the knowledge ontology of Chinese words, calculate and edit distance through pronunciation, glyphs, semantic similarity calculation and editing distance, combined with deep learning models, a collection of easy-to-misswords is generated, and the subgraphs of the knowledge graph and the multi-input and multi-output model are trained.
It realizes cross-domain Chinese word generation, improves the accuracy and generalization ability of Chinese text error correction, and integrates the characterization and processing capabilities of multi-source heterogeneous data.
Smart Images

Figure CN115858811B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of text error correction, and in particular to a method for generating easily confused Chinese words based on a knowledge graph. Background Art
[0002] In the field of text correction, commonly used methods include text correction methods based on language models and text correction methods based on deep learning models. Regardless of which type of method, the set of easily confused words plays an important role.
[0003] The main idea of the text correction method based on the language model is to preprocess the text to be corrected, locate the position of the grammatical error according to a certain method, and search for candidate characters / words for each character / word in the text in the easily confused word set according to the character granularity or word granularity, thereby generating a candidate text set for the text to be corrected. Then, by evaluating each candidate text and comparing it with the text to be corrected, the correction of specific types of erroneous texts can be achieved.
[0004] Text error correction methods based on deep learning models can be categorized as unsupervised, supervised, and weakly supervised, depending on the amount of training data and model structure. These methods primarily apply confusable word sets to two types of data. First, due to the difficulty in obtaining accurately labeled data, a common data augmentation approach is to generate synthetic data containing errors from grammatically correct text data using confusable word sets. This data is then used to train model parameters, thereby improving the model's accuracy in predicting text errors. Second, to improve the performance of text error correction methods based on deep learning models, a feasible approach is to generate a corresponding confusable word set from the input text and integrate it into the model as additional features, thereby improving the accuracy of the text error correction model.
[0005] Currently, research on easily confused words in the field of text error correction primarily focuses on English text, while there is relatively little research on the generation of easily confused words in Chinese. The generation process of English easily confused word sets primarily considers factors such as pronunciation, word edit distance, domain, and theme. Compared to English, Chinese is a morpheme-based language, making it easier to misplace characters and produce typos with similar glyphs during writing. Therefore, factors such as pronunciation, glyph shape, and domain are commonly considered in the generation of easily confused words in Chinese. Furthermore, with the development of representation learning models, word / character similarity based on word vectors has also become a consideration in the generation of easily confused words in Chinese. However, the generation process of easily confused words in Chinese lacks a unified standard, and separate easily confused word sets are typically constructed for different domains. These resulting easily confused word sets lack generalizability and are therefore difficult or impossible to apply to other domains.
[0006] In summary, Chinese easily confused words are of great significance to Chinese text error correction. However, there are still many problems in the process of generating Chinese easily confused words. On the one hand, the generation process of the Chinese easily confused word set is strongly dependent on the application field. When the field changes, the existing Chinese easily confused word set is difficult to generalize directly to the new field. On the other hand, the process of generating the Chinese easily confused word set is strongly dependent on the expert experience of weighing the factors that need to be considered, and there is a lack of unified standards. Therefore, studying the key factors that affect the generation process of Chinese easily confused words and establishing a generation method with good generalization are of great significance to improving the performance of Chinese text error correction algorithms. It is one of the key issues currently studied in this field. Summary of the Invention
[0007] The purpose of the present invention is to provide a method for generating Chinese easily confused words based on a knowledge graph to address the problem that existing Chinese text correction methods have difficulty in effectively utilizing information such as scenes, fields, and contexts to flexibly and accurately generate Chinese easily confused words.
[0008] The purpose of the present invention is achieved through the following technical solutions:
[0009] A method for generating Chinese easily confused words based on a knowledge graph includes the following steps:
[0010] Step 1: Define a Chinese word knowledge ontology for generating easily confused Chinese words, including entity types and / or entity attributes, as well as relationship types and / or relationship attributes between entities;
[0011] Step 2: Clean and extract features from Chinese text data to obtain processed Chinese characters and words and their corresponding features, and generate a Chinese word set;
[0012] Step 3: Based on the generated Chinese word set, calculate the similarity and edit distance between words in pronunciation, word form, and semantics;
[0013] Step 4: Complete the knowledge graph instantiation based on the knowledge ontology constructed in step 1, the Chinese word set obtained by data preprocessing in step 2, and the pronunciation, word form, and semantic similarity and edit distance obtained in step 3;
[0014] Step 5: Based on the Chinese word set obtained in step 2, use the knowledge graph obtained in step 4 to obtain a subgraph of the knowledge graph corresponding to each data in the Chinese word set;
[0015] Step 6: Based on the pronunciation, word form, semantic similarity and edit distance obtained in step 3, obtain a set of easily confused words for each Chinese word in the Chinese word set;
[0016] Step 7: Construct a multi-input and multi-output Chinese easily confused word generation model based on deep learning, using the Chinese word set obtained in step 2 and the subgraph of the knowledge graph corresponding to each data obtained in step 5 as input, and the easily confused word set of each Chinese word obtained in step 6 as a label to train the Chinese easily confused word generation model;
[0017] Step 8: Receive user input and perform the same cleaning and feature extraction preprocessing operations as step 2;
[0018] Step 9: Based on the results obtained in step 8 and the knowledge graph generated in step 4, generate a subgraph of the knowledge graph;
[0019] Step 10: Input the result obtained in step 8 and the subgraph of the knowledge graph generated in step 9 into the trained Chinese easily confused word generation model to obtain the Chinese easily confused word set corresponding to each Chinese word in the user input.
[0020] Furthermore, the entity types of the Chinese word knowledge ontology for generating Chinese easily confused words defined in step 1 include four categories:
[0021] (1) Entity types of Chinese text described at different granularities, including Chinese characters, words, named entities, common words, phrases, sentences, paragraphs, and article type entities. Attributes of characters, words, named entities, common words, and phrase types include part of speech, pronunciation, and semantics. Attributes of sentence entities include identifier, text, grammatical error identifier, error list, correction, and tense. Entities of paragraph and article types have identifier attributes.
[0022] (2) Entity types related to the semantics of Chinese text, including domains and topics;
[0023] (3) It can describe the corpus entities used for confusable word generation, which have attributes including source, name, type and description;
[0024] (4) Text type entities defined by abstracting characters, words, named entities, common words, phrases, sentences, paragraphs and article type entities, as well as object type entities defined by abstracting text, corpus, domain and topic type entities.
[0025] Furthermore, the types of relationships between entities include:
[0026] (1) Similarity relations that describe the similarity between entities, with properties including pronunciation similarity, glyph similarity, semantic similarity, and edit distance;
[0027] (2) describing the subclass relationships between entities of chapter, sentence, paragraph, article, phrase, character, word, named entity, and common word type;
[0028] (3) subclass relationships between entities that describe object, discourse, corpus, domain, and topic types;
[0029] (4) describe the abbreviation relationship between named entity abbreviations and full names;
[0030] (5) Describes the sequential relationship between words, sentences, and paragraphs in an article, and its attributes include sentence identifiers and punctuation;
[0031] (6) Describe the inclusion relationship between corpus entities, articles, paragraphs, sentences, and words;
[0032] (7) Describe the belonging relationship between corpus entities and domain entities;
[0033] (8) Describe the relationship between the paragraph entity and the subject entity.
[0034] Furthermore, the cleaning and feature extraction of Chinese text data in step 2 include: Unicode normalization of texts from multiple sources, removal of meaningless characters, replacement of text content that does not require error correction, segmentation, traditional-simplified conversion, named entity recognition, word segmentation, part-of-speech tagging, dependency relationship recognition, pinyin recognition, identification of the corresponding topics and fields of articles / paragraphs / sentences, stop word filtering, and identification of the correspondence between the full names and abbreviations of named entities; finally, the processed Chinese characters, words and corresponding features are summarized to generate a Chinese word set.
[0035] Furthermore, the step 3 performs the following operations on the simplified Chinese character / word pairs in the Chinese word set:
[0036] Calculate pronunciation similarity based on pinyin;
[0037] Calculate word form similarity based on radicals;
[0038] Calculate semantic similarity based on the meaning of each word in the dictionary;
[0039] The edit distance between two words is calculated based on the edit operations required for equivalent transformation.
[0040] Furthermore, the knowledge graph instantiation process in step 4 is implemented through the following sub-steps:
[0041] (1) The Chinese word set obtained after the preprocessing in step 2 is divided into different corpora according to the data source. For the Chinese articles, paragraphs in articles, sentences in paragraphs, phrases in sentences, named entities, common words and characters in each processed corpus, according to the knowledge ontology defined in step 1, the corresponding entity nodes and the subclass, inclusion, continuation and similarity relationships between entities are generated; according to the entity type and the processed data, the corresponding entity attributes and relationship attributes are generated;
[0042] (2) Generate subject entities and domain entities based on the subject corresponding to the paragraph obtained in step 2 and the domain corresponding to the corpus, and establish a "has" relationship between the paragraph entity and the subject entity, and a "belongs" relationship between the corpus entity and the domain entity.
[0043] Furthermore, the knowledge graph subgraph generation process in step 5 is implemented through the following sub-steps:
[0044] (5.1) Knowledge graph entity matching and screening: Match the Chinese word set obtained in step 2 with the entities in the knowledge graph, and filter out entities whose relevance is lower than a given threshold;
[0045] (5.2) Connected subgraph generation: Based on the filtered entity set, a minimum connected subgraph that can cover this entity set is searched in the knowledge graph, and it is combined with entities and edges that are located outside the minimum connected subgraph and directly connected to the minimum connected subgraph to form a knowledge graph subgraph corresponding to each data in the Chinese word set.
[0046] Furthermore, the process of generating the easily confused word set of Chinese words in step 6 is implemented by the following sub-steps:
[0047] (1) For any two words in the Chinese word set obtained in step 2, use the pronunciation similarity, word form similarity, semantic similarity and edit distance obtained in step 3 to calculate their weighted average value as the average similarity of the two words;
[0048] (2) For each word in the Chinese word set obtained in step 2, sort them by average similarity, and intercept the word set whose average similarity is greater than a preset threshold as the easily confused word set of the word.
[0049] Furthermore, the Chinese easily confused words generation model in step seven has the following characteristics:
[0050] The multi-input and multi-output Chinese easily confused word generation model based on deep learning is a deep learning model including a sequence encoder and a graph encoder, an information fusion module and a decoder, wherein the sequence encoder maps the Chinese word set obtained in step 2 to a latent state space A, and the graph encoder maps the subgraph of the knowledge graph to a latent state space B; the information fusion module performs splicing, spatial transformation, convolution and pooling operations on the latent state spaces A and B to obtain a fused information vector; the decoder obtains a set of easily confused words corresponding to each word in the input Chinese word sequence after subjecting the information vector output by the information fusion module to a fully connected neural network and softmax operation.
[0051] Furthermore, during the parameter training of the Chinese easily confused words generation model in step seven, in order to expand the training data, for each set of input and output, random sampling is performed on the easily confused words set in the output to generate a subset thereof, and the original input and the subset are added to the training data as new training samples.
[0052] The beneficial effects of the present invention are as follows:
[0053] 1. This invention defines a Chinese word knowledge ontology for Chinese text error correction. While representing Chinese text data from multiple sources, it can hierarchically describe the similarities in pronunciation, glyphs, and semantics between Chinese texts of different granularities, including articles, paragraphs, sentences, words, and characters, and has the ability to generalize to new data.
[0054] 2. In the process of generating easily confused Chinese words, the present invention not only utilizes the similarities between Chinese characters / words in pronunciation, glyphs, semantics, etc. in the knowledge graph, but also utilizes the corresponding themes, fields, and contextual information of Chinese characters / words, so that the model has the ability to be applied across fields.
[0055] 3. The Chinese easily confused word generation model of the present invention can effectively integrate multi-source heterogeneous data with different modalities such as sequence structure and graph structure. By effectively representing, integrating and processing the data of each modality, it can effectively predict the easily confused word list corresponding to each word in the user input text. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 It is the main flow chart of the method described in the present invention; Figure (a) is the offline generation process of the Chinese word knowledge graph; Figure (b) is the online generation process of Chinese easily confused words.
[0057] Figure 2 It is a design diagram of the Chinese word knowledge ontology in the method described in the present invention.
[0058] Figure 3 This is a flow chart of step five of the method of the present invention.
[0059] Figure 4 This is a flow chart of the easily confused word generation model in the method of the present invention. DETAILED DESCRIPTION
[0060] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. The terms used in the present invention are for the purpose of describing specific embodiments only and are not intended to limit the present invention. The singular forms "a," "the," and "the" used in the present invention and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0061] like Figure 1 As shown in FIG, the method for generating Chinese easily confused words based on knowledge graph proposed in the present invention is specifically described as follows:
[0062] Step 1: Define the Chinese word knowledge ontology for generating Chinese easily confused words, with the following features: Figure 2 The ontology contains entity types, relationships between entities, and entity / relationship attributes, which are described as follows:
[0063] Different types of entities have a hierarchical structure. The root entity type is an abstract type entity - object, and its sub-entity types include abstract type entities - chapter, corpus, domain and topic. Chapter entities are used to describe Chinese texts with different granularities, including articles, paragraphs, sentences, phrases, words, common words, named entities and character type entities. Corpus entities are used to describe a set of correct or incorrect Chinese texts, that is, a set of chapters. Domain entities are used to describe the fields involved in a certain Chinese text. Thematic entities are used to describe the topics discussed in a certain Chinese text. Chapters can be described from different granularities. They can be divided into articles, paragraphs, sentences, and basic symbols. According to the number of Chinese characters, basic symbols can be further subdivided into Chinese characters and words. According to whether they have specific meanings, words can be subdivided into common words and named entities. Named entities include full names and abbreviations.
[0064] The relationship between entities describes the association relationship between any two types of entity nodes. The ontology proposed in this invention mainly includes, but is not limited to, the following relationships: subclass, similarity, abbreviation, continuation, inclusion, has and belongs to relationships. Subclass relationship is used to describe the hierarchical relationship between entity types, such as the chapter entity is a subclass of the object entity; similarity relationship is used to describe the similarity between basic symbols; abbreviation relationship is used to describe that named entity A is the abbreviation of named entity B; continuation relationship is used to describe the sequence relationship between basic symbols in a sentence; inclusion relationship is used to describe that a corpus entity contains one or more article entities or inclusion relationships between chapter subclass entities of different granularity, such as text paragraph A contains text sentence 1, text sentence 2...; has relationship is used to describe the subject of the fact described in a paragraph; belongs to relationship is used to describe the field to which a certain article belongs, such as a military review article in a newspaper belongs to the military field.
[0065] Entity / relationship attributes are further descriptions of the characteristics of entities or relationships, and sub-class entities inherit the attributes of parent class entities. The present invention adds semantic, part-of-speech tagging and pronunciation attributes to phrases, words, common words, named entities and character type entities, adds identification, text, grammatical error identification, error list, correction and tense attributes to sentence entities, adds identification attributes to paragraph entities and article entities, and adds source, name, type and description attributes to corpus entities. In addition, additional feature descriptions are also required for relationships between entities, including but not limited to: adding semantic similarity attributes to similar relationships between basic symbol entities, adding pronunciation similarity and glyph similarity attributes to similar relationships between Chinese character entities, adding edit distance attributes to similar relationships between word entities, and adding sentence identification and punctuation attributes to continuation relationships between basic symbol entities.
[0066] Step 2: Clean and extract features from Chinese text data to obtain processed Chinese characters and words and their corresponding features, and generate a Chinese word set. For example, the existing text is as follows:
[0067] "There's a Thunder God Temple in Muping District, Yantai City. Built in 1634, it covers an area roughly the size of two or three basketball courts."
[0068] Because Chinese text has multiple encoding formats, it is necessary to convert it to a unified format when reading data, which is called Unicode normalization. Since numbers and years do not need to be corrected, these entities in the sentence need to be identified and replaced. The text after replacement is as follows:
[0069] "There is a Thunder God Temple in Muping District, Yantai City. Built in [NUM], the temple occupies an area approximately the size of [NUM] basketball courts."
[0070] Where "[NUM]" represents a number.
[0071] Divide the data in the article into natural paragraphs. In this example, the article has only one paragraph and there are only two sentences in the paragraph.
[0072] Use Python's OpenCC toolkit to convert Traditional Chinese to Simplified Chinese. The result after conversion is as follows:
[0073] "There is a Thunder God Temple in Muping District, Yantai City. Built in [NUM], the temple occupies an area about the size of a [NUM] basketball court."
[0074] The HanLP tool is used to identify named entities in the text. The recognition results include "Yantai City", "Muping District", and "Leishen Temple".
[0075] The HanLP tool is used to perform word segmentation and part-of-speech tagging on the text, and the result is "Yantai City (ns) / Muping District (ns) / There is (v) / a (q) / Thunder God Temple (ns) / . (w) / This (r) / a (q) / built (v) / in (p) / [NUM](m) / year (t) / of (u) / temple (n) / , (w) / occupies (v) / about (d) / there are (v) / [NUM](m) / (q) / basketball courts (n) / so (r) / big (a) / . (w)", where the part-of-speech tagging adopts the Peking University part-of-speech tagging standard, as shown in Table 1.
[0076] Table 1 Description of part-of-speech tagging
[0077]
[0078] The HanLP tool is used to identify the dependency relationship of the text. The recognition results are shown in Table 2. The Stanford dependency annotation is used. Some annotation descriptions are shown in Table 3.
[0079] Table 2. Sample text dependency analysis results
[0080]
[0081]
[0082] Table 3 Stanford dependency annotation (partial)
[0083]
[0084] The xpinyin package in Python is used to perform pinyin recognition on the Chinese characters in the text, and the result is "There is a temple of the god of thunder in Mouping District, Yantai City. This temple was built in [NUM] year, occupies an area of about [NUM] and has basketball courts. It is so big."
[0085] The gensim package in Python is used to identify the topic of the text, and the vector representation of the text is used to calculate the cosine similarity measurement with the pre-specified field vector to predict the field to which it belongs.
[0086] Use rules to identify abbreviation relationships between named entities in the text. In this example, there are no abbreviations.
[0087] Finally, the processed Chinese characters and words and their corresponding features are summarized to generate a Chinese word set.
[0088] Step 3: Based on the generated Chinese word set, calculate the similarity and edit distance between words in terms of pronunciation, word form and semantics. The specific process is as follows:
[0089] (1) Pronunciation similarity
[0090] From the perspective of linguistics and oral pronunciation rules, we compare the similarity of any two Chinese characters in terms of initials, finals, and tones, and calculate the pronunciation similarity using the following formula:
[0091]
[0092] in The similarity in pronunciation between the two. and It is a quantitative measurement vector of any two Chinese characters in terms of initials, finals and tones. x1 and y1, x2 and y2, x3 and y3 are the quantitative values of the two characters in terms of initials, finals and tones respectively. a1, a2 and a3 are non-negative parameters respectively.
[0093] (2) Glyph similarity
[0094] Compare the similarity of any two Chinese characters from the perspective of linguistics and simplified Chinese character radicals. Since radicals in Chinese characters have spatial positional characteristics, an undirected graph is used to describe this feature. Graph embedding is then used to compare two Chinese characters described by undirected graphs. The formula is as follows:
[0095]
[0096] in is the n-dimensional vector of the two-word graph embedding, a is a non-negative parameter, and ||·||2 is the L-2 norm.
[0097] (3) Semantic similarity
[0098] Unlike pronunciation and glyph similarity, which only apply to Chinese characters, semantic similarity also applies to Chinese words. It compares the similarity between any two Chinese characters / words from the perspectives of linguistics and dictionary definitions. The formula is as follows:
[0099]
[0100] in is an n-dimensional vector of the meaning of two characters / words, a is a non-negative parameter, and ||·||2 is the L-2 norm.
[0101] (4) Edit distance
[0102] Applicable to Chinese word-to-word similarity calculation, the formula is as follows:
[0103]
[0104] in is the Levenshtein distance. A sequence of strings representing two Chinese words.
[0105] Step 4: Complete the knowledge graph instantiation based on the knowledge ontology constructed in step 1, the Chinese word set obtained by data preprocessing in step 2, and the pronunciation, word form, semantic similarity and edit distance obtained in step 3.
[0106] (1) The Chinese word set obtained after the preprocessing in step 2 is divided into different corpora according to the data source. For the Chinese articles, paragraphs in articles, sentences in paragraphs, phrases in sentences, named entities, common words and characters in each processed corpus, according to the knowledge ontology defined in step 1, the corresponding entity nodes and the subclass, inclusion, continuation and similarity relationships between entities are generated; according to the entity type and the processed data, the corresponding entity attributes and relationship attributes are generated;
[0107] (2) Generate subject entities and domain entities based on the subject corresponding to the paragraph obtained in step 2 and the domain corresponding to the corpus, and establish a "has" relationship between the paragraph entity and the subject entity, and a "belongs" relationship between the corpus entity and the domain entity.
[0108] Step 5: Based on the Chinese word set obtained in step 2, use the knowledge graph obtained in step 4 to obtain the subgraph of the knowledge graph corresponding to each data in the Chinese word set. This step is divided into the knowledge graph entity matching and screening, connected subgraph generation, etc. Figure 3 shown.
[0109] First, perform knowledge graph entity matching and filtering. The Chinese word set obtained in step 2 is matched against entities in the knowledge graph, and entities with a relevance below a given threshold are filtered out. For example, for the example in step 2, the entities and entity relationships shown in Tables 4 and 5 below are obtained.
[0110] Table 4 Matched entities
[0111]
[0112]
[0113]
[0114]
[0115] Table 5 Matched relationship types
[0116]
[0117]
[0118] Secondly, a connected subgraph is generated. Based on the screened entity set, the shortest path algorithm is used to search for a path that can connect any two entity nodes in the complete knowledge graph, and all entity nodes and corresponding edges on the path are added to the subgraph, thereby obtaining a minimum connected subgraph that can cover this entity set, and the entities and edges that are outside the minimum connected subgraph and directly connected to the minimum connected subgraph constitute a knowledge graph subgraph corresponding to each piece of data in the Chinese vocabulary. For example, for the example in step 2, after obtaining the minimum connected subgraph composed of the entities in the table and the entity relationships in the table, the extended entities and relationships shown in Tables 6 and 7 are added thereto to jointly constitute a knowledge graph subgraph corresponding to each piece of data in the Chinese vocabulary.
[0119] Table 6 Extension Entity
[0120]
[0121] Table 7 Extension relationship
[0122]
[0123]
[0124] Step 6: Based on the pronunciation, word form, semantic similarity and edit distance obtained in step 3, obtain the easily confused word set for each Chinese word in the Chinese word set. The process is as follows:
[0125] (1) For any two words in the Chinese word set obtained in step 2, use the pronunciation similarity, word form similarity, semantic similarity and edit distance obtained in step 3 to calculate their weighted average value as the average similarity of the two words;
[0126] (2) For each word in the Chinese word set obtained in step 2, sort them by average similarity, and intercept the word set whose average similarity is greater than a preset threshold as the easily confused word set of the word;
[0127] Step 7: Construct a multi-input and multi-output Chinese easily confused word generation model based on deep learning. Use the Chinese word set obtained in step 2 and the subgraph of the knowledge graph corresponding to each data obtained in step 5 as input, and the easily confused word set of each Chinese word obtained in step 6 as the label to train the multi-input and multi-output Chinese easily confused word generation model based on deep learning, such as Figure 4 The model has the following characteristics:
[0128] (1) The model takes the Chinese word set in sequence form obtained in step 2 and the knowledge graph subset with graph structure obtained in step 5 as input, and takes the easily confused word set of each Chinese word obtained in step 6 as output label;
[0129] (2) The model is a deep learning model consisting of two encoders, an information fusion module, and a decoder;
[0130] (3) The two encoders in this model include a sequence encoder and a graph encoder, where the sequence encoder maps the Chinese word set obtained in step 2 to the hidden state space A, and the graph encoder maps the knowledge graph subset to the hidden state space B;
[0131] (4) The information fusion module in the model performs splicing, spatial transformation, convolution and pooling operations on the latent state spaces A and B to obtain the fused information vector;
[0132] (5) The decoder in this model passes the information vector output by the information fusion module through a fully connected neural network and softmax operation to obtain a set of easily confused words corresponding to each word in the input Chinese word sequence.
[0133] The parameter training process of the Chinese easily confused word generation model includes the following steps:
[0134] For each set of input data, including the Chinese word set in sequence form obtained in step 2 and the knowledge graph subset with graph structure obtained in step 5, the output of the model in step 7 is compared with the expected data obtained in step 6, the cross entropy is calculated, and the average cross entropy corresponding to all data in the input data set is calculated. The average cross entropy is minimized by updating the model parameters.
[0135] To expand the training data, for each set of input and output, random sampling is performed on the set of easily confused words in the output to generate a subset, and the original input and the subset are added to the training data as new training samples.
[0136] Step 8: Receive user input and perform the same cleaning and feature extraction preprocessing operations as step 2;
[0137] Step 9: Based on the results obtained in step 8 and the knowledge graph generated in step 4, generate a subgraph of the knowledge graph;
[0138] Step 10: Input the result obtained in step 8 and the subgraph of the knowledge graph generated in step 9 into the trained Chinese easily confused word generation model to obtain the Chinese easily confused word set corresponding to each Chinese word in the user input.
[0139] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for generating Chinese easily confused words based on knowledge graph, characterized in that: The following steps are involved: Step 1: Define a Chinese word knowledge ontology for generating easily confused Chinese words, including entity types and / or entity attributes, as well as relationship types and / or relationship attributes between entities; Step 2: Clean and extract features from Chinese text data to obtain processed Chinese characters and words and their corresponding features, and generate a Chinese word set; Step 3: Based on the generated Chinese word set, calculate the similarity and edit distance between words in pronunciation, word form, and semantics; Step 4: Complete the knowledge graph instantiation based on the knowledge ontology constructed in step 1, the Chinese word set obtained by data preprocessing in step 2, and the pronunciation, word form, and semantic similarity and edit distance obtained in step 3; Step 5: Based on the Chinese word set obtained in step 2, use the knowledge graph obtained in step 4 to obtain a subgraph of the knowledge graph corresponding to each data in the Chinese word set; Step 6: Based on the pronunciation, word form, semantic similarity and edit distance obtained in step 3, obtain a set of easily confused words for each Chinese word in the Chinese word set; Step 7: Construct a multi-input and multi-output Chinese easily confused word generation model based on deep learning, using the Chinese word set obtained in step 2 and the subgraph of the knowledge graph corresponding to each data obtained in step 5 as input, and the easily confused word set of each Chinese word obtained in step 6 as a label to train the Chinese easily confused word generation model; Step 8: Receive user input and perform the same cleaning and feature extraction preprocessing operations as step 2; Step 9: Based on the results obtained in step 8 and the knowledge graph generated in step 4, generate a subgraph of the knowledge graph; Step 10: Input the result obtained in step 8 and the subgraph of the knowledge graph generated in step 9 into the trained Chinese easily confused word generation model to obtain the Chinese easily confused word set corresponding to each Chinese word in the user input.
2. The method for generating Chinese easily confused words according to claim 1, wherein: The entity types of the Chinese word knowledge ontology for generating Chinese easily confused words defined in step 1 include four categories: (1) Entity types of Chinese text described at different granularities, including Chinese characters, words, named entities, common words, phrases, sentences, paragraphs, and article type entities. Attributes of characters, words, named entities, common words, and phrase types include part of speech, pronunciation, and semantics. Attributes of sentence entities include identifier, text, grammatical error identifier, error list, correction, and tense. Entities of paragraph and article types have identifier attributes. (2) Entity types related to the semantics of Chinese text, including domains and topics; (3) It can describe the corpus entities used for confusable word generation, which have attributes including source, name, type and description; (4) Text type entities defined by abstracting characters, words, named entities, common words, phrases, sentences, paragraphs and article type entities, as well as object type entities defined by abstracting text, corpus, domain and topic type entities.
3. The method for generating Chinese easily confused words according to claim 2, wherein: The types of relationships between entities include: (1) Similarity relations that describe the similarity between entities, with properties including pronunciation similarity, glyph similarity, semantic similarity, and edit distance; (2) describing the subclass relationships between entities of chapter, sentence, paragraph, article, phrase, character, word, named entity, and common word type; (3) subclass relationships between entities that describe object, discourse, corpus, domain, and topic types; (4) describe the abbreviation relationship between named entity abbreviations and full names; (5) Describes the sequential relationship between words, sentences, and paragraphs in an article, and its attributes include sentence identifiers and punctuation; (6) Describe the inclusion relationship between corpus entities, articles, paragraphs, sentences, and words; (7) Describe the belonging relationship between corpus entities and domain entities; (8) Describe the relationship between the paragraph entity and the subject entity.
4. The method for generating Chinese easily confused words according to claim 1, wherein: The cleaning and feature extraction of Chinese text data in step 2 include: Unicode normalization of texts from multiple sources, removal of meaningless characters, replacement of text content that does not require error correction, segmentation, traditional-simplified conversion, named entity recognition, word segmentation, part-of-speech tagging, dependency relationship recognition, pinyin recognition, identification of the corresponding topics and fields of articles / paragraphs / sentences, stop word filtering, and identification of the correspondence between the full names and abbreviations of named entities; finally, the processed Chinese characters, words and corresponding features are summarized to generate a Chinese word set.
5. The method for generating Chinese easily confused words according to claim 1, wherein: In step 3, the following operations are performed on the simplified Chinese character / word pairs in the Chinese word set: Calculate pronunciation similarity based on pinyin; Calculate word form similarity based on radicals; Calculate semantic similarity based on the meaning of each word in the dictionary; The edit distance between two words is calculated based on the edit operations required for equivalent transformation.
6. The method for generating Chinese easily confused words according to claim 3, wherein: The knowledge graph instantiation process in step 4 is implemented through the following sub-steps: (1) The Chinese word set obtained after the preprocessing in step 2 is divided into different corpora according to the data source. For the Chinese articles, paragraphs in articles, sentences in paragraphs, phrases in sentences, named entities, common words and characters in each processed corpus, according to the knowledge ontology defined in step 1, the corresponding entity nodes and the subclass, inclusion, continuation and similarity relationships between entities are generated; according to the entity type and the processed data, the corresponding entity attributes and relationship attributes are generated; (2) Generate subject entities and domain entities based on the subject corresponding to the paragraph obtained in step 2 and the domain corresponding to the corpus, and establish a "has" relationship between the paragraph entity and the subject entity, and a "belongs" relationship between the corpus entity and the domain entity.
7. The method for generating Chinese easily confused words according to claim 1, wherein: The knowledge graph subgraph generation process in step 5 is implemented through the following sub-steps: (5.1) Knowledge graph entity matching and screening: Match the Chinese word set obtained in step 2 with the entities in the knowledge graph, and filter out entities whose relevance is lower than a given threshold; (5.2) Connected subgraph generation: Based on the filtered entity set, a minimum connected subgraph that can cover this entity set is searched in the knowledge graph, and it is combined with entities and edges that are located outside the minimum connected subgraph and directly connected to the minimum connected subgraph to form a knowledge graph subgraph corresponding to each data in the Chinese word set.
8. The method for generating Chinese easily confused words according to claim 1, wherein: The process of generating the easily confused word set of Chinese words in step 6 is implemented by the following sub-steps: (1) For any two words in the Chinese word set obtained in step 2, use the pronunciation similarity, word form similarity, semantic similarity and edit distance obtained in step 3 to calculate their weighted average value as the average similarity of the two words; (2) For each word in the Chinese word set obtained in step 2, sort them by average similarity, and intercept the word set whose average similarity is greater than a preset threshold as the easily confused word set of the word.
9. The method for generating Chinese easily confused words according to claim 1, wherein: The Chinese easily confused word generation model in step 7 has the following characteristics: The multi-input and multi-output Chinese easily confused word generation model based on deep learning is a deep learning model including a sequence encoder and a graph encoder, an information fusion module and a decoder, wherein the sequence encoder maps the Chinese word set obtained in step 2 to a latent state space A, and the graph encoder maps the subgraph of the knowledge graph to a latent state space B; the information fusion module performs splicing, spatial transformation, convolution and pooling operations on the latent state spaces A and B to obtain a fused information vector; the decoder obtains a set of easily confused words corresponding to each word in the input Chinese word sequence after subjecting the information vector output by the information fusion module to a fully connected neural network and softmax operation.
10. The method for generating Chinese easily confused words according to claim 1, wherein: During the parameter training of the Chinese easily confused words generation model in step seven, in order to expand the training data, for each set of input and output, random sampling is performed on the easily confused words set in the output to generate a subset thereof, and the original input and the subset are added to the training data as new training samples.
Citation Information
Patent Citations
Multi-granularity text error correction data set generation method, device and apparatus
CN114048321A
Negative sample generation method and device based on word forms and semantics in Chinese field
CN115310523A