Name correction method, device, electronic device and storage medium

By combining semantic similarity, name similarity and position consistency, using correction models to deal with names with similar pinyin or similar errors, the problem of low accuracy of correction results in the prior art is solved, and higher correction accuracy is achieved.

CN113947073BActive Publication Date: 2025-01-14HEBEI XUNFEI ARTIFICIAL INTELLIGENCE RES INST +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111210946.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-18
Publication Date
2025-01-14
Estimated Expiration
2041-10-18

AI Technical Summary

Technical Problem

When the existing correction methods for person names are dealing with similar pinyin or approximate errors, the correction results are relatively accurate, which can easily lead to misjudgment.

Method used

A comprehensive method based on semantic similarity, name similarity and position consistency is adopted to match the candidate text with the candidate name through the correction model, determine the correction results, and consider the context relevance of the candidate text and the corrected sentence fluency.

Benefits of technology

It improves the accuracy of the corrected results of the person name, reduces misjudgment, and enhances the accuracy of the corrected results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113947073B_ABST
    Figure CN113947073B_ABST
Patent Text Reader

Abstract

The present invention provides a name correction method, device, electronic device and storage medium, the method comprising: determining an erroneous name in a text to be corrected and a candidate name corresponding to the erroneous name; replacing the erroneous name in the text to be corrected with the candidate name to obtain a candidate text; determining the name correction result of the text to be corrected based on the semantic similarity between the candidate text and the candidate name, the similarity between the name prediction result of the text to be corrected and the candidate name, and the consistency between the name prediction position of the text to be corrected and the position of the candidate name. The name correction method, device, electronic device and storage medium provided by the present invention can further improve the accuracy of the name correction result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of text recognition, and in particular to a method, device, electronic equipment and storage medium for correcting a person's name. Background Art

[0002] With the development of information technology, various types of electronic data are constantly increasing. Incorrect recognition of names in texts due to errors such as spelling has become an important problem that needs to be solved in natural language understanding.

[0003] The existing name correction method usually first performs entity recognition on the text to be corrected to obtain the name information in the text to be corrected, then calculates the pinyin similarity between the name information and the target name, and judges whether to correct the name information in the text to be corrected based on the calculation result. However, if the pinyin of the wrong characters in the name information is the same or similar to the pinyin of the target name, it will cause misjudgment and affect the accuracy of the correction result. For example, the pinyin of the name information "Li Xiaocheng" and the target name "Li Xiaocheng" are similar. The result obtained by the pinyin similarity calculation is that "Li Xiaocheng" in the text to be corrected does not need to be corrected, but in fact "Li Xiaocheng" in the text to be corrected needs to be corrected to the target name "Li Xiaocheng". Summary of the invention

[0004] The present invention provides a name correction method, device, electronic device and storage medium, which are used to solve the defect of low accuracy of name correction results in the prior art.

[0005] The present invention provides a method for correcting a name, comprising:

[0006] Determine the wrong person's name in the text to be corrected, and the candidate name corresponding to the wrong person's name;

[0007] Replacing the wrong person's name in the text to be corrected with the candidate name to obtain a candidate text;

[0008] Based on the semantic similarity between the candidate text and the candidate name, the similarity between the name prediction result of the text to be corrected and the candidate name, and the consistency between the name prediction position of the text to be corrected and the position of the candidate name, the name correction result of the text to be corrected is determined.

[0009] According to a method for correcting a name provided by the present invention, the method of determining the correction result of the name of the text to be corrected based on the semantic similarity between the candidate text and the candidate name, the similarity between the name prediction result of the text to be corrected and the candidate name, and the consistency between the name prediction position of the text to be corrected and the position of the candidate name, includes:

[0010] Inputting the candidate text and the incorrect name into a correction model to obtain a semantic similarity score, a name similarity score, and a position consistency score output by the correction model;

[0011] Determining the name correction result based on the semantic similarity score, the name similarity score and the position consistency score;

[0012] The correction model is trained based on sample text, sample incorrect names corresponding to the sample text, sample semantic similarity results, sample name similarity results, and sample position consistency results.

[0013] According to a method for correcting a name provided by the present invention, the candidate text and the wrong name are input into a correction model to obtain a semantic similarity score, a name similarity score and a position consistency score output by the correction model, including:

[0014] Concatenate the candidate text and the incorrect name to obtain a concatenated text;

[0015] Inputting the concatenated text into the encoding layer of the correction model to obtain the word encoding features of each word in the concatenated text output by the encoding layer;

[0016] Inputting the word encoding features of each participle into the feature extraction layer of the correction model to obtain the context features of each participle in the concatenated text output by the feature extraction layer;

[0017] The context features of each word segment are input into the score prediction layer of the correction model to obtain the semantic similarity score, the name similarity score and the position consistency score output by the score prediction layer.

[0018] According to a method for correcting a name provided by the present invention, the word encoding feature includes a word feature vector, a word position vector and a word mask vector, or includes the word feature vector, the word position vector and the word mask vector, and at least one of a word pinyin vector and a word sequence vector.

[0019] According to a method for correcting a name provided by the present invention, the step of determining an erroneous name in a text to be corrected and a candidate name corresponding to the erroneous name includes:

[0020] The text to be corrected is matched with a name dictionary to determine the incorrect name and the candidate name.

[0021] According to a method for correcting a name provided by the present invention, matching the text to be corrected with a name dictionary to determine the wrong name and the candidate name includes:

[0022] After deleting any character in the text to be corrected, the text to be corrected is matched with the name dictionary to determine the wrong name and the candidate name;

[0023] and / or, matching the text to be corrected with missing names to determine the erroneous names and the candidate names; the missing names are obtained by deleting any character of each name in the name dictionary;

[0024] And / or, after deleting any character in the text to be corrected, the text to be corrected is matched with the missing name to determine the erroneous name and the candidate name.

[0025] According to a method for correcting a name provided by the present invention, matching the text to be corrected with a name dictionary includes:

[0026] Perform entity recognition on the text to be corrected to obtain name information, and match the name information with the name dictionary.

[0027] According to a method for correcting a name provided by the present invention, matching the text to be corrected with a name dictionary to determine the wrong name and the candidate name includes:

[0028] Matching the text to be corrected with the name dictionary to determine an initial incorrect name and an initial candidate name;

[0029] The incorrect name and the candidate name are determined based on the phonetic similarity and / or glyph similarity between the initial incorrect name and the initial candidate name.

[0030] The present invention also provides a device for correcting a person's name, comprising:

[0031] A candidate name determination unit, used to determine the wrong person name in the text to be corrected, and the candidate name corresponding to the wrong person name;

[0032] A candidate text determination unit, used to replace the wrong name in the text to be corrected with the candidate name to obtain the candidate text;

[0033] The name correction unit is used to determine the name correction result of the text to be corrected based on the semantic similarity between the candidate text and the candidate name, the similarity between the name prediction result of the text to be corrected and the candidate name, and the consistency between the name prediction position of the text to be corrected and the position of the candidate name.

[0034] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any of the above-mentioned methods for correcting a person's name are implemented.

[0035] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned methods for correcting a person's name are implemented.

[0036] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the steps of any of the above-mentioned methods for correcting a person's name are implemented.

[0037] The name correction method, device, electronic device and storage medium provided by the present invention further improve the accuracy of the name correction result determined based on the three factors, because the semantic similarity between the candidate text and the candidate name takes into account the contextual relevance of the candidate text, the similarity between the name prediction result of the text to be corrected and the candidate name takes into account the character similarity between the name prediction result and the candidate name, and the consistency between the name prediction position of the text to be corrected and the position of the candidate name takes into account the sentence fluency of the candidate text. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0039] Figure 1 It is a flow chart of the method for correcting a name provided by the present invention;

[0040] Figure 2 is a flowchart of an implementation of step 130 in the name correction method provided by the present invention;

[0041] Figure 3 is a flowchart of an implementation method of step 131 in the name correction method provided by the present invention;

[0042] Figure 4 It is a structural schematic diagram of the correction model provided by the present invention;

[0043] Figure 5 is a flowchart of an implementation of step 110 in the name correction method provided by the present invention;

[0044] Figure 6 It is a flow chart of another method for correcting a name provided by the present invention;

[0045] Figure 7 It is a structural schematic diagram of a name correction device provided by the present invention;

[0046] Figure 8 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0047] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0048] The name field is shorter, and there are more duplicate names, duplicate characters, similar pronunciations, and similar shapes. Therefore, compared with other types of text corrections, name correction is more difficult and requires more rigorous requirements.

[0049] The existing name correction method usually first performs entity recognition on the text to be corrected to obtain the name information in the text to be corrected, then calculates the pinyin similarity between the name information and the target name, and judges whether to correct the name information in the text to be corrected based on the calculation result. However, if the pinyin of the wrong characters in the name information is the same or similar to the pinyin of the target name, it will cause misjudgment and affect the accuracy of the correction result. For example, the pinyin of the name information "Li Xiaocheng" and the target name "Li Xiaocheng" are similar. The result obtained by the pinyin similarity calculation is that "Li Xiaocheng" in the text to be corrected needs to be corrected, but in fact "Li Xiaocheng" in the text to be corrected does not need to be corrected to the target name "Li Xiaocheng".

[0050] If the judgment of whether to correct the text to be corrected is based on whether there are words related to the target person's name in the text to be corrected, since the words related to the name are often consistent in some fields and the distinction is not high, it is easy to cause incorrect correction. For example, the input is "Chairman Li Xiaocheng proposed that we should attach importance to the education and learning of employees", but the "Li Xiaocheng" in the target name is actually a primary school student. Since most of the context words of "Li Xiaocheng" (such as education and learning) are related to "Li Xiaocheng", it can be seen from "Chairman" that "Li Xiaocheng" in "Chairman Li Xiaocheng proposed that we should attach importance to the education and learning of employees" cannot be corrected to the target name "Li Xiaocheng".

[0051] If the semantic relevance between the target name and the text to be corrected is calculated, since the semantic relevance only considers the relevance between the context of the text to be corrected and the target name, it does not consider the relationship between the position of the target name in the text to be corrected and the position of the name information in the text to be corrected, nor does it consider the contextual semantic coherence after the target name is used to correct the text to be corrected. For example, "Wang Meimei" in "The Queen of the Story is Beautiful" is mistakenly identified as a name, while according to the context "story" and "female", its semantics are judged to be consistent with "Wang Meimei", which leads to the mistaken correction of "Wang Meimei" in "The Queen of the Story is Beautiful" to "Wang Meimei".

[0052] To this end, the present invention provides a method for correcting a name. Figure 1 It is a flow chart of the name correction method provided by the present invention, such as Figure 1 As shown, the method comprises the following steps:

[0053] Step 110: Determine the incorrect names in the text to be corrected and the candidate names corresponding to the incorrect names.

[0054] Here, the text to be corrected refers to a text containing name information, which may be an input electronic text, a text obtained by OCR recognition of written materials, or a text obtained by transcribing voice data. The candidate names corresponding to the wrong names refer to one or more optional correct names corresponding to the wrong names.

[0055] Optionally, after obtaining the text to be corrected, entity recognition can be performed on the text to be corrected to obtain the name information in the text to be corrected, or the text to be corrected can be matched with preset keywords to obtain the name information in the text to be corrected. For example, the preset keywords can be the surnames of people such as "Zhao", "Qian", "Sun", "Li", etc. After detecting the presence of preset keywords in the text to be corrected, the preset keywords and several characters after the preset keywords can be used as name information.

[0056] The wrong name and the candidate name can be obtained by comparing the above name information with the name comparison table. For example, if the name information is "Li Xiaocheng", and in the name comparison table "Li Xiaocheng" is located in the wrong name column, and the corresponding candidate name columns are "Li Xiaocheng", "Li Xiaocheng" and "Li Xiaodeng", then "Li Xiaocheng", "Li Xiaocheng" and "Li Xiaodeng" can be used as candidate names corresponding to the wrong name.

[0057] Step 120: Replace the incorrect name in the text to be corrected with the candidate name to obtain the candidate text.

[0058] Specifically, after determining the candidate name corresponding to the erroneous name, the erroneous name in the text to be corrected is replaced with the candidate name to obtain the candidate text.

[0059] For example, the text to be corrected is "Chairman Li Xiaocheng proposed that we should attach importance to the education and learning of employees", the corresponding incorrect name is "Li Xiaocheng", and the candidate name is "Li Xiaocheng", then after replacing the incorrect name with the candidate name, the candidate text obtained is "Chairman Li Xiaocheng proposed that we should attach importance to the education and learning of employees".

[0060] Step 130, based on the semantic similarity between the candidate text and the candidate name, the similarity between the name prediction result of the text to be corrected and the candidate name, and the consistency between the name prediction position of the text to be corrected and the position of the candidate name, determine the name correction result of the text to be corrected.

[0061] Specifically, the semantic similarity between the candidate text and the candidate name is used to characterize the semantic relevance between the candidate text and the candidate name. The greater the semantic relevance, the higher the probability that the candidate name is the corrected name of the text to be corrected. For example, for the text to be corrected, "Chairman Li Xiaocheng proposed that we should attach importance to the education and learning of employees", the candidate text is "Chairman Li Xiaocheng proposed that we should attach importance to the education and learning of employees", and the candidate name is "Li Xiaocheng", but "Li Xiaocheng" is actually a cleaner, that is, "education, learning" in the candidate text have a low semantic relevance to "Li Xiaocheng", so the candidate name "Li Xiaocheng" is less likely to be the corrected name.

[0062] The name prediction result of the text to be corrected refers to the corrected name predicted based on each character in the text to be corrected. The higher the similarity between the name prediction result and the candidate name, the higher the probability that the candidate name is the corrected name of the text to be corrected. For example, for the text to be corrected "Chairman Li Xiaocheng proposed that the education and learning of employees should be emphasized", the corrected name predicted based on the semantics of each character is "Li Xiaocheng", that is, the name prediction result is "Li Xiaocheng". If the candidate name is "Li Xiaocheng", which is the same as the name prediction result, it means that the candidate name "Li Xiaocheng" is more likely to be the corrected name.

[0063] The predicted position of the name in the text to be corrected refers to the start position and end position of the corrected name predicted based on each character in the text to be corrected. The higher the degree of consistency between the predicted position of the name and the position of the candidate name, the higher the probability that the candidate name is the corrected name of the text to be corrected. For example, for the text to be corrected "The queen in the story is Meimei", the start position of the corrected name predicted according to the semantics of each character is the 5th character (corresponding to the position of "female" in the text to be corrected), and the end position is the 6th character (corresponding to the position of "king" in the text to be corrected). When identifying, "Wang Meimei" is regarded as the wrong name, and "Wang Meimei" is correspondingly regarded as the candidate name. That is, the start position of the candidate name in the text to be corrected is the 6th character (corresponding to the position of "king"), and the end position is the 8th character (corresponding to the position of the 2nd "mei"). It can be seen that the position of the candidate name is different from the predicted position of the name, that is, the probability that the candidate name "Wang Meimei" is the corrected name is relatively low.

[0064] Thus, the consistency between the predicted position of the name in the text to be corrected and the position of the candidate name takes into account the sentence fluency of the candidate text. For example, in the text to be corrected "The queen in the story is Meimei", "Wang Meimei" is wrongly identified as the name, so "Wang Meimei" is regarded as the candidate name, and then the candidate text "The queen in the story is Meimei" with poor sentence fluency is obtained.

[0065] After determining the semantic similarity between the candidate text and the candidate name, the similarity between the predicted result of the name in the text to be corrected and the candidate name, and the consistency between the predicted position of the name in the text to be corrected and the position of the candidate name, the three can be fused to obtain the probability that the candidate name is the corrected name of the text to be corrected, and the name correction result of the text to be corrected can be determined based on each probability value. Optionally, the candidate name corresponding to the maximum probability value can be used as the corrected name of the text to be corrected, and the wrong name in the text to be corrected can be corrected with this candidate name. Alternatively, the candidate names corresponding to the probability values greater than the threshold can be used as the corrected names of the text to be corrected, and the wrong names in the text to be corrected can be corrected with these candidate names.

[0066] In the name correction method provided by the embodiments of the present invention, since the semantic similarity between the candidate text and the candidate name takes into account the context relevance of the candidate text, the similarity between the predicted result of the name in the text to be corrected and the candidate name takes into account the character similarity between the predicted result of the name and the candidate name, and the consistency between the predicted position of the name in the text to be corrected and the position of the candidate name takes into account the sentence fluency of the candidate text, the accuracy of the name correction result determined based on the three is further improved.

[0067] Based on the above embodiments, Figure 2 It is a schematic flowchart of the implementation manner of step 130 in the name correction method provided by the present invention, as Figure 2As shown, based on the semantic similarity between the candidate text and the candidate name, the similarity between the name prediction result of the text to be corrected and the candidate name, and the consistency between the predicted position of the name of the text to be corrected and the position of the candidate name, the name correction result of the text to be corrected is determined, including:

[0068] Step 131: input the candidate text and the wrong name into the correction model to obtain the semantic similarity score, the name similarity score and the position consistency score output by the correction model;

[0069] Step 132: determining a name correction result based on the semantic similarity score, the name similarity score and the position consistency score;

[0070] Among them, the correction model is trained based on sample text, sample incorrect names and sample candidate names in the sample text, sample semantic similarity results, sample name similarity results and sample position consistency results.

[0071] Specifically, the candidate text and the wrong name are input into the correction model, and the correction model performs score prediction to obtain a semantic similarity score, a name similarity score, and a position consistency score. Among them, the semantic similarity score is used to characterize the semantic similarity between the candidate text and the candidate name. The higher the semantic similarity score, the greater the semantic relevance between the candidate text and the candidate name, that is, the higher the probability that the candidate name is the corrected name of the text to be corrected. The name similarity score is used to characterize the similarity between the name prediction result of the text to be corrected and the candidate name. The higher the name similarity score, the higher the similarity between the name prediction result and the candidate name, that is, the higher the probability that the candidate name is the corrected name of the text to be corrected. The position consistency score is used to characterize the consistency between the name prediction position of the text to be corrected and the position of the candidate name. The higher the position consistency score, the higher the similarity between the name prediction result and the candidate name, that is, the higher the probability that the candidate name is the corrected name of the text to be corrected.

[0072] After obtaining the semantic similarity score, name similarity score and position consistency score, the semantic similarity score, name similarity score and position consistency score can be fused to obtain the correction probability corresponding to the candidate name. If the correction probability is greater than the threshold, it can be determined that the name correction result is the corrected name of the candidate name as the text to be corrected.

[0073] Before inputting the candidate text and the wrong name into the correction model, the correction model can also be pre-trained, which can be achieved by executing the following steps: First, a large number of sample texts, sample wrong names and sample candidate names in the sample texts are collected, and their corresponding sample semantic similarity results, sample name similarity results and sample position consistency results are determined by manual annotation. Then, the initial model is trained based on the sample text, the sample wrong names and sample candidate names in the sample text, the sample semantic similarity results, the sample name similarity results and the sample position consistency results to obtain the correction model. Among them, the sample semantic similarity results, the sample name similarity results and the sample position consistency results are determined based on whether the sample candidate name is the correct correction name of the wrong name in the sample text.

[0074] Optionally, the sample text may include positive samples and negative samples, which may be obtained based on the following steps:

[0075] Positive example: Get historical texts containing names in the target domain, use a name dictionary to match the historical texts, and perform entity recognition on the historical texts. If the matched name is the same as the name obtained by entity recognition, the corresponding name is used as the name information of the historical text, and the wrong name corresponding to the name information is constructed. For example, if the name information is "Li Xiaocheng", the corresponding wrong name can be constructed as "Li Cheng", "Li Xiaochengcheng", "Xiaocheng", etc.

[0076] In order to obtain a large number of training samples, increase the diversity of samples, reduce the workload of manual annotation, and meet the purpose of correction detection, the sample text can be constructed in the form of (sample candidate text, starting position of name, ending position of name, sample wrong name, category), where the sample candidate text represents the text obtained by replacing the wrong name in the original sample text with the sample candidate name, the starting and ending positions of the name are the starting and ending positions of the sample candidate name in the sample candidate text, and the category indicates whether the sample candidate name can replace the sample wrong name (for example, when the category is 1, it indicates that the sample candidate name can replace the sample wrong name, and when the category is -1, it indicates that the sample candidate name cannot replace the sample wrong name).

[0077] According to the above method, for the historical text "Student Li Xiaocheng", the positive example sample can be constructed as (Student Li Xiaocheng, 3, 5, Li Cheng, 1).

[0078] Negative samples: Obtain the name information of the historical text according to the method in the positive sample, and then replace the name information with characters with lower sound and shape similarity to obtain negative samples.

[0079] For example, for the historical text "student Li Xiaocheng", we can determine that the name information is "Li Xiaocheng". Since the phonetic and pictographic similarity between "cheng" and "qiang" is low, "qiang" can be used to replace "cheng", and the negative example sample is (student Li Xiaoqiang, 3, 5, Li Xiaocheng, -1).

[0080] It can be seen that the sample texts (positive samples + negative samples) constructed by the above method are all derived from real texts, with strong diversity and obvious contrast, which can enable the correction model to learn the correlation between names and contexts to the greatest extent.

[0081] Based on any of the above embodiments, Figure 3 is a flow chart of an implementation of step 131 in the name correction method provided by the present invention, such as Figure 3 As shown, in step 131, the candidate text and the wrong name are input into the correction model to obtain the semantic similarity score, the name similarity score and the position consistency score output by the correction model, including:

[0082] Step 131a, concatenating the candidate text and the incorrect name to obtain a concatenated text;

[0083] Step 131b, input the concatenated text into the encoding layer of the correction model, and obtain the word encoding features of each word in the concatenated text output by the encoding layer;

[0084] Step 131c, inputting the word encoding features of each word segment into the feature extraction layer of the correction model, and obtaining the context features of each word segment in the concatenated text output by the feature extraction layer;

[0085] Step 131d: input the contextual features of each word segment into the score prediction layer of the correction model to obtain the semantic similarity score, name similarity score and position consistency score output by the score prediction layer.

[0086] Specifically, after obtaining the candidate text and the wrong name, the candidate text and the wrong name are concatenated to obtain a concatenated text. Then, the concatenated text is input into the encoding layer of the correction model, and the encoding layer encodes each word in the concatenated text to obtain the word encoding features of each word. Among them, the encoding features of each word can be used to represent the semantic information and position information of each word, whether the position of each word in the candidate text is the name position, etc.

[0087] After obtaining the encoding features of each participle, the feature extraction layer extracts the context information of each participle to obtain the context features of each participle. Among them, the context features of each participle contain the context information of each participle, so that the score prediction layer can determine the semantic similarity between the candidate text and the candidate name based on the context features, and then obtain the semantic similarity score. The context features of each participle contain the semantic information of each participle, so that the score prediction layer can determine the name prediction result of the text to be corrected based on the semantic information of each participle, and then determine the similarity between the name prediction result and the candidate name to obtain the name similarity score. The context features of each participle also include the position information of each participle and whether the position of each participle in the candidate text is the name position, so that it can be determined based on the context features whether the position of the candidate name in the candidate text is consistent with the predicted position of the name in the text to be corrected, and obtain the position consistency score.

[0088] Based on any of the above embodiments, Figure 4 It is a structural schematic diagram of the correction model provided by the present invention, such as Figure 4 As shown, the correction model may include a coding layer, a feature extraction layer and a score prediction layer, wherein the coding layer may be a score prediction layer including a semantic prediction layer, a name prediction layer and a position prediction layer.

[0089] The concatenated text is input into the encoding layer, which encodes the concatenated text to obtain the encoding features of each word segmentation, which can be represented based on the embedding vector; then the encoding features of each word segmentation are input into the feature extraction layer, which extracts the context information of each word segmentation to obtain the context features of each word segmentation, wherein the feature extraction layer can be constructed based on the transformer structure in the Bert model. Finally, the context features of each word segmentation are input into the semantic prediction layer, the name prediction layer and the position prediction layer respectively, and the semantic similarity score output by the semantic prediction layer, the name similarity score output by the name prediction layer, and the position consistency score output by the position prediction layer are obtained.

[0090] Among them, the loss functions corresponding to the semantic prediction layer, name prediction layer and position prediction layer are as follows:

[0091] (a) Semantic prediction layer: Determine whether the context of the candidate text is consistent with the semantics of the candidate name. The loss function L cl (θ,θ 1 )as follows:

[0092]

[0093] Among them, θ represents the parameters of the encoding layer and the feature extraction layer, θ 1 is the parameter of the classifier connected to the semantic prediction layer on the feature extraction layer, N represents the number of candidate texts, cj When it is 1, it indicates that the candidate name can replace the wrong name in the text to be corrected. j When it is -1, it indicates that the candidate name cannot replace the wrong name in the text to be corrected.

[0094] (b) Name prediction layer: Determine whether the true value at the name position (mask) in the candidate text is the corrected name. The loss function Llm(θ,θ 2 )as follows:

[0095]

[0096] Among them, θ 2 is the parameter in the output layer of the name prediction layer connected to the feature extraction layer. M represents the number of mask words in the text to be corrected. i Indicates the character at the ith position of the candidate name. If the name in the name prediction result is the candidate name, minimize the loss function so that the model predicts that the candidate name is the corrected name; if the name in the name prediction result is not the candidate name, maximize the loss function so that the model predicts that the candidate name is not the corrected name.

[0097] (c) Position prediction layer: Determine whether the position of the name in the candidate text (mask) is the boundary of the corrected name. The loss function L ne (θ,θ 3 )as follows:

[0098]

[0099] Among them, θ 3 is the parameter of the output layer of the position prediction layer connected to the feature extraction layer, t i Indicates the name prediction result, t 0 ='B-name' means the first character of the mask is the starting position of the name, t i∈[1,M-1] ='I-name' means the middle word of the mask is a person's name, M+1 ='O' indicates that the last character of the mask is the end position of the name. If the predicted position of the name is the position of the candidate name, the boundary of the candidate name position is correct; if the predicted position of the name is not the position of the candidate name, the boundary of the candidate name position is wrong.

[0100] Finally, the loss function L(θ,θ 1 ,θ 2 ,θ 3 ) can be:

[0101] L(θ,θ 1 ,θ 2 ,θ 3 )=Lcl (θ,θ 1 )+L lm (θ,θ 2 )+L ne (θ,θ 3 )

[0102] After obtaining the semantic similarity score, the name similarity score and the position consistency score, the similarity probability can be calculated based on the three. If the similarity probability is greater than a threshold, it indicates that the candidate name is the corrected name. Optionally, the similarity probability P(s,n) can be calculated based on the following formula:

[0103]

[0104] Based on any of the above embodiments, the word encoding features include a word feature vector, a word position vector and a word mask vector, or include a word feature vector, a word position vector and a word mask vector, and at least one of a word pinyin vector and a word sequence vector.

[0105] Specifically, the word feature vector is used to represent the feature information of each word in the concatenated text, which can be obtained through the Bert model or other types of language models; the word position vector is used to represent the position information of each word in the concatenated text; the word mask vector can be a mask vector, which is used to mark the position of the name in the concatenated text, for example, the mask from the starting position to the end position of the name can be set to 1, and the masks of other positions can be set to 0; the word pinyin vector is used to represent the pinyin information of each word in the concatenated text, which can be obtained by vectorizing the pinyin of the word, for example, the pinyin of each word can be vectorized through the GRU (Gated Recurrent Unit) network; the word sequence vector is used to represent the glyph information of each word in the concatenated text, which can be obtained by vectorizing the IDS (Ideographic Description Sequences) of the word, for example, the IDS of each word can be vectorized through the GRU network.

[0106] Based on the feature information of each word carried in the word feature vector, the position information of each word carried in the word position vector, and the position information of the name in the concatenated text carried in the word mask vector, the semantic relevance between the candidate text and the candidate name (i.e., the semantic similarity score), the similarity between the name prediction result and the candidate name (i.e., the name similarity score), and the consistency between the predicted name position and the candidate name position (i.e., the position consistency score) can be determined.

[0107] Further, the word pinyin vector carries the pinyin information of each word segment, and the word sequence vector carries the glyph information of each word segment. Thus, when the word pinyin vector and / or the word sequence vector are input into the correction model, the correction model can have the ability to judge the phonetic and glyph similarity, and further improve the accuracy of the corrected result of the person name.

[0108] Based on any of the above embodiments, step 110 of determining the wrong person name and the corresponding candidate person name in the text to be corrected includes:

[0109] Match the text to be corrected with the person name dictionary to determine the wrong person name and the candidate person name.

[0110] Specifically, the person name dictionary may include the target person names in a specific field and the attribute information corresponding to each target person name. For example, in the education field, the target person name may be a teacher, and the attributes corresponding to the target person name may be the teacher's title, the school where the teacher works, etc.

[0111] After determining the target person name, according to the glyph, pinyin and other information of each character of the target person name, the wrong candidate person names that may be obtained due to writing errors or spelling mistakes can be determined. Then, match the text to be corrected with the person name dictionary. If a wrong candidate person name is obtained through the match, the wrong candidate person name can be taken as the wrong person name in the text to be corrected, and the target person name corresponding to the wrong candidate person name can be taken as the candidate person name.

[0112] For example, for the target person name "Li Xiaocheng", since "cheng" (橙) and "cheng" (澄) are similar in both pinyin and glyph, "Li Xiaocheng" can be taken as the wrong candidate person name for the target person name "Li Xiaocheng". If the text to be corrected is "Student Li Xiaocheng", then "Li Xiaocheng" can be obtained as the wrong candidate person name through the match in the person name dictionary, and the corresponding target person name is "Li Xiaocheng". Therefore, it can be determined that the wrong person name in the text to be corrected is "Li Xiaocheng", and the candidate person name is "Li Xiaocheng".

[0113] Based on any of the above embodiments, matching the text to be corrected with the person name dictionary to determine the wrong person name and the candidate person name includes:

[0114] After deleting any character in the text to be corrected, match the text to be corrected with the person name dictionary to determine the wrong person name and the candidate person name;

[0115] And / or, match the text to be corrected with the missing person names to determine the wrong person name and the candidate person name; the missing person names are obtained by deleting any character of each person name in the person name dictionary;

[0116] And / or, after deleting any character in the text to be corrected, match the text to be corrected with the missing person names to determine the wrong person name and the candidate person name.

[0117] Specifically, when matching the text to be corrected with the person name dictionary, at least one of the methods of redundancy detection, missing detection, and substitution detection can be used to determine the incorrect person name and the candidate person name. The following separately explains redundancy detection, missing detection, and substitution detection. The detection results of the three detection methods can be expressed as (starting position of the person name, incorrect person name, candidate person name, error type):

[0118] (a) Redundancy detection: After deleting any character in the text to be corrected, match the text to be corrected with the person name dictionary to determine the incorrect person name and the candidate person name.

[0119] Match the text to be corrected with the person name dictionary after removing one character in turn. If the match is successful, a redundancy error is detected. For example, for the input text to be corrected "Student Li Xiaochengcheng", after removing "cheng", "Li Xiaocheng" is matched, then the detection result is (3, Li Xiaochengcheng, Li Xiaocheng, redundancy), the corresponding incorrect person name is "Li Xiaochengcheng", and the candidate person name is "Li Xiaocheng".

[0120] (b) Missing detection: Match the text to be corrected with the missing person names to determine the incorrect person name and the candidate person name; the missing person names are obtained by deleting any character of each person name in the person name dictionary.

[0121] Table 1 is a list of missing person names. As shown in Table 1, delete each character of the target person name "Li Xiaocheng" in the person name dictionary in turn to obtain the corresponding missing person names "Li Cheng", "Li Xiao", and "Xiao Cheng".

[0122] Table 1

[0123] Missing name Target name Li Cheng Li Xiaocheng Li Xiao Li Xiaocheng Xiao Cheng Li Xiaocheng

[0124] Match the text to be corrected with each missing person name. If the match is successful, a missing error is detected. For example, for the input text to be corrected "Student Li Cheng", the missing person name "Li Cheng" is matched, then (3, Li Cheng, Li Xiaocheng, missing) is detected, the corresponding incorrect person name is "Li Cheng", and the candidate person name is "Li Xiaocheng".

[0125] (c) Substitution detection: After deleting any character in the text to be corrected, match the text to be corrected with the missing person names to determine the incorrect person name and the candidate person name.

[0126] Match the text to be corrected with each missing person name after removing one character in turn. If the match is successful, a substitution error is detected. For example, for the input text to be corrected "Student Li Xiaocheng", after removing "cheng", the missing person name "Li Xiao" is matched, then the detection result is (3, Li Xiaocheng, Li Xiaocheng, substitution), the corresponding incorrect person name is "Li Xiaocheng", and the candidate person name is "Li Xiaocheng".

[0127] It should be noted that in order to ensure the accuracy of the detected wrong names and candidate names, when matching the text to be corrected with the name dictionary, it is usually required that the length of the name in the text to be corrected after deleting any character is greater than 1. For example, if the target name is Li Xiao, the corresponding missing names are "Li" and "Xiao", and the name information in the text to be corrected is "Li Xiao", then the result obtained by the replacement detection method is that "Li Xiao" is an incorrect name, which obviously caused a false detection.

[0128] Based on any of the above embodiments, matching the text to be corrected with a dictionary of names includes:

[0129] Perform entity recognition on the text to be corrected to obtain name information, and then match the name information with the name dictionary.

[0130] Specifically, if the wrong name in the text to be corrected contains more than two wrong characters, it cannot be accurately obtained through the above-mentioned redundancy detection, deletion detection and replacement detection methods. For example, the wrong name in the text to be corrected is "Li Xiaocheng Cheng", but the corresponding correct name should be "Li Xiaocheng", that is, the "Li" and "Cheng" in the wrong name are both wrong. If the redundancy detection method is used to remove one character from "Li Xiaocheng Cheng" one by one, three names "Xiaocheng Cheng", "Licheng Cheng" and "Li Xiaocheng" are obtained, but these three names cannot be matched to "Li Xiaocheng" in the name dictionary.

[0131] Therefore, in order to further ensure the accuracy of the name correction results, the embodiment of the present invention performs entity recognition on the text to be corrected to obtain name information, and matches the name information with the name dictionary to determine the wrong name and the candidate name.

[0132] Among them, when performing entity recognition on the text to be corrected, the text to be corrected can be input into a pre-trained entity recognition model, so that the entity recognition model can detect the name information and the corresponding attribute information according to the context information of the text to be corrected, and then obtain the corresponding target name set in the name dictionary according to the attribute information, and use the target name set as the candidate name, and the name information as the wrong name. If the result detected by the entity recognition model includes the name information, but there is no attribute information corresponding to the name information, the similarity between the name information and each target name in the name dictionary can be calculated, and the target name with a similarity greater than a threshold value can be used as a candidate name.

[0133] Optionally, in order to further improve the recognition accuracy of the entity recognition model, the entity recognition model can be trained based on enhanced samples, wherein the enhanced samples are obtained based on the following steps:

[0134] First, open-source tools such as LTP and jieba can be used to identify personal names from large-scale network texts. At the same time, a pre-built job title table is used to detect job titles existing in the text. A preset proportion (such as 30%) is randomly selected from the identified personal names for data augmentation. For example, with a 30% probability, one character in the personal name is replaced using a homophone confusion set. For example, "Li Xiaocheng" is changed to "Li Kecheng"; with a 30% probability, one character in the personal name is replaced using a glyph confusion set. For example, "Li Xiaocheng" is changed to "Li Xiaocheng"; with a 10% probability, one character in the personal name is randomly replaced. For example, "Li Xiaocheng" is changed to "Shi Xiaocheng"; with a 10% probability, one character in the personal name is randomly deleted. For example, "Li Xiaocheng" is changed to "Li Cheng"; with a 10% probability, one character is randomly inserted. For example, "Li Xiaocheng" is changed to "Li Xiaochengcheng"; with a 10% probability, the order of the personal name is randomly swapped. For example, "Li Xiaocheng" is changed to "Cheng Xiaoli".

[0135] After obtaining the augmented samples, the initial model (such as a model with a Bert+CRF structure) can be trained using the augmented samples and the corresponding personal name recognition results and personal name attribute information (such as job title information) of the augmented samples, so that the trained entity recognition model has the ability to recognize personal names and personal name attribute information. Usually, the distance between the personal name attribute information and the personal name information is relatively small. Therefore, when the distance between the personal name information and the personal name attribute information in the entity recognition model is less than a preset distance (such as 2), the corresponding recognition result can be output, where the recognition result can be expressed as (starting position of the personal name

[0136] , personal name information, personal name attribute information). For example, if the text to be corrected is "Student Li Xiaocheng", the detection result is (3, Li Xiaocheng, Student).

[0137] Based on any of the above embodiments, Figure 5 is a schematic flowchart of the implementation manner of step 110 in the personal name correction method provided by the present invention. As Figure 5 shown, the text to be corrected is matched with the personal name dictionary to determine the incorrect personal name and the candidate personal names, including:

[0138] Step 111: Match the text to be corrected with the personal name dictionary to determine the initial incorrect personal name and the initial candidate personal names;

[0139] Step 112: Based on the phonetic similarity and / or glyph similarity between the initial incorrect personal name and the initial candidate personal names, determine the incorrect personal name and the candidate personal names.

[0140] Specifically, due to the relatively large number of people with the same name and the same characters, after matching the text to be corrected with the person name dictionary, multiple initial candidate person names may be obtained. Among these initial candidate person names, some have a relatively low similarity with the initial incorrect person name. If the person name correction result is determined based on the initial incorrect person name and the initial candidate person name with a relatively low similarity, it will not only affect the accuracy of the person name correction result, but also reduce the efficiency of obtaining the person name correction result.

[0141] In response to this, after determining the initial incorrect person name and the initial candidate person name, the embodiment of the present invention can determine the incorrect person name and the candidate person name based on the phonetic similarity between the initial incorrect person name and the initial candidate person name, or the glyph similarity between the initial incorrect person name and the initial candidate person name, or the phonetic similarity and the glyph similarity between the initial incorrect person name and the initial candidate person name, and then can filter out the initial candidate person names with a relatively low similarity to the initial incorrect person name.

[0142] Among them, the phonetic similarity is used to represent the character pinyin similarity between the initial incorrect person name and the initial candidate person name, and the glyph similarity is used to represent the character glyph similarity between the initial incorrect person name and the initial candidate person name, and can be calculated through the following formulas respectively:

[0143] (1) Phonetic similarity: The phonetic is represented by pinyin. First, convert the characters in the initial incorrect person name and the initial candidate person name into pinyin, then calculate the edit distance between the pinyins, and then calculate the phonetic similarity through the following formula. Where p A , p B respectively represent the phonetics in the initial incorrect person name and the initial candidate person name, and edit(*) represents the edit distance. First, calculate the maximum similarity of the pinyin of each character in the initial candidate person name in the initial incorrect person name, and then calculate the average value of all similarities.

[0144]

[0145] (2) Glyph similarity: The glyph can be represented by the ideographic description sequence (IDS). First, represent the characters in the initial incorrect person name and the initial candidate person name using IDS. For example, "克" is represented as " 十口 丿乚", and then calculate the glyph similarity through the following formula. Where s A , s B respectively represent the IDS of the initial incorrect person name and the initial candidate person name. Among them, indicates that "十" and "口" are in an upper-lower structure, indicates that "丿" and "乚" are in a left-right structure.

[0146]

[0147] After determining the pronunciation similarity, the initial wrong name with a pronunciation similarity greater than a threshold can be used as the wrong name, and the initial candidate name can be used as the candidate name; after determining the glyph similarity, the initial wrong name with a glyph similarity greater than a threshold can be used as the wrong name, and the initial candidate name can be used as the candidate name; after determining the pronunciation similarity and glyph similarity, the overall similarity can be calculated, and the initial wrong name with an overall similarity greater than a threshold can be used as the wrong name, and the initial candidate name can be used as the candidate name. The overall similarity can be determined based on the following formula:

[0148] sim(A,B)=max(sim p (A,B),sim s (A,B)

[0149] It is understandable that if there is only one initial candidate name corresponding to the initial wrong name, the initial wrong name can be directly used as the wrong name and the initial candidate name can be used as the candidate name.

[0150] Based on any of the above embodiments, Figure 6 It is a flow chart of another method for correcting a name provided by the present invention, such as Figure 6 As shown, the method includes:

[0151] The text to be corrected is matched with a dictionary of names, and redundancy detection, missing detection and replacement detection are performed on the text to be corrected to obtain the initial incorrect name and the corresponding initial candidate name; the text to be corrected is input into an entity recognition model to obtain the name recognition result output by the entity recognition model.

[0152] If the name recognition result includes the name information and the corresponding name attribute information, a match is performed in the name dictionary based on the name attribute information to obtain the initial candidate name corresponding to the name information; if the name recognition result includes the name information but does not include the name attribute information, the pronunciation similarity and glyph similarity between the name information and each target name in the name dictionary are calculated to determine the initial candidate name corresponding to the name information.

[0153] After obtaining the initial candidate names and the initial incorrect names, the pronunciation similarity and the glyph similarity between the initial candidate names and the initial incorrect names are calculated, and the overall similarity is obtained based on the pronunciation similarity and the glyph similarity. Then, the initial candidate names with overall similarity greater than a threshold are taken as candidate names, and the initial incorrect names are taken as incorrect names.

[0154] The wrong name in the text to be corrected is replaced with a candidate name to obtain a candidate text, and the concatenated text of the candidate text and the wrong name is input into the correction model to obtain the semantic similarity score, name similarity score and position consistency score output by the correction model, and then the name correction result is determined based on the semantic similarity score, name similarity score and the position consistency score.

[0155] The name correction device provided by the present invention is described below. The name correction device described below and the name correction method described above can be referenced to each other.

[0156] Based on any of the above embodiments, the present invention also provides a device for correcting a person's name. Figure 7 Schematic diagram of the structure of the name correction device provided by the present invention. Figure 7 As shown, the device comprises:

[0157] A candidate name determination unit 710 is used to determine the wrong person name in the text to be corrected, and the candidate name corresponding to the wrong person name;

[0158] A candidate text determination unit 720 is used to replace the wrong person name in the text to be corrected with the candidate name to obtain the candidate text;

[0159] The name correction unit 730 is used to determine the name correction result of the text to be corrected based on the semantic similarity between the candidate text and the candidate name, the similarity between the name prediction result of the text to be corrected and the candidate name, and the consistency between the name prediction position of the text to be corrected and the position of the candidate name.

[0160] Based on any of the above embodiments, the name correction unit 730 includes:

[0161] A score prediction unit, used for inputting the candidate text and the wrong name into a correction model to obtain a semantic similarity score, a name similarity score and a position consistency score output by the correction model;

[0162] A name correction subunit, configured to determine the name correction result based on the semantic similarity score, the name similarity score and the position consistency score;

[0163] The correction model is trained based on sample text, sample erroneous names and sample candidate names in the sample text, sample semantic similarity results, sample name similarity results, and sample position consistency results.

[0164] Based on any of the above embodiments, the score prediction unit includes:

[0165] A concatenation unit, used for concatenating the candidate text and the incorrect name to obtain a concatenated text;

[0166] An encoding unit, used for inputting the concatenated text into the encoding layer of the correction model to obtain the word encoding features of each word in the concatenated text output by the encoding layer;

[0167] An extraction unit, used for inputting the word encoding features of each word segment into the feature extraction layer of the correction model to obtain the context features of each word segment in the concatenated text output by the feature extraction layer;

[0168] A prediction unit is used to input the context features of each word segment into the score prediction layer of the correction model to obtain the semantic similarity score, the name similarity score and the position consistency score output by the score prediction layer.

[0169] Based on any of the above embodiments, the word encoding feature includes a word feature vector, a word position vector and a word mask vector, or includes the word feature vector, the word position vector and the word mask vector, and at least one of a word pinyin vector and a word sequence vector.

[0170] Based on any of the above embodiments, the candidate name determination unit 710 is used to:

[0171] The text to be corrected is matched with a name dictionary to determine the incorrect name and the candidate name.

[0172] Based on any of the above embodiments, the candidate name determination unit 710 is used to:

[0173] After deleting any character in the text to be corrected, the text to be corrected is matched with the name dictionary to determine the wrong name and the candidate name;

[0174] and / or, matching the text to be corrected with missing names to determine the erroneous names and the candidate names; the missing names are obtained by deleting any character of each name in the name dictionary;

[0175] And / or, after deleting any character in the text to be corrected, the text to be corrected is matched with the missing name to determine the erroneous name and the candidate name.

[0176] Based on any of the above embodiments, matching the text to be corrected with a name dictionary includes:

[0177] Perform entity recognition on the text to be corrected to obtain name information, and match the name information with the name dictionary.

[0178] Based on any of the above embodiments, the candidate name determination unit 710 is used to:

[0179] An initial name determination unit, used for matching the text to be corrected with the name dictionary to determine an initial wrong name and an initial candidate name;

[0180] The similarity determination unit is used to determine the incorrect name and the candidate name based on the phonetic similarity and / or glyph similarity between the initial incorrect name and the initial candidate name.

[0181] Figure 8 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 8 As shown, the electronic device may include: a processor 810, a memory 820, a communications interface 830 and a communication bus 840, wherein the processor 810, the memory 820 and the communications interface 830 communicate with each other through the communication bus 840. The processor 810 may call the logic instructions in the memory 820 to execute the name correction method, which includes: determining the wrong name in the text to be corrected and the candidate name corresponding to the wrong name; replacing the wrong name in the text to be corrected with the candidate name to obtain the candidate text; determining the name correction result of the text to be corrected based on the semantic similarity between the candidate text and the candidate name, the similarity between the name prediction result of the text to be corrected and the candidate name, and the consistency between the name prediction position of the text to be corrected and the position of the candidate name.

[0182] In addition, the logic instructions in the above-mentioned memory 820 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0183] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the name correction method provided by the above-mentioned methods, and the method includes: determining the wrong name in the text to be corrected, and the candidate name corresponding to the wrong name; replacing the wrong name in the text to be corrected with the candidate name to obtain a candidate text; based on the semantic similarity between the candidate text and the candidate name, the similarity between the name prediction result of the text to be corrected and the candidate name, and the consistency between the name prediction position of the text to be corrected and the position of the candidate name, determine the name correction result of the text to be corrected.

[0184] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the above-mentioned name correction methods, the methods comprising: determining an erroneous name in a text to be corrected, and a candidate name corresponding to the erroneous name; replacing the erroneous name in the text to be corrected with the candidate name to obtain a candidate text; determining the name correction result of the text to be corrected based on the semantic similarity between the candidate text and the candidate name, the similarity between the name prediction result of the text to be corrected and the candidate name, and the consistency between the name prediction position of the text to be corrected and the position of the candidate name.

[0185] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative work.

[0186] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0187] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for correcting a name, characterized in that: include: Determine the wrong person's name in the text to be corrected, and the candidate name corresponding to the wrong person's name; Replacing the wrong person's name in the text to be corrected with the candidate name to obtain a candidate text; Determine the name correction result of the text to be corrected based on the semantic similarity between the candidate text and the candidate name, the similarity between the name prediction result of the text to be corrected and the candidate name, and the consistency between the name prediction position of the text to be corrected and the position of the candidate name; The determining of the correction result of the name of the text to be corrected based on the semantic similarity between the candidate text and the candidate name, the similarity between the name prediction result of the text to be corrected and the candidate name, and the consistency between the predicted position of the name of the text to be corrected and the position of the candidate name, includes: Inputting the candidate text and the incorrect name into a correction model to obtain a semantic similarity score, a name similarity score, and a position consistency score output by the correction model; Determining the name correction result based on the semantic similarity score, the name similarity score and the position consistency score; The correction model is trained based on sample text, sample erroneous names and sample candidate names in the sample text, sample semantic similarity results, sample name similarity results, and sample position consistency results.

2. The name correction method according to claim 1, characterized in that: The step of inputting the candidate text and the incorrect name into the correction model to obtain the semantic similarity score, the name similarity score and the position consistency score output by the correction model includes: Concatenate the candidate text and the incorrect name to obtain a concatenated text; Inputting the concatenated text into the encoding layer of the correction model to obtain the word encoding features of each word in the concatenated text output by the encoding layer; Inputting the word encoding features of each participle into the feature extraction layer of the correction model to obtain the context features of each participle in the concatenated text output by the feature extraction layer; The context features of each word segment are input into the score prediction layer of the correction model to obtain the semantic similarity score, the name similarity score and the position consistency score output by the score prediction layer.

3. The name correction method according to claim 2, characterized in that: The word encoding feature includes a word feature vector, a word position vector and a word mask vector, or includes the word feature vector, the word position vector and the word mask vector, and at least one of a word pinyin vector and a word sequence vector.

4. The method for correcting a name according to any one of claims 1 to 3, characterized in that: The step of determining the wrong person name in the text to be corrected and the candidate name corresponding to the wrong person name includes: The text to be corrected is matched with a name dictionary to determine the incorrect name and the candidate name.

5. The method for correcting a name according to claim 4, characterized in that: The step of matching the text to be corrected with a name dictionary to determine the wrong name and the candidate name includes: After deleting any character in the text to be corrected, the text to be corrected is matched with the name dictionary to determine the wrong name and the candidate name; and / or, matching the text to be corrected with missing names to determine the erroneous names and the candidate names; the missing names are obtained by deleting any character of each name in the name dictionary; And / or, after deleting any character in the text to be corrected, the text to be corrected is matched with the missing name to determine the erroneous name and the candidate name.

6. The method for correcting a name according to claim 4, characterized in that: The matching of the text to be corrected with a dictionary of names includes: Perform entity recognition on the text to be corrected to obtain name information, and match the name information with the name dictionary.

7. The method for correcting a person's name according to claim 4, characterized in that: The step of matching the text to be corrected with a name dictionary to determine the wrong name and the candidate name includes: Matching the text to be corrected with the name dictionary to determine an initial incorrect name and an initial candidate name; The incorrect name and the candidate name are determined based on the phonetic similarity and / or glyph similarity between the initial incorrect name and the initial candidate name.

8. A device for correcting a name, characterized in that: include: A candidate name determination unit, used to determine the wrong person name in the text to be corrected, and the candidate name corresponding to the wrong person name; A candidate text determination unit, used to replace the wrong name in the text to be corrected with the candidate name to obtain the candidate text; A name correction unit, configured to determine a name correction result of the text to be corrected based on the semantic similarity between the candidate text and the candidate name, the similarity between the name prediction result of the text to be corrected and the candidate name, and the consistency between the name prediction position of the text to be corrected and the position of the candidate name; The determining of the correction result of the name of the text to be corrected based on the semantic similarity between the candidate text and the candidate name, the similarity between the name prediction result of the text to be corrected and the candidate name, and the consistency between the predicted position of the name of the text to be corrected and the position of the candidate name, includes: Inputting the candidate text and the incorrect name into a correction model to obtain a semantic similarity score, a name similarity score, and a position consistency score output by the correction model; Determining the name correction result based on the semantic similarity score, the name similarity score and the position consistency score; The correction model is trained based on sample text, sample erroneous names and sample candidate names in the sample text, sample semantic similarity results, sample name similarity results, and sample position consistency results.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the name correction method according to any one of claims 1 to 7 are implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the name correction method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Text error correction method and device, electronic equipment and storage medium

    CN111368918A

  • Text error correction method, related equipment and readable storage medium

    CN111553143A