Method, system, device and medium for name and position correction based on knowledge graph
By using a knowledge graph-based multi-modal matching algorithm and entity extraction model, the problem of low efficiency and accuracy in correcting personal names and job titles in existing text correction methods has been solved. This achieves efficient and accurate correction of homophones, similar-looking characters, extra characters, and missing characters, ensuring the timeliness of information.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUIZHOU CLOUD PIONEER TECH CO LTD
- Filing Date
- 2022-12-16
- Publication Date
- 2026-04-21
AI Technical Summary
Existing text correction methods are inefficient and inaccurate in correcting personal names and job titles in texts, especially when dealing with homophones, similar-looking characters, extra characters, or missing characters.
A knowledge graph-based method for correcting personal names and job titles is adopted. By combining a multi-modal matching algorithm with a knowledge graph, personal names, job titles and their relationships are constructed. Entity extraction models are used to extract entities from text samples. A mapping relationship between pinyin, similar-looking words and feature sequences is established to perform correction of homophones, similar-looking words, multiple characters and missing characters.
It improves the efficiency and accuracy of error correction for personal names and job titles, ensuring the timeliness and accuracy of information, and efficiently locates and corrects erroneous information without the need for complex rule judgments.
Smart Images

Figure CN116702757B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of text error correction technology, specifically to a method, system, device, and medium for correcting errors in names and job titles based on knowledge graphs. Background Technology
[0002] With the rapid development of the internet, a large number of news reports have been generated online, especially those involving personal information. While professional news media have strict review processes for press releases, spelling errors often occur in practice. When names in text contain errors, it affects or even alters the semantic meaning of the text, making it impossible to identify names using traditional named entity recognition methods. Furthermore, the unique nature of personal names makes them prone to duplication or ambiguity, increasing the false positive rate and significantly complicating name correction.
[0003] Therefore, text correction algorithms based on machine learning have been widely studied in recent years, and those based on artificial intelligence and big data processing technologies are considered effective. However, personal information, such as names and job titles, is time-sensitive and needs to be constantly updated to ensure accuracy and timeliness. Furthermore, existing text correction methods for personal information mainly rely on the individual's name for correction, without analyzing their geographical location or job title, resulting in low accuracy, especially for errors involving extra or missing characters. Summary of the Invention
[0004] The technical problem this invention aims to solve is that existing text correction methods have low efficiency and accuracy in correcting names and job titles in text. To address this problem, this invention provides a method, system, device, and medium for correcting names and job titles based on a knowledge graph.
[0005] The technical solution of the present invention to solve the above-mentioned technical problems is as follows:
[0006] A knowledge graph-based method for correcting errors in names and job titles includes:
[0007] Step S1: Obtain the text to be corrected, which includes the person's name and job title;
[0008] Step S2: Based on the pre-constructed knowledge graph, the text to be corrected is corrected using a multi-modal matching algorithm to obtain the target text; the knowledge graph is used to represent the relationships between various entities, the entities include names and job titles, and the error text correction includes at least one of homophone correction, similar-looking word correction, multiple character correction, and missing character correction.
[0009] This invention includes four error correction methods for the text to be corrected: homophone correction, similar-looking word correction, multiple-character correction, and missing-character correction. This invention does not limit the execution order of the four error correction methods. When any one of the error correction methods determines that the text to be corrected needs to be adjusted, the error correction of the text to be corrected ends.
[0010] The beneficial effects of this invention are: by combining knowledge graphs and multi-modal matching algorithms, it corrects errors in the names and job titles in the text to be corrected, thereby improving the efficiency and accuracy of correcting the names and job titles in the text.
[0011] Furthermore, the knowledge graph is constructed in the following way:
[0012] Obtain multiple text samples;
[0013] For each text sample, a pre-built entity extraction model is used to extract sample words from the text sample, including personal names, job titles, and place names;
[0014] For each sample word, the person name, job title, and place name contained in the sample word are treated as entities. Based on the relationship between the person name and the job title, and the relationship between the person name and the place name, a knowledge graph corresponding to the sample word is established.
[0015] The beneficial effects of adopting the above-mentioned further solutions are: by constructing a knowledge graph, a foundation is laid for subsequent error correction of the text to be corrected; based on the knowledge graph, the association between names and their job titles is constructed, eliminating the need to construct corresponding error correction dictionaries for different error types, which facilitates efficient management of names and related information.
[0016] Furthermore, the method also includes:
[0017] The website content in the target website template is obtained at preset time intervals, and the website content is parsed to obtain the appointment and dismissal text, which includes personal names, job titles and place names;
[0018] The appointment and removal terms in the appointment and removal text are extracted using a pre-built entity extraction model. The appointment and removal terms include personal names, job titles, and place names.
[0019] If the knowledge graph does not contain the term "appointment / removal", the knowledge graph is updated based on the term "appointment / removal". The knowledge graph is updated by adding or modifying.
[0020] The beneficial effect of adopting the above-mentioned further solution is that by continuously updating the knowledge graph, the accuracy and timeliness of personal names, job titles, and place names are guaranteed.
[0021] Furthermore, the multi-modal matching algorithm includes a first correct word dictionary, which is a mapping relationship between pinyin and a first feature sequence established based on the knowledge graph. The first feature sequence includes at least two of the following: personal name, job title, and place name.
[0022] If homophone correction is performed on the text to be corrected, the step of correcting the text using a multi-modal matching algorithm based on a pre-constructed knowledge graph includes:
[0023] The first set of words to be corrected in the text to be corrected is extracted using a pre-built entity extraction model. The first set of words to be corrected includes multiple first words to be corrected, and each first word to be corrected corresponds to a person's name, job title, or place name.
[0024] For each of the first words to be corrected, the first words to be corrected are converted into a pinyin sequence. The pinyin sequence is scanned by the multi-modal matching algorithm. The first feature sequence containing the pinyin sequence is queried by the multi-modal matching algorithm to obtain the first candidate sequence corresponding to the first word to be corrected. The first candidate sequence has the same or similar pinyin as the first word to be corrected.
[0025] Based on the first candidate sequence corresponding to each of the first words to be corrected contained in the first set of words to be corrected, a first target dictionary corresponding to the first set of words to be corrected is determined, and the first target dictionary is a first correct word dictionary;
[0026] For each of the first words to be corrected, if the first word to be corrected is exactly the same as any of the first feature sequences in the first target dictionary, it is determined that the first word to be corrected does not have homophone errors; if the first word to be corrected is not exactly the same as any of the first feature sequences in the first target dictionary, the text to be corrected is reconstructed according to the first target dictionary.
[0027] The beneficial effects of adopting the above-mentioned further scheme are: by establishing a mapping relationship between pinyin and the first feature sequence based on the knowledge graph, homophone correction can be performed based on pinyin without the need for complex rule judgment, and error information can be located and modified efficiently.
[0028] Furthermore, the multi-modal matching algorithm includes a second correct word dictionary, which is a mapping relationship between similar-looking words established based on the knowledge graph and a second feature sequence. The second feature sequence includes at least two of the following: personal name, job title, and place name.
[0029] If the text to be corrected is subjected to word correction based on similar-looking characters, the step of correcting the text based on a pre-constructed knowledge graph and using a multi-modal matching algorithm includes:
[0030] The second set of words to be corrected is extracted from the text to be corrected using a pre-built entity extraction model. The second set of words to be corrected includes multiple words to be corrected, and each word to be corrected corresponds to a person's name, job title, or place name.
[0031] For each of the second words to be corrected, the second words to be corrected are scanned by the multi-modal matching algorithm, and the second feature sequence containing the second words to be corrected is queried by the multi-modal matching algorithm to obtain the second candidate sequence corresponding to the second words to be corrected. The second candidate sequence and the second words to be corrected are similar in shape.
[0032] Based on the second candidate sequence corresponding to each of the second words to be corrected contained in the second set of words to be corrected, a second target dictionary corresponding to the second set of words to be corrected is determined, and the second target dictionary is a second correct word dictionary;
[0033] For each of the second words to be corrected, if the second word to be corrected is exactly the same as any second feature sequence in the second target dictionary, it is determined that the second word to be corrected does not have any similar word errors; if the second word to be corrected is not exactly the same as any second feature sequence in the second target dictionary, the text to be corrected is reconstructed according to the second target dictionary.
[0034] The beneficial effects of adopting the above-mentioned further scheme are: by establishing a mapping relationship between similar words and the second feature sequence based on the knowledge graph, and correcting similar words based on the second word to be corrected and the second candidate sequence, there is no need to perform complex rule judgments, and the error information can be located and modified efficiently.
[0035] Furthermore, the multi-mode matching algorithm includes a third correct word dictionary, which is a mapping relationship between substrings and third feature sequences established based on the knowledge graph. The third feature sequence includes at least two of the following: personal name, job title, and place name.
[0036] If multi-character error correction is performed on the text to be corrected, the step of correcting the text errors by using a multi-modal matching algorithm based on a pre-constructed knowledge graph includes:
[0037] The third set of words to be corrected in the text to be corrected is extracted using a pre-built entity extraction model. The third set of words to be corrected includes multiple third words, each of which corresponds to a person's name, job title, or place name.
[0038] For each of the third words to be corrected, the third words to be corrected are scanned by the multi-modal matching algorithm, and the third feature sequence containing the third words to be corrected is queried in the third correct word dictionary by the multi-modal matching algorithm, so as to obtain the third candidate sequence corresponding to the third words to be corrected. The third candidate sequence includes multiple candidate substrings, and each candidate substring is a substring of the third words to be corrected.
[0039] Based on the target parameters corresponding to each of the third words to be corrected in the third set of words to be corrected, a third target dictionary corresponding to the third set of words to be corrected is determined, wherein the third target dictionary is a third correct word dictionary; wherein, the target parameters are the position of each candidate substring corresponding to the third word to be corrected in the third candidate sequence and the character length of the third candidate sequence;
[0040] For each of the third words to be corrected, if the third word to be corrected is exactly the same as any third feature sequence in the third target dictionary, it is determined that the third word to be corrected does not have a multi-character error; if the third word to be corrected is not exactly the same as any third feature sequence in the third target dictionary, the text to be corrected is reconstructed according to the third target dictionary.
[0041] The beneficial effects of adopting the above-mentioned further scheme are: by establishing a mapping relationship between substrings and third feature sequences based on the knowledge graph, multi-word error correction can be performed based on the substrings and third candidate sequences without the need for complex rule judgments, and error information can be located and modified efficiently.
[0042] Furthermore, if the third word to be corrected is not completely identical to any third feature sequence in the third target dictionary, the process of reconstructing the text to be corrected based on the third target dictionary includes:
[0043] Based on the third target dictionary, the error area and target number of characters of the third word to be corrected are determined, wherein the target number of characters is determined based on the character length of the third target dictionary and a preset expansion threshold;
[0044] Based on the error area and the target number of characters, determine the text to be checked in the text to be corrected;
[0045] A sliding window with a size equal to the character length of the text to be inspected is selected and slid across the text to be inspected. The edit distance between each sequence in the text to be inspected and the third target dictionary is calculated. The sequence is a string in the text to be inspected.
[0046] Based on the edit distance of each string and a preset distance threshold, the words to be corrected in the text to be corrected are determined;
[0047] The word to be corrected in the text to be corrected is replaced with a third candidate sequence of substrings containing the third word to be corrected in the third target dictionary.
[0048] The beneficial effect of adopting the above-mentioned further solution is that: determining the text to be corrected based on the error area and the target number of characters, and performing sliding processing on the text to be checked can improve the accuracy of correcting the third word to be corrected.
[0049] To address the technical problems existing in the prior art, the present invention also provides a knowledge graph-based error correction system for names and job titles, comprising:
[0050] The text acquisition module is used to acquire the text to be corrected, which includes the person's name and job title.
[0051] The text correction module is used to correct errors in the text to be corrected by using a multi-modal matching algorithm based on a pre-constructed knowledge graph to obtain the target text. The knowledge graph is used to represent the relationships between various entities, and the entities include personal names and job titles. The error text correction includes at least one of the following: homophone correction, similar-looking word correction, multiple character correction, and missing character correction.
[0052] To address the technical problems existing in the prior art, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the aforementioned knowledge graph-based method for correcting names and job titles.
[0053] To address the technical problems existing in the prior art, the present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the aforementioned knowledge graph-based method for correcting names and job titles. Attached Figure Description
[0054] Figure 1 This is a flowchart illustrating the knowledge graph-based method for correcting names and job titles in this invention.
[0055] Figure 2 This is a schematic diagram of the knowledge graph-based error correction system for names and job titles in this invention. Detailed Implementation
[0056] The principles and features of the present invention are described below. The examples given are only for explaining the present invention and are not intended to limit the scope of the present invention.
[0057] Example 1
[0058] like Figure 1 As shown, this embodiment provides a method for correcting errors in names and job titles based on knowledge graphs, including:
[0059] Step S1: Obtain the text to be corrected, which includes the person's name and job title;
[0060] Step S2: Based on the pre-constructed knowledge graph, the text to be corrected is corrected using a multi-modal matching algorithm to obtain the target text; the knowledge graph is used to represent the relationships between various entities, the entities include names and job titles, and the error text correction includes at least one of homophone correction, similar-looking word correction, multiple character correction, and missing character correction.
[0061] The knowledge graph is constructed in the following way:
[0062] Obtain multiple text samples;
[0063] For each text sample, a pre-built entity extraction model is used to extract sample words from the text sample, including personal names, job titles, and place names;
[0064] For each sample word, the person name, job title, and place name contained in the sample word are treated as entities. Based on the relationship between the person name and the job title, and the relationship between the person name and the place name, a knowledge graph corresponding to the sample word is established.
[0065] Optionally, the sample words may also include the length of service;
[0066] For each sample word, the person's name, job title, place name, and tenure time contained in the sample word are treated as entities. Based on the relationship between the person's name and the job title, the relationship between the person's name and the place name, and the relationship between the person's name and the tenure time, a knowledge graph corresponding to the sample word is established.
[0067] In this embodiment, the constructed knowledge graph is stored based on a graph database; the multi-modal matching algorithm uses the AC automaton, which can efficiently search for target words based on the mapping relationship between the target words (specifically the first, second, and third words to be corrected mentioned below) and the correct words in the text to be corrected, targeting the possible error types in the text to be corrected (specifically, the first, second, and third words to be corrected mentioned below); the entity extraction model is constructed using BERT-CRF, and the entity extraction model is trained using multiple text samples, and the model hyperparameters are tuned by adjusting the learning rate and other methods.
[0068] The multi-mode matching algorithm includes a first correct word dictionary, which is a mapping relationship between pinyin and a first feature sequence established based on the knowledge graph. The first feature sequence includes at least two of the following: personal name, job title, and place name.
[0069] If homophone correction is performed on the text to be corrected, the step of correcting the text using a multi-modal matching algorithm based on a pre-constructed knowledge graph includes:
[0070] The first set of words to be corrected in the text to be corrected is extracted using a pre-built entity extraction model. The first set of words to be corrected includes multiple first words to be corrected, and each first word to be corrected corresponds to a person's name, job title, or place name.
[0071] For each of the first words to be corrected, the first words to be corrected are converted into a pinyin sequence. The pinyin sequence is scanned by the multi-modal matching algorithm. The first feature sequence containing the pinyin sequence is queried by the multi-modal matching algorithm to obtain the first candidate sequence corresponding to the first word to be corrected. The first candidate sequence has the same or similar pinyin as the first word to be corrected.
[0072] Based on the first candidate sequence corresponding to each of the first words to be corrected contained in the first set of words to be corrected, a first target dictionary corresponding to the first set of words to be corrected is determined, and the first target dictionary is a first correct word dictionary;
[0073] For each of the first words to be corrected, if the first word to be corrected is exactly the same as any of the first feature sequences in the first target dictionary, it is determined that the first word to be corrected does not have homophone errors; if the first word to be corrected is not exactly the same as any of the first feature sequences in the first target dictionary, the text to be corrected is reconstructed according to the first target dictionary.
[0074] In this embodiment, an AC automaton is used to construct a search pattern. The names, job titles, and place names contained in the knowledge graph are used as the first feature sequence. A mapping relationship is established between the first feature sequence and its corresponding pinyin, resulting in a first correct word dictionary. When correcting homophones, names, job titles, and place names (and possibly appointment / removal dates) are used as filtering conditions to correct homophones in the text to be corrected.
[0075] Example 1:
[0076] The correct words (i.e., the first feature sequence) are: Library Director, Zhang San, and the latest update time of the knowledge graph is October 12, 2022;
[0077] Convert the correct words into pinyin, which are: tu shu guan zhuren, zhang san;
[0078] Construct the mapping relationship between pinyin and correct words through the Aho-Corasick automaton, specifically: (tu shu guan zhuren, library director), (zhang san, Zhang San);
[0079] The text to be corrected contains the first set of words to be corrected: library director Zhang San;
[0080] Convert the first set of words to be corrected into a pinyin sequence: tu shu guan zhu ren zhang san; <For each of the second words to be corrected for errors, scan the second word to be corrected for errors through the multi-mode matching algorithm, query the second feature sequence containing the second word to be corrected for errors in the second correct word dictionary through the multi-mode matching algorithm, and obtain the second candidate sequence corresponding to the second word to be corrected for errors. The glyphs of the second candidate sequence and the second word to be corrected for errors are similar;
[0087] According to the second candidate sequences respectively corresponding to each of the second words to be corrected for errors included in the second set of words to be corrected for errors, determine the second target dictionary corresponding to the second set of words to be corrected for errors. The second target dictionary is the second correct word dictionary;
[0088] For each of the second words to be corrected for errors, if the second word to be corrected for errors is exactly the same as any second feature sequence in the second target dictionary, determine that there is no error in the form of similar characters for the second word to be corrected for errors; if the second word to be corrected for errors is not exactly the same as any second feature sequence in the second target dictionary, reconstruct the text to be corrected for errors according to the second target dictionary.
[0089] In this embodiment, use the AC automaton to construct a search pattern, use each person's name, position name, and geographical name included in the knowledge graph as the second feature sequence, establish a mapping relationship between the second feature sequence and the similar characters corresponding to the second feature sequence, and obtain the second correct word dictionary. Among them, the similar characters corresponding to the second feature sequence are determined through a similar character dictionary constructed manually or by other means. When correcting errors in the form of similar characters, use the person's name, position name, and geographical name (which may also include the appointment and removal time) as screening conditions to correct the errors in the form of similar characters in the text to be corrected for errors.
[0090] Example 2:
[0091] The correct words (i.e., the second feature sequences) are: Director of the Library, Zhang San, and the latest update time of the knowledge graph is October 12, 2022;
[0092] In the similar character dictionary, the similar characters of "书" are: 韦, 牛;
[0093] According to the similar character dictionary, perform similar character replacement to obtain similar words: 图韦馆主任, 图牛馆主任;
[0094] Use the AC automaton to establish a mapping relationship between the similar words and the correct words, specifically: (图韦馆主任, 图书馆主任), (图牛馆主任, 图书馆主任);
[0095] The text to be corrected for errors contains a second set of words to be corrected for errors: 图韦馆主任张三;
[0096] The AC automaton scans the second set of words to be corrected to obtain possible erroneous words. Among them, based on "director of the library", the candidate word (i.e. the second candidate sequence) "director of the library" can be obtained.
[0097] Based on job titles and personal names, entity and relation queries are performed in the knowledge graph. The second correct word dictionary containing "library director" and "Zhang San" is identified as the second target dictionary. Since "library director" in the second set of words to be corrected is not exactly the same as the corresponding correct word "library director" in the second target dictionary, "library director" in the text to be corrected is modified to "library director" to achieve the reconstruction of the text to be corrected.
[0098] The multi-mode matching algorithm includes a third correct word dictionary, which is a mapping relationship between substrings and third feature sequences established based on the knowledge graph. The third feature sequence includes at least two of the following: personal name, job title, and place name.
[0099] If multi-character error correction is performed on the text to be corrected, the step of correcting the text errors by using a multi-modal matching algorithm based on a pre-constructed knowledge graph includes:
[0100] The third set of words to be corrected in the text to be corrected is extracted using a pre-built entity extraction model. The third set of words to be corrected includes multiple third words, each of which corresponds to a person's name, job title, or place name.
[0101] For each of the third words to be corrected, the third words to be corrected are scanned by the multi-modal matching algorithm, and the third feature sequence containing the third words to be corrected is queried in the third correct word dictionary by the multi-modal matching algorithm, so as to obtain the third candidate sequence corresponding to the third words to be corrected. The third candidate sequence includes multiple candidate substrings, and each candidate substring is a substring of the third words to be corrected.
[0102] Based on the target parameters corresponding to each of the third words to be corrected in the third set of words to be corrected, a third target dictionary corresponding to the third set of words to be corrected is determined, wherein the third target dictionary is a third correct word dictionary; wherein, the target parameters are the position of each candidate substring corresponding to the third word to be corrected in the third candidate sequence and the character length of the third candidate sequence;
[0103] For each of the third words to be corrected, if the third word to be corrected is exactly the same as any third feature sequence in the third target dictionary, it is determined that the third word to be corrected does not have a multi-character error; if the third word to be corrected is not exactly the same as any third feature sequence in the third target dictionary, the text to be corrected is reconstructed according to the third target dictionary.
[0104] If the third word to be corrected is not completely identical to any third feature sequence in the third target dictionary, the text to be corrected is reconstructed based on the third target dictionary, including:
[0105] Based on the third target dictionary, the error area and target number of characters of the third word to be corrected are determined, wherein the target number of characters is determined based on the character length of the third target dictionary and a preset expansion threshold;
[0106] Based on the error area and the target number of characters, determine the text to be checked in the text to be corrected;
[0107] A sliding window with a size equal to the character length of the text to be inspected is selected and slid across the text to be inspected. The edit distance between each sequence in the text to be inspected and the third target dictionary is calculated. The sequence is a string in the text to be inspected.
[0108] Based on the edit distance of each string and a preset distance threshold, the words to be corrected in the text to be corrected are determined;
[0109] The word to be corrected in the text to be corrected is replaced with a third candidate sequence of substrings containing the third word to be corrected in the third target dictionary.
[0110] The multi-mode matching algorithm includes a fourth correct word dictionary, which is a mapping relationship between substrings and fourth feature sequences established based on the knowledge graph. The fourth feature sequence includes at least two of the following: personal name, job title, and place name.
[0111] If the text to be corrected is missing character correction, the step of correcting the text using a multi-modal matching algorithm based on a pre-constructed knowledge graph includes:
[0112] The fourth set of words to be corrected in the text to be corrected is extracted using a pre-built entity extraction model. The fourth set of words to be corrected includes multiple fourth words, each of which corresponds to a person's name, job title, or place name.
[0113] For each of the fourth words to be corrected, the fourth words to be corrected are scanned by the multi-modal matching algorithm, and the fourth feature sequence containing the fourth words to be corrected is queried in the fourth correct word dictionary by the multi-modal matching algorithm, so as to obtain the fourth candidate sequence corresponding to the fourth words to be corrected. The fourth candidate sequence includes multiple candidate substrings, and each candidate substring is a substring of the fourth words to be corrected.
[0114] Determine the fourth target dictionary corresponding to the set of fourth words to be corrected according to the target parameters corresponding to each of the fourth words to be corrected included in the set of fourth words to be corrected. The fourth target dictionary is the fourth correct word dictionary. Wherein, the target parameter is the position of each candidate substring corresponding to the fourth word to be corrected in the fourth candidate sequence and the character length of the fourth candidate sequence.
[0115] For each of the fourth words to be corrected, if the fourth word to be corrected is exactly the same as any fourth feature sequence in the fourth target dictionary, it is determined that the fourth word to be corrected has no character missing error. If the fourth word to be corrected is not exactly the same as any fourth feature sequence in the fourth target dictionary, reconstruct the text to be corrected according to the fourth target dictionary.
[0116] When the fourth word to be corrected is not exactly the same as any fourth feature sequence in the fourth target dictionary, reconstructing the text to be corrected according to the fourth target dictionary includes:
[0117] According to the fourth target dictionary, determine the error area and the target number of characters of the fourth word to be corrected. The target number of characters is determined according to the character length of the fourth target dictionary and a preset expansion threshold. In this embodiment, the expansion threshold is set to 2.
[0118] Determine the text to be checked in the text to be corrected according to the error area and the target number of characters.
[0119] Select a sliding window with a window size equal to the character length of the text to be checked to perform a sliding process on the text to be checked, and calculate the edit distance between each sequence in the text to be checked and the fourth target dictionary. The sequence is a character string in the text to be checked. In this embodiment, the sliding step size is set to 1.
[0120] Determine the word to be corrected in the text to be corrected according to the edit distance corresponding to each character string and a preset distance threshold.
[0121] Replace the word to be corrected in the text to be corrected with the fourth candidate sequence of the substring in the fourth target dictionary that contains the fourth word to be corrected.
[0122] Example three:
[0123] The correct word (i.e., the fourth feature sequence) is: library director. The latest update time of the knowledge graph is October 12, 2022.
[0124] Construct the N-GRAM substrings of the correct word, specifically: book, library, librarian, director.
[0125] Construct the mapping relationship between substrings and correct words through the AC automaton, specifically: (book, library director), (library, library director), (curator, library director), (director, library director);
[0126] The text to be corrected contains the fourth set of words to be corrected: Zhang San, the library director in Adan Region; among them, "Adan Region" is a geographical name;
[0127] The AC automaton scans the fourth set of words to be corrected to obtain possible incorrect words. Among them, based on "curator" and "director", the candidate word (i.e., the fourth candidate sequence) "library director" can be obtained;
[0128] According to the substring and the position of the substring in the correct word, find the error area. Among them, the string of the error area found according to "curator" is "Region Library Director Zhang";
[0129] The character length of the correct word is 5. Therefore, the sliding window interval is set to [3, 7], the window step size is set to 1, and it slides step by step. Calculate the edit distance between the string in the window and the correct word. When the edit distance is set to 1, the incorrect words that meet the conditions are "District Library Director" and "Library Director"; according to the word segmentation result of the context of the text to be corrected, "Adan Region" is a correct word. Therefore, filter out the incorrect candidate "District Library Director", that is, determine that "Library Director" needs to be adjusted;
[0130] Query entities and relationships in the knowledge graph according to the job title, person name, and geographical name. Determine the fourth correct word dictionary containing "library director" and "Zhang San" as the fourth target dictionary. Since the "Library Director" in the fourth set of words to be corrected is not exactly the same as the corresponding correct word "library director" in the fourth target dictionary, therefore, modify the "Library Director" in the text to be corrected to "library director" to achieve the reconstruction of the text to be corrected.
[0131] Embodiment 2
[0132] Based on the above Embodiment 1, the method further includes:
[0133] Obtain the website content in the target website template at a preset time interval, parse the website content to obtain the appointment and removal text, and the appointment and removal text includes person names, job titles, and geographical names;
[0134] Use the entity extraction model to extract the appointment and removal words in the appointment and removal text, and the appointment and removal words include person names, job titles, and geographical names;
[0135] If the knowledge graph does not contain the appointment and removal words, update the knowledge graph according to the appointment and removal words. The ways of updating the knowledge graph include adding and modifying.
[0136] In this embodiment, the time interval is set to 1 day. Website content from target website templates (such as news websites and appointment / removal websites) is crawled using a data crawler. The website content is then cleaned (i.e., parsed) to obtain structured information and extract the main text. This information is compared with the content in the historical crawler database, filtering out pages with unchanged content. For updated pages, appointment / removal terms (specifically, names of persons, positions, and place names) are used as search criteria in the knowledge graph. If the term is not found in the knowledge graph, it is automatically compared with authoritative encyclopedia-level websites and then manually reviewed to confirm the update information, thereby updating the knowledge graph.
[0137] This invention establishes a closed-loop process of data crawling, data extraction, data comparison, and manual review, forming a semi-automatic update process for personal information. This ensures the real-time nature of information and reduces manual maintenance costs and information update efficiency.
[0138] Example 3
[0139] Based on the same principle as the knowledge graph-based name and job title error correction method described in Embodiment 1, this embodiment provides a knowledge graph-based name and job title error correction system, such as... Figure 2 As shown, the system includes:
[0140] The text acquisition module is used to acquire the text to be corrected, which includes the person's name and job title.
[0141] The text correction module is used to correct errors in the text to be corrected by using a multi-modal matching algorithm based on a pre-constructed knowledge graph to obtain the target text. The knowledge graph is used to represent the relationships between various entities, and the entities include personal names and job titles. The error text correction includes at least one of the following: homophone correction, similar-looking word correction, multiple character correction, and missing character correction.
[0142] The system further includes a knowledge graph construction module for constructing the knowledge graph, the knowledge graph construction module comprising:
[0143] The first subunit is used to acquire multiple text samples;
[0144] The second subunit is used to extract sample words from each text sample using a pre-built entity extraction model. The sample words include personal names, job titles, and place names.
[0145] The third subunit is used to, for each sample word, treat the person name, job name, and place name contained in the sample word as entities, and establish a knowledge graph corresponding to the sample word based on the relationship between the person name and the job name, and the relationship between the person name and the place name.
[0146] The multi-mode matching algorithm includes a first correct word dictionary, which is a mapping relationship between pinyin and a first feature sequence established based on the knowledge graph. The first feature sequence includes at least two of the following: personal name, job title, and place name.
[0147] If homophone correction is performed on the text to be corrected, the text correction module is used to correct errors in the text to be corrected based on a pre-constructed knowledge graph and through a multi-modal matching algorithm. Specifically, it is used for:
[0148] The first set of words to be corrected in the text to be corrected is extracted using a pre-built entity extraction model. The first set of words to be corrected includes multiple first words to be corrected, and each first word to be corrected corresponds to a person's name, job title, or place name.
[0149] For each of the first words to be corrected, the first words to be corrected are converted into a pinyin sequence. The pinyin sequence is scanned by the multi-modal matching algorithm. The first feature sequence containing the pinyin sequence is queried by the multi-modal matching algorithm to obtain the first candidate sequence corresponding to the first word to be corrected. The first candidate sequence has the same or similar pinyin as the first word to be corrected.
[0150] Based on the first candidate sequence corresponding to each of the first words to be corrected contained in the first set of words to be corrected, a first target dictionary corresponding to the first set of words to be corrected is determined, and the first target dictionary is a first correct word dictionary;
[0151] For each of the first words to be corrected, if the first word to be corrected is exactly the same as any of the first feature sequences in the first target dictionary, it is determined that the first word to be corrected does not have homophone errors; if the first word to be corrected is not exactly the same as any of the first feature sequences in the first target dictionary, the text to be corrected is reconstructed according to the first target dictionary.
[0152] The multi-mode matching algorithm includes a second correct word dictionary, which is a mapping relationship between similar-looking words and a second feature sequence established based on the knowledge graph. The second feature sequence includes at least two of the following: personal name, job title, and place name.
[0153] If the text to be corrected is subjected to word-similar error correction, the text correction module is used to correct errors in the text based on a pre-constructed knowledge graph using a multi-modal matching algorithm. Specifically, it is used for:
[0154] The second set of words to be corrected is extracted from the text to be corrected using a pre-built entity extraction model. The second set of words to be corrected includes multiple words to be corrected, and each word to be corrected corresponds to a person's name, job title, or place name.
[0155] For each of the second words to be corrected, the second words to be corrected are scanned by the multi-modal matching algorithm, and the second feature sequence containing the second words to be corrected is queried by the multi-modal matching algorithm to obtain the second candidate sequence corresponding to the second words to be corrected. The second candidate sequence and the second words to be corrected are similar in shape.
[0156] Based on the second candidate sequence corresponding to each of the second words to be corrected contained in the second set of words to be corrected, a second target dictionary corresponding to the second set of words to be corrected is determined, and the second target dictionary is a second correct word dictionary;
[0157] For each of the second words to be corrected, if the second word to be corrected is exactly the same as any second feature sequence in the second target dictionary, it is determined that the second word to be corrected does not have any similar word errors; if the second word to be corrected is not exactly the same as any second feature sequence in the second target dictionary, the text to be corrected is reconstructed according to the second target dictionary.
[0158] The multi-mode matching algorithm includes a third correct word dictionary, which is a mapping relationship between substrings and third feature sequences established based on the knowledge graph. The third feature sequence includes at least two of the following: personal name, job title, and place name.
[0159] If multi-character error correction is performed on the text to be corrected, the text correction module is used to correct errors in the text to be corrected based on a pre-constructed knowledge graph and through a multi-modal matching algorithm. Specifically, it is used for:
[0160] The third set of words to be corrected in the text to be corrected is extracted using a pre-built entity extraction model. The third set of words to be corrected includes multiple third words, each of which corresponds to a person's name, job title, or place name.
[0161] For each of the third words to be corrected, the third words to be corrected are scanned by the multi-modal matching algorithm, and the third feature sequence containing the third words to be corrected is queried in the third correct word dictionary by the multi-modal matching algorithm, so as to obtain the third candidate sequence corresponding to the third words to be corrected. The third candidate sequence includes multiple candidate substrings, and each candidate substring is a substring of the third words to be corrected.
[0162] Based on the target parameters corresponding to each of the third words to be corrected in the third set of words to be corrected, a third target dictionary corresponding to the third set of words to be corrected is determined, wherein the third target dictionary is a third correct word dictionary; wherein, the target parameters are the position of each candidate substring corresponding to the third word to be corrected in the third candidate sequence and the character length of the third candidate sequence;
[0163] For each of the third words to be corrected, if the third word to be corrected is exactly the same as any third feature sequence in the third target dictionary, it is determined that the third word to be corrected does not have a multi-character error; if the third word to be corrected is not exactly the same as any third feature sequence in the third target dictionary, the text to be corrected is reconstructed according to the third target dictionary.
[0164] Wherein, if the third word to be corrected is not completely identical to any third feature sequence in the third target dictionary, the text to be corrected is reconstructed according to the third target dictionary, and the text correction module includes:
[0165] The first processing unit is configured to determine the error region and target number of characters of the third word to be corrected based on the third target dictionary, wherein the target number of characters is determined based on the character length of the third target dictionary and a preset expansion threshold;
[0166] The second processing unit is used to determine the text to be checked in the text to be corrected based on the error area and the target number of characters.
[0167] The third processing unit is used to select a sliding window with a window size equal to the character length of the text to be inspected and perform sliding processing on the text to be inspected, and calculate the edit distance between each sequence in the text to be inspected and the third target dictionary, wherein the sequence is a string in the text to be inspected;
[0168] The fourth processing unit is used to determine the words to be corrected in the text to be corrected based on the edit distance of each string and a preset distance threshold.
[0169] The fifth processing unit is used to replace the word to be corrected in the text to be corrected with a third candidate sequence of substrings containing the third word to be corrected in the third target dictionary.
[0170] Optionally, the system further includes a knowledge graph update module, which includes:
[0171] The fourth subunit is used to obtain website content from the target website template at preset time intervals, parse the website content, and obtain the appointment and removal text, which includes personal names, job titles, and place names.
[0172] The fifth subunit is used to extract appointment and removal terms from the appointment and removal text using a pre-built entity extraction model. The appointment and removal terms include personal names, job titles, and place names.
[0173] The sixth subunit is used to update the knowledge graph based on the appointed / dismissed term if the knowledge graph does not contain the appointed / dismissed term. The knowledge graph is updated by adding or modifying the term.
[0174] Example 4
[0175] Based on the same principle as the knowledge graph-based name and job title error correction method described in Embodiment 1, this embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the knowledge graph-based name and job title error correction method as described in Embodiment 1 or Embodiment 2.
[0176] Example 5
[0177] Based on the same principle as the knowledge graph-based name and job title error correction method described in Embodiment 1, this embodiment provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the knowledge graph-based name and job title error correction method as described in Embodiment 1 or Embodiment 2.
[0178] In the description of this invention, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0179] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0180] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A method for correcting errors in names and job titles based on knowledge graphs, characterized in that, include: Step S1: Obtain the text to be corrected, which includes the person's name and job title; Step S2: Based on the pre-constructed knowledge graph, the text to be corrected is corrected using a multi-modal matching algorithm to obtain the target text; the knowledge graph is used to represent the relationships between various entities, the entities include names and job titles, and the error text correction includes correction of homophones, correction of similar-looking words, correction of extra characters, and correction of missing characters; The multi-mode matching algorithm includes a third correct word dictionary, which is a mapping relationship between substrings and third feature sequences established based on the knowledge graph. The third feature sequence includes at least two of the following: personal name, job title, and place name. If multi-character error correction is performed on the text to be corrected, the step of correcting the text errors by using a multi-modal matching algorithm based on a pre-constructed knowledge graph includes: The third set of words to be corrected in the text to be corrected is extracted using a pre-built entity extraction model. The third set of words to be corrected includes multiple third words, each of which corresponds to a person's name, job title, or place name. For each of the third words to be corrected, the third words to be corrected are scanned by the multi-modal matching algorithm, and the third feature sequence containing the third words to be corrected is queried in the third correct word dictionary by the multi-modal matching algorithm, so as to obtain the third candidate sequence corresponding to the third words to be corrected. The third candidate sequence includes multiple candidate substrings, and each candidate substring is a substring of the third words to be corrected. Based on the target parameters corresponding to each of the third words to be corrected in the third set of words to be corrected, a third target dictionary corresponding to the third set of words to be corrected is determined, wherein the third target dictionary is a third correct word dictionary; wherein, the target parameters are the position of each candidate substring corresponding to the third word to be corrected in the third candidate sequence and the character length of the third candidate sequence; For each of the third words to be corrected, if the third word to be corrected is exactly the same as any third feature sequence in the third target dictionary, it is determined that the third word to be corrected does not have a multi-character error; if the third word to be corrected is not exactly the same as any third feature sequence in the third target dictionary, the text to be corrected is reconstructed according to the third target dictionary. Also includes: The website content in the target website template is obtained at preset time intervals, and the website content is parsed to obtain the appointment and dismissal text, which includes personal names, job titles and place names; The appointment and removal terms in the appointment and removal text are extracted using a pre-built entity extraction model. The appointment and removal terms include personal names, job titles, and place names. If the knowledge graph does not contain the term "appointment / removal", the knowledge graph is updated based on the term "appointment / removal". The knowledge graph is updated by adding or modifying.
2. The method according to claim 1, characterized in that, The knowledge graph is constructed in the following way: Obtain multiple text samples; For each text sample, a pre-built entity extraction model is used to extract sample words from the text sample, including personal names, job titles, and place names; For each sample word, the person name, job title, and place name contained in the sample word are treated as entities. Based on the relationship between the person name and the job title, and the relationship between the person name and the place name, a knowledge graph corresponding to the sample word is established.
3. The method according to claim 1, characterized in that, The multi-modal matching algorithm includes a first correct word dictionary, which is a mapping relationship between pinyin and a first feature sequence established based on the knowledge graph. The first feature sequence includes at least two of the following: personal name, job title, and place name. If homophone correction is performed on the text to be corrected, the step of correcting the text using a multi-modal matching algorithm based on a pre-constructed knowledge graph includes: The first set of words to be corrected in the text to be corrected is extracted using a pre-built entity extraction model. The first set of words to be corrected includes multiple first words to be corrected, and each first word to be corrected corresponds to a person's name, job title, or place name. For each of the first words to be corrected, the first words to be corrected are converted into a pinyin sequence. The pinyin sequence is scanned by the multi-modal matching algorithm. The first feature sequence containing the pinyin sequence is queried by the multi-modal matching algorithm to obtain the first candidate sequence corresponding to the first words to be corrected. The first candidate sequence has the same or similar pinyin as the first words to be corrected. Based on the first candidate sequence corresponding to each of the first words to be corrected contained in the first set of words to be corrected, a first target dictionary corresponding to the first set of words to be corrected is determined, and the first target dictionary is a first correct word dictionary; For each of the first words to be corrected, if the first word to be corrected is exactly the same as any of the first feature sequences in the first target dictionary, it is determined that the first word to be corrected does not have homophone errors; if the first word to be corrected is not exactly the same as any of the first feature sequences in the first target dictionary, the text to be corrected is reconstructed according to the first target dictionary.
4. The method according to claim 1, characterized in that, The multi-modal matching algorithm includes a second correct word dictionary, which is a mapping relationship between similar-looking words established based on the knowledge graph and a second feature sequence. The second feature sequence includes at least two of the following: personal name, job title, and place name. If the text to be corrected is subjected to word correction based on similar-looking characters, the step of correcting the text based on a pre-constructed knowledge graph and using a multi-modal matching algorithm includes: The second set of words to be corrected is extracted from the text to be corrected using a pre-built entity extraction model. The second set of words to be corrected includes multiple words to be corrected, and each word to be corrected corresponds to a person's name, job title, or place name. For each of the second words to be corrected, the second words to be corrected are scanned by the multi-modal matching algorithm, and the second feature sequence containing the second words to be corrected is queried by the multi-modal matching algorithm to obtain the second candidate sequence corresponding to the second words to be corrected. The second candidate sequence and the second words to be corrected are similar in shape. Based on the second candidate sequence corresponding to each of the second words to be corrected contained in the second set of words to be corrected, a second target dictionary corresponding to the second set of words to be corrected is determined, and the second target dictionary is a second correct word dictionary; For each of the second words to be corrected, if the second word to be corrected is exactly the same as any second feature sequence in the second target dictionary, it is determined that the second word to be corrected does not have any similar word errors; if the second word to be corrected is not exactly the same as any second feature sequence in the second target dictionary, the text to be corrected is reconstructed according to the second target dictionary.
5. The method according to claim 1, characterized in that, If the third word to be corrected is not completely identical to any third feature sequence in the third target dictionary, the text to be corrected is reconstructed based on the third target dictionary, including: Based on the third target dictionary, the error area and target number of the third word to be corrected are determined, wherein the target number of characters is determined based on the character length of the third target dictionary and a preset expansion threshold; Based on the error area and the target number of characters, determine the text to be checked in the text to be corrected; A sliding window with a size equal to the character length of the text to be inspected is selected and slid across the text to be inspected. The edit distance between each sequence in the text to be inspected and the third target dictionary is calculated. The sequence is a string in the text to be inspected. Based on the edit distance of each string and a preset distance threshold, the words to be corrected in the text to be corrected are determined; The word to be corrected in the text to be corrected is replaced with a third candidate sequence of substrings containing the third word to be corrected in the third target dictionary.
6. A knowledge graph-based error correction system for names and job titles, characterized in that, include: The text acquisition module is used to acquire the text to be corrected, which includes the person's name and job title. The text correction module is used to correct errors in the text to be corrected by using a multi-modal matching algorithm based on a pre-built knowledge graph to obtain the target text. The knowledge graph is used to represent the relationships between various entities, and the entities include names of people and job titles. The error text correction includes correction of homophones, correction of similar-looking words, correction of extra characters, and correction of missing characters. The multi-mode matching algorithm includes a third correct word dictionary, which is a mapping relationship between substrings and third feature sequences established based on the knowledge graph. The third feature sequence includes at least two of the following: personal name, job title, and place name. If multi-character error correction is performed on the text to be corrected, the step of correcting the text errors by using a multi-modal matching algorithm based on a pre-constructed knowledge graph includes: The third set of words to be corrected in the text to be corrected is extracted using a pre-built entity extraction model. The third set of words to be corrected includes multiple third words, each of which corresponds to a person's name, job title, or place name. For each of the third words to be corrected, the third words to be corrected are scanned by the multi-modal matching algorithm, and the third feature sequence containing the third words to be corrected is queried in the third correct word dictionary by the multi-modal matching algorithm, so as to obtain the third candidate sequence corresponding to the third words to be corrected. The third candidate sequence includes multiple candidate substrings, and each candidate substring is a substring of the third words to be corrected. Based on the target parameters corresponding to each of the third words to be corrected in the third set of words to be corrected, a third target dictionary corresponding to the third set of words to be corrected is determined, wherein the third target dictionary is a third correct word dictionary; wherein, the target parameters are the position of each candidate substring corresponding to the third word to be corrected in the third candidate sequence and the character length of the third candidate sequence; For each of the third words to be corrected, if the third word to be corrected is exactly the same as any third feature sequence in the third target dictionary, it is determined that the third word to be corrected does not have a multi-character error; if the third word to be corrected is not exactly the same as any third feature sequence in the third target dictionary, the text to be corrected is reconstructed according to the third target dictionary. It also includes a knowledge graph update module, which includes: The fourth subunit is used to obtain website content from the target website template at preset time intervals, parse the website content, and obtain the appointment and removal text, which includes personal names, job titles, and place names. The fifth subunit is used to extract appointment and removal terms from the appointment and removal text using a pre-built entity extraction model. The appointment and removal terms include personal names, job titles, and place names. The sixth subunit is used to update the knowledge graph based on the appointed / dismissed term if the knowledge graph does not contain the appointed / dismissed term. The knowledge graph is updated by adding or modifying the term.
7. An electronic device, characterized in that, The method includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the knowledge graph-based method for correcting names and job titles as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the knowledge graph-based method for correcting names and job titles as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Name error correction method and device, computer equipment and readable storage medium
CN112380842A
Graph neural network-based text error correction method, apparatus and device, and storage medium
WO2021139349A1