Surname recognition method and device, and computer readable storage medium
By establishing a standard surname database and a multi-level hierarchical adaptation method, and combining features such as name separators, length, and weight, the problem of inaccurate surname recognition in existing technologies has been solved, achieving high-precision recognition of different types of names and improving the accuracy of personalized messages.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA MERCHANTS BANK
- Filing Date
- 2023-08-28
- Publication Date
- 2026-04-24
AI Technical Summary
Existing technologies are not very accurate in recognizing surnames, especially for ethnic minorities, rare surnames, and English names, which leads to personalized messages being delivered to customers incorrectly and causing complaints.
By establishing a standard surname database and combining multi-level hierarchical adaptation and cross-matching methods, surnames are extracted based on features such as name separators, length, and weight, adapting to different naming rules and name lengths to ensure accurate recognition.
It improves the accuracy of surname recognition, enabling the identification of common, rare, minority, and English surnames, reducing false leads and increasing customer satisfaction.
Smart Images

Figure CN117093704B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information processing technology, and in particular to a surname recognition method, apparatus, and computer-readable storage medium. Background Technology
[0002] In current digital marketing and other scenarios, many personalized messages use the customer's surname. If the surname is incorrect when the message reaches the customer, it can easily lead to customer complaints. However, currently, banks do not fully store customer surnames in their data and can only obtain them from the customer's given name.
[0003] Traditional surname extraction algorithms typically rely on surname dictionary matching for identification. These algorithms generally only recognize common surnames and those from the most common families, resulting in low accuracy. Furthermore, they are ineffective in recognizing ethnic minorities, rare surnames, and English names. Summary of the Invention
[0004] The main objective of this invention is to provide a surname recognition method, apparatus, and computer-readable storage medium, with the aim of improving the accuracy of surname recognition.
[0005] To achieve the above objectives, the present invention provides a surname identification method, the method comprising the following steps:
[0006] Get the name to be identified;
[0007] For the name to be identified, multi-level hierarchical adaptation is performed in combination with preset naming rules to extract the corresponding surname.
[0008] Optionally, after the step of obtaining the name to be identified, the method further includes:
[0009] Determine whether the name to be identified contains Chinese characters;
[0010] If Chinese characters are present, the process of extracting Chinese surnames will proceed, and the following steps will be performed: for the name to be identified, multi-level hierarchical adaptation will be performed in combination with preset naming rules to extract the corresponding surname;
[0011] If no Chinese characters are present but English characters are present, proceed to the English surname extraction process.
[0012] Optionally, the step of performing multi-level hierarchical adaptation on the name to be identified in accordance with preset naming rules to extract the corresponding surname includes:
[0013] For the name to be identified, multi-level hierarchical adaptation is performed in conjunction with a pre-established standard surname database to extract the corresponding surname. The standard surname database is constructed by collecting publicly available surname datasets and different naming rules.
[0014] Optionally, the step of performing multi-level hierarchical adaptation on the name to be identified in conjunction with a pre-established standard surname database to extract the corresponding surname includes:
[0015] Based on a pre-constructed set of name separators, determine whether there are separators in the name to be identified;
[0016] If a separator exists, obtain the array of names separated by the separator;
[0017] Based on the number of separators, the surname weight, and the number, length, and / or content of the name array, cross-matching is performed according to the naming rules and in conjunction with a pre-established standard surname database to extract the corresponding surname.
[0018] Optionally, the step of extracting the corresponding surname by cross-matching according to the number of delimiters, the surname weight, and the number, length, and / or content of the name array, in accordance with naming rules and combined with a pre-established standard surname database, includes:
[0019] If the number of delimiters is greater than or equal to 2, or if the number of names in the name array is greater than or equal to 3, then the last index of the name array will be the last name.
[0020] If the number of separators is equal to 1 and the number of name arrays is equal to 2, then determine whether one of the two text segments has a length greater than 1 character and the other text segment has a length greater than 2 characters.
[0021] If one of the two text segments has a length greater than 1 character and the other has a length greater than 2 characters, then the last index of the name array will be the surname.
[0022] If one of the two text segments is not longer than 1 character and the other is longer than 2 characters, then retrieve the text segment with index 0 in the name array;
[0023] Based on the pre-established standard surname database, the text field with index 0 in the name array is matched sequentially with the set of all compound surnames, the set of all single surnames, and the set of commonly used names of ethnic minorities in the standard surname database, taking into account the surname weight.
[0024] If the text field matches successfully, output the last name as the matched text field; otherwise, output the last index of the text field in the name array as the last name.
[0025] Optionally, the method further includes:
[0026] If the separator is equal to 1 and the number of names in the array is equal to 1, it is treated as if there is no separator.
[0027] Optionally, after the step of determining whether a separator exists in the name to be identified, the method further includes:
[0028] If no separator is found, the length of the name to be identified is determined.
[0029] If the length of the given name is equal to 1 character, then the surname is the character stated above;
[0030] If the length of a name is equal to 2 characters, then the surname is the first character of the name;
[0031] If the name is three or more characters long, then the corresponding surname is extracted by performing multi-level hierarchical adaptation based on the standard surname database.
[0032] Optionally, if the name length is greater than or equal to 3 characters, the steps for extracting the corresponding surname by performing multi-level hierarchical adaptation in conjunction with the standard surname database include:
[0033] If the name is 3 characters long, then the first two characters of the name will be matched with the set of commonly used compound surnames in the standard surname database;
[0034] If a match is found, the surname will be the first two characters of the given name; otherwise...
[0035] Match the first character of the surname with the set of commonly used single surnames in the standard surname database;
[0036] If a match is found, the surname is the first character of the given name; otherwise...
[0037] Match the first two characters of the given name with the entire set of compound surnames;
[0038] If a match is found, the surname is the first two characters of the given name; otherwise, the surname is the first character of the given name.
[0039] Optionally, the method further includes:
[0040] If the name is 4 or more characters long, then the first two characters of the name will be matched with the set of all compound surnames.
[0041] If a match is found, the surname will be the first two characters of the given name; otherwise...
[0042] Match the first two characters and the last two characters of the name with the set of commonly used ethnic minority names in the standard surname database;
[0043] If a match is found, it indicates that there is no surname, and the given name is output; otherwise, the surname is the first character of the given name.
[0044] Optionally, the step of proceeding to the English surname extraction process if no Chinese characters exist but English characters do not include:
[0045] If there are no Chinese characters but there are English characters, then the existence of a separator in the name to be identified is determined based on the pre-constructed set of name separators.
[0046] If a separator exists, the last name is the last index of the name array separated by that separator.
[0047] If no separator is present, determine whether the English characters are all uppercase or all lowercase.
[0048] If the English characters are all uppercase, then the surname is the last uppercase character in the given name and the character range following it;
[0049] If the English characters are all lowercase, then the surname is in full characters.
[0050] Optionally, after the step of determining whether a separator exists in the name to be identified, the method further includes:
[0051] If multiple delimiters exist, select several pre-defined high-priority delimiters as the actual delimiters, and convert the remaining low-priority delimiters into null characters.
[0052] Optionally, the step of obtaining the name to be identified may include:
[0053] Collect publicly available names to obtain a surname dataset;
[0054] A standard surname database was constructed based on the aforementioned surname dataset and different naming rules;
[0055] The population size of each surname is checked, and commonly used single surnames are selected from the set of single surnames, and commonly used compound surnames are selected from the set of compound surnames, in order to adjust the weight of surnames when single and compound surnames overlap.
[0056] This invention also proposes a surname recognition device, which includes a memory, a processor, and a surname recognition program stored in the memory and executable on the processor. When the surname recognition program is executed by the processor, it implements the surname recognition method as described above.
[0057] This invention also proposes a computer-readable storage medium storing a surname recognition program, which, when executed by a processor, implements the surname recognition method as described above.
[0058] The surname recognition method, apparatus, and computer-readable storage medium proposed in this invention obtain the name to be identified; for the name to be identified, multi-level hierarchical adaptation is performed in combination with preset naming rules to extract the corresponding surname. Compared with the prior art, the surname recognition method proposed in this invention, through a multi-level hierarchical adaptation method, performs cross-matching based on a standard surname database under different naming rules, name lengths, and other objective conditions, ensuring the accuracy of the recognition algorithm. Specifically, by fusing the standard surname database with the multi-level hierarchical adaptation method, surnames are extracted from feature dimensions such as naming rules, name length, surname weight, and separators. While ensuring high accuracy of the algorithm, the extracted results are more consistent with the actual judgment of most people, and it still has the ability to extract rare surnames, minority names, and English names. Attached Figure Description
[0059] Figure 1 This is a schematic diagram of the functional modules of the terminal device to which the surname recognition device of the present invention belongs;
[0060] Figure 2 This is a flowchart illustrating the first embodiment of the surname recognition method of the present invention;
[0061] Figure 3 This is a schematic diagram of the overall process of an embodiment of the surname recognition method of the present invention;
[0062] Figure 4 This is a schematic diagram of the Chinese surname extraction process in an embodiment of the surname recognition method of the present invention;
[0063] Figure 5 This is a schematic diagram of the English surname extraction process in an embodiment of the surname recognition method of the present invention.
[0064] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0065] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0066] The main solution of this invention is a high-precision surname recognition algorithm to ensure accurate and universal identification of surnames. A standard surname database is established by collecting publicly available name datasets and different naming rules. Multi-level hierarchical adaptation is performed based on factors such as separators, name length, and surname weight. Furthermore, by examining the population size of each surname, commonly used single and double surnames are selected from the entire set of single and double surnames to adjust the weighting of surnames when single and double surnames overlap, making the algorithm's output universally applicable. Compared with traditional simple surname extraction methods, this invention has higher accuracy and can accurately identify surnames in rare names, minority names, and English names.
[0067] The embodiments of this invention take into account that: Currently, traditional surname extraction algorithms generally identify surnames by matching them with a surname dictionary. This algorithm can generally only identify common surnames and the like, with low accuracy, and it cannot effectively identify ethnic minorities, rare surnames, or English names.
[0068] Based on this, embodiments of the present invention provide a solution that can improve the accuracy of surname recognition and accurately identify surnames of rare names, ethnic minority names, and English names.
[0069] Specifically, refer to Figure 1 , Figure 1 This is a schematic diagram of the functional modules of the terminal device to which the surname recognition device of the present invention belongs. The surname recognition device can be an independent device, and can be implemented on the terminal device or system in the form of hardware or software. The terminal device can be a smart mobile terminal such as a mobile phone or tablet computer, or a network device such as a server.
[0070] In this embodiment, the terminal device to which the surname recognition device belongs includes at least an output module 110, a processor 120, a memory 130, and a communication module 140.
[0071] The memory 130 stores the operating system and surname recognition program; the output module 110 can be a display screen, speaker, etc. The communication module 140 can include a WIFI module, a mobile communication module, and a Bluetooth module, etc., and communicates with external devices or servers through the communication module 140.
[0072] In one embodiment, when the surname recognition program in memory 130 is executed by the processor, it performs the following steps:
[0073] Get the name to be identified;
[0074] For the name to be identified, multi-level hierarchical adaptation is performed in combination with preset naming rules to extract the corresponding surname.
[0075] Furthermore, when the surname recognition program in memory 130 is executed by the processor, it also performs the following steps:
[0076] Determine whether the name to be identified contains Chinese characters;
[0077] If Chinese characters are present, the process of extracting Chinese surnames will proceed, and the following steps will be performed: for the name to be identified, multi-level hierarchical adaptation will be performed in combination with preset naming rules to extract the corresponding surname;
[0078] If no Chinese characters are present but English characters are present, proceed to the English surname extraction process.
[0079] Furthermore, when the surname recognition program in memory 130 is executed by the processor, it also performs the following steps:
[0080] For the name to be identified, multi-level hierarchical adaptation is performed in conjunction with a pre-established standard surname database to extract the corresponding surname. The standard surname database is constructed by collecting publicly available surname datasets and different naming rules.
[0081] Furthermore, when the surname recognition program in memory 130 is executed by the processor, it also performs the following steps:
[0082] Based on a pre-constructed set of name separators, determine whether there are separators in the name to be identified;
[0083] If a separator exists, obtain the array of names separated by the separator;
[0084] Based on the number of separators, the surname weight, and the number, length, and / or content of the name array, cross-matching is performed according to the naming rules and in conjunction with a pre-established standard surname database to extract the corresponding surname.
[0085] Furthermore, when the surname recognition program in memory 130 is executed by the processor, it also performs the following steps:
[0086] If the number of delimiters is greater than or equal to 2, or if the number of names in the name array is greater than or equal to 3, then the last index of the name array will be the last name.
[0087] If the number of separators is equal to 1 and the number of name arrays is equal to 2, then determine whether one of the two text segments has a length greater than 1 character and the other text segment has a length greater than 2 characters.
[0088] If one of the two text segments has a length greater than 1 character and the other has a length greater than 2 characters, then the last index of the name array will be the surname.
[0089] If one of the two text segments is not longer than 1 character and the other is longer than 2 characters, then retrieve the text segment with index 0 in the name array;
[0090] Based on the pre-established standard surname database, the text field with index 0 in the name array is matched sequentially with the set of all compound surnames, the set of all single surnames, and the set of commonly used names of ethnic minorities in the standard surname database, taking into account the surname weight.
[0091] If the text field matches successfully, output the last name as the matched text field; otherwise, output the last index of the text field in the name array as the last name.
[0092] Furthermore, when the surname recognition program in memory 130 is executed by the processor, it also performs the following steps:
[0093] If the separator is equal to 1 and the number of names in the array is equal to 1, it is treated as if there is no separator.
[0094] Furthermore, when the surname recognition program in memory 130 is executed by the processor, it also performs the following steps:
[0095] If no separator is found, the length of the name to be identified is determined.
[0096] If the length of the given name is equal to 1 character, then the surname is the character stated above;
[0097] If the length of a name is equal to 2 characters, then the surname is the first character of the name;
[0098] If the name is three or more characters long, then the corresponding surname is extracted by performing multi-level hierarchical adaptation based on the standard surname database.
[0099] Furthermore, when the surname recognition program in memory 130 is executed by the processor, it also performs the following steps:
[0100] If the name is 3 characters long, then the first two characters of the name will be matched with the set of commonly used compound surnames in the standard surname database;
[0101] If a match is found, the surname will be the first two characters of the given name; otherwise...
[0102] Match the first character of the surname with the set of commonly used single surnames in the standard surname database;
[0103] If a match is found, the surname is the first character of the given name; otherwise...
[0104] Match the first two characters of the given name with the entire set of compound surnames;
[0105] If a match is found, the surname is the first two characters of the given name; otherwise, the surname is the first character of the given name.
[0106] Furthermore, when the surname recognition program in memory 130 is executed by the processor, it also performs the following steps:
[0107] If the name is 4 or more characters long, then the first two characters of the name will be matched with the set of all compound surnames.
[0108] If a match is found, the surname will be the first two characters of the given name; otherwise...
[0109] Match the first two characters and the last two characters of the name with the set of commonly used ethnic minority names in the standard surname database;
[0110] If a match is found, it indicates that there is no surname, and the given name is output; otherwise, the surname is the first character of the given name.
[0111] Furthermore, when the surname recognition program in memory 130 is executed by the processor, it also performs the following steps:
[0112] If there are no Chinese characters but there are English characters, then the existence of a separator in the name to be identified is determined based on the pre-constructed set of name separators.
[0113] If a separator exists, the last name is the last index of the name array separated by that separator.
[0114] If no separator is present, determine whether the English characters are all uppercase or all lowercase.
[0115] If the English characters are all uppercase, then the surname is the last uppercase character in the given name and the character range following it;
[0116] If the English characters are all lowercase, then the surname is in full characters.
[0117] Furthermore, when the surname recognition program in memory 130 is executed by the processor, it also performs the following steps:
[0118] If multiple delimiters exist, select several pre-defined high-priority delimiters as the actual delimiters, and convert the remaining low-priority delimiters into null characters.
[0119] Furthermore, when the surname recognition program in memory 130 is executed by the processor, it also performs the following steps:
[0120] Collect publicly available names to obtain a surname dataset;
[0121] A standard surname database was constructed based on the aforementioned surname dataset and different naming rules;
[0122] The population size of each surname is checked, and commonly used single surnames are selected from the set of single surnames, and commonly used compound surnames are selected from the set of compound surnames, in order to adjust the weight of surnames when single and compound surnames overlap.
[0123] This embodiment, through the above-described scheme, specifically obtains the name to be identified; for the name to be identified, it performs multi-level hierarchical adaptation based on preset naming rules to extract the corresponding surname. Compared with the prior art, the surname recognition method proposed in this invention, through a multi-level hierarchical adaptation method, performs cross-matching based on a standard surname database under different naming rules, name lengths, and other objective conditions, ensuring the accuracy of the recognition algorithm. Specifically, by fusing the standard surname database with the multi-level hierarchical adaptation method, surnames are extracted from feature dimensions such as naming rules, name length, surname weight, and separators. While ensuring high accuracy of the algorithm, the extracted results are more consistent with the actual judgment of most people, and it still has the ability to extract rare surnames, minority names, and English names.
[0124] Based on, but not limited to, the terminal device architecture described above, embodiments of the method of the present invention are proposed.
[0125] Reference Figure 2 , Figure 2 This is a flowchart illustrating the first embodiment of the surname recognition method of the present invention.
[0126] like Figure 2 As shown in the embodiment of the present invention, a surname recognition method is proposed. This method can be applied to scenarios such as digital marketing, for example, the digital marketing scenario in the banking industry.
[0127] This embodiment takes into account that in scenarios such as digital marketing, many personalized messages use customers' surnames. If the surname is incorrect when the message reaches the customer, it can easily lead to customer complaints. Currently, banks do not fully store customer surnames in their data and can only obtain them from the customer's given name, resulting in low accuracy in surname recognition. The solution of this embodiment has higher accuracy, not only recognizing common names but also accurately identifying rare names, minority names, and English surnames.
[0128] Specifically, the method includes the following steps:
[0129] Step S101: Obtain the name to be identified;
[0130] The name to be identified can be either a Chinese name or an English name. Chinese names can include common names, as well as those from ethnic minorities or rare surnames.
[0131] In this embodiment, not only can common Chinese names be identified, but also ethnic minorities, rare surnames and English names can be effectively identified.
[0132] Step S102: For the name to be identified, perform multi-level hierarchical adaptation in combination with preset naming rules to extract the corresponding surname.
[0133] Among them, the method of multi-level hierarchical adaptation combined with preset naming rules can be achieved by merging the standard surname database with the multi-level hierarchical adaptation method for matching.
[0134] The standard surname database is constructed by collecting publicly available surname datasets and different naming rules.
[0135] The standard surname database addresses issues such as overlapping single and compound surnames, and the lack of surnames or rare surnames among certain ethnic groups. The surname data is compiled from publicly available online information after testing and verification.
[0136] The standard surname database can be composed of five parts: common single surnames, common compound surnames, all single surnames, all compound surnames, and common names of ethnic minorities.
[0137] Specifically, by examining the population size of each surname, commonly used single and double surnames are selected from the entire set of single and double surnames. This adjusts the weighting of surname judgment when single and double surnames overlap, making the algorithm's output more universal and consistent with the judgments of the majority. Simultaneously, the algorithm considers the case where some ethnic groups do not have surnames based on the dataset of commonly used minority names, minimizing erroneous outputs.
[0138] Multi-level hierarchical adaptation method: This method is used to handle issues such as the presence of separators in names and variable lengths of Chinese names. Multi-level hierarchical adaptation is a process of cross-matching based on a standard surname database under objective conditions such as different naming rules and name lengths.
[0139] Typically, separators appear in the names of ethnic minorities and in Chinese and English names. By referring to the standard name separators and common separators in the database, a priority name separator set is established. In this embodiment, the recognition algorithm identifies the separators through the name separator set, segments the name, and then matches and outputs the results according to the naming rules based on the number of segments, segment length, and content.
[0140] As one implementation method, a standard surname database and a multi-level hierarchical adaptation method can be used to combine matching methods to extract surnames from feature dimensions such as naming rules, name length, surname weight, and separators. While ensuring high accuracy of the algorithm, the extraction results are more in line with the actual judgment of most people, and the extraction ability is still available for rare surnames, ethnic minority names, and English names.
[0141] Specifically, such as Figure 3 As shown, after obtaining the name to be identified, it may also include:
[0142] Determine whether the name to be identified contains Chinese characters.
[0143] One method is to use regular expressions to match the input name to determine whether the input contains Chinese characters.
[0144] If Chinese characters are present, the process of extracting Chinese surnames will proceed, and the following steps will be performed: for the name to be identified, multi-level hierarchical adaptation will be performed in combination with preset naming rules to extract the corresponding surname;
[0145] If no Chinese characters are present but English characters are present, proceed to the English surname extraction process.
[0146] The process for extracting Chinese surnames can be found by referring to... Figure 4 As shown, the process for extracting English surnames can be found by referring to [the example provided]. Figure 5 As shown.
[0147] More specifically, such as Figure 4 As shown, the process for extracting Chinese surnames is as follows:
[0148] As one implementation method, the name to be identified can be subjected to multi-level hierarchical adaptation in combination with preset naming rules to extract the corresponding surname.
[0149] In practice, the name to be identified can be combined with a pre-established standard surname database for multi-level hierarchical adaptation to extract the corresponding surname.
[0150] The step of extracting the corresponding surname by performing multi-level hierarchical adaptation on the name to be identified in conjunction with a pre-established standard surname database includes:
[0151] Based on a pre-constructed set of name separators, determine whether there are separators in the name to be identified.
[0152] The following details the two scenarios: the presence of separators in the name to be identified and the absence of separators.
[0153] First scenario:
[0154] If a separator exists, obtain the array of names separated by the separator;
[0155] Based on the number of separators, the surname weight, and the number, length, and / or content of the name array, cross-matching is performed according to naming rules and in conjunction with a pre-established standard surname database to extract the corresponding surname.
[0156] If multiple delimiters exist, select several preset high-priority delimiters as actual delimiters and perform the following steps: obtain the name array obtained by the actual delimiters, and perform cross-matching according to the number, length and / or content of the name array, in accordance with the naming rules and in combination with the pre-established standard surname database, to extract the corresponding surname.
[0157] Further, the step of extracting the corresponding surname by cross-matching according to the number of delimiters, the surname weight, and the number, length, and / or content of the name array, based on naming rules and in conjunction with a pre-established standard surname database, includes:
[0158] If the number of delimiters is greater than or equal to 2, or if the number of names in the name array is greater than or equal to 3, then the last index of the name array will be the last name.
[0159] If the number of separators is equal to 1 and the number of name arrays is equal to 2, then determine whether one of the two text segments has a length greater than 1 character and the other text segment has a length greater than 2 characters.
[0160] If one of the two text segments has a length greater than 1 character and the other has a length greater than 2 characters, then the last index of the name array will be the surname.
[0161] If one of the two text segments is not longer than 1 character and the other is longer than 2 characters, then retrieve the text segment with index 0 in the name array;
[0162] Based on the pre-established standard surname database, the text field with index 0 in the name array is matched sequentially with the set of all compound surnames, the set of all single surnames, and the set of commonly used names of ethnic minorities in the standard surname database, taking into account the surname weight.
[0163] If the text field matches successfully, output the last name as the matched text field; otherwise, output the last index of the text field in the name array as the last name.
[0164] Furthermore, if the separator is equal to 1 and the number of names in the array is equal to 1, it is treated as if there is no separator.
[0165] The second scenario:
[0166] If no separator is present, then determine the length of the name to be identified;
[0167] If the length of the given name is equal to 1 character, then the surname is the character stated above;
[0168] If the length of a name is equal to 2 characters, then the surname is the first character of the name;
[0169] If the name is three or more characters long, then the corresponding surname is extracted by performing multi-level hierarchical adaptation based on the standard surname database.
[0170] If the name length is greater than or equal to 3 characters, the step of extracting the corresponding surname by performing multi-level hierarchical adaptation based on the standard surname database may include:
[0171] If the name is 3 characters long, then the first two characters of the name will be matched with the set of commonly used compound surnames in the standard surname database;
[0172] If a match is found, the surname will be the first two characters of the given name; otherwise...
[0173] Match the first character of the surname with the set of commonly used single surnames in the standard surname database;
[0174] If a match is found, the surname is the first character of the given name; otherwise...
[0175] Match the first two characters of the given name with the entire set of compound surnames;
[0176] If a match is found, the surname is the first two characters of the given name; otherwise, the surname is the first character of the given name.
[0177] Furthermore, if the name is four characters or longer, the first two characters of the name are matched with the entire set of compound surnames.
[0178] If a match is found, the surname will be the first two characters of the given name; otherwise...
[0179] Match the first two characters and the last two characters of the name with the set of commonly used ethnic minority names in the standard surname database;
[0180] If a match is found, it indicates that there is no surname, and the given name is output; otherwise, the surname is the first character of the given name.
[0181] Furthermore, if the name to be identified does not contain Chinese characters but contains English characters, then the process of extracting the English surname will begin.
[0182] The following combination Figure 3 The detailed steps for extracting Chinese surnames in this embodiment are explained below:
[0183] 1) Based on the delimiter set, determine whether a delimiter exists in the name. If multiple delimiters exist, select the one with the higher priority as the actual delimiter, and convert the delimiters with lower priority to empty characters. If a delimiter exists, proceed to step 2; otherwise, proceed to step 3.
[0184] 2) After splitting, we obtain an array of names. We then process the names according to their length:
[0185] 2.1) If the array length is greater than or equal to 3, then the last index of the name array will be the last name.
[0186] 2.2) If the array length is equal to 2, then further judgment is needed, proceeding to step 2.2.1:
[0187] 2.2.1) If one of the two text segments has a length greater than 1 and the other has a length greater than 2, then output the last index of the name array as the surname; otherwise, proceed to step 2.2.2.
[0188] 2.2.2) Determine the text field with index 0 in the name array and match it sequentially with the set of all compound surnames, the set of all single surnames, and the set of commonly used names of ethnic minorities. If the text field matches successfully, output the matched surname as the algorithm result; otherwise, proceed to step 2.2.3.
[0189] 2.2.3) Output the last index of the name array, which is the surname.
[0190] 2.3) If the length is equal to 1, then process it as if there were no separators and proceed to step 3;
[0191] 3) This step involves processing names according to their length:
[0192] 3.1) When the length of a name is equal to 1, the surname is this character;
[0193] 3.2) When the length of a name is equal to 2, the surname is the first character of the given name;
[0194] 3.3) When the name length is equal to 3, matching is performed sequentially:
[0195] 3.3.1) Match the first two characters of the given name with a set of common compound surnames. If a match is found, the surname is the first two characters of the given name; otherwise, proceed to step 3.3.2.
[0196] 3.3.2) Match the first character of the given name with a set of common single-character surnames. If a match is found, the surname is the first character of the given name; otherwise, proceed to step 3.3.3.
[0197] 3.3.3) Match the first two characters of the given name with the set of all compound surnames. If a match is found, the surname is the first two characters of the given name; otherwise, proceed to step 3.3.4.
[0198] 3.3.4) The surname is the first character of the given name;
[0199] 3.4) When the name length is greater than or equal to 4, matching will be performed sequentially:
[0200] 3.4.1) Match the first two characters of the given name with the set of all compound surnames. If a match is found, the surname is the first two characters of the given name; otherwise, proceed to 3.4.2.
[0201] 3.4.2) Match the first two characters and last two characters of the given name to a set of commonly used minority names. If a match is found, there is no surname, and the algorithm outputs the given name. Otherwise, proceed to step 3.4.3;
[0202] 3.4.3) The surname is the first character of the given name.
[0203] like Figure 5 As shown, the specific processing flow for extracting English surnames is as follows:
[0204] If there are no Chinese characters but there are English characters, then the existence of a separator in the name to be identified is determined based on the pre-constructed set of name separators.
[0205] If a separator exists, the last name is the last index of the name array separated by that separator.
[0206] If multiple delimiters exist, several pre-defined high-priority delimiters are selected as the actual delimiters, and the remaining low-priority delimiters are converted to null characters.
[0207] If no separator is present, determine whether the English characters are all uppercase or all lowercase.
[0208] If the English characters are all uppercase, then the surname is the last uppercase character in the given name and the character range following it;
[0209] If the English characters are all lowercase, then the surname is in full characters.
[0210] like Figure 5 The detailed process for extracting English surnames is explained below:
[0211] 1) Based on the delimiter set, determine whether a delimiter exists in the name. If multiple delimiters exist, select the one with the higher priority as the actual delimiter, and convert the delimiters with lower priority to empty characters. If a delimiter exists, proceed to step 2; otherwise, proceed to step 3.
[0212] 2) The surname is the character field with the last index in the name array;
[0213] 3) The surname is the last capitalized character in the given name and the character range that follows.
[0214] The high-precision surname extraction algorithm proposed in this invention combines a standard surname database with a multi-level hierarchical adaptation method to extract surnames based on features such as naming rules, name length, surname weight, and separators. While maintaining high accuracy, the algorithm ensures that the extracted results better reflect the actual judgments of most people, and it also retains the ability to extract rare surnames, minority names, and English names.
[0215] Furthermore, as one implementation, the step of obtaining the name to be identified further includes:
[0216] Collect publicly available names to obtain a surname dataset;
[0217] A standard surname database was constructed based on the aforementioned surname dataset and different naming rules;
[0218] The population size of each surname is checked, and commonly used single surnames are selected from the set of single surnames, and commonly used compound surnames are selected from the set of compound surnames, in order to adjust the weight of surnames when single and compound surnames overlap.
[0219] This embodiment, through the above-described scheme, specifically obtains the name to be identified; for the name to be identified, it performs multi-level hierarchical adaptation based on preset naming rules to extract the corresponding surname. Compared with the prior art, the surname recognition method proposed in this invention, through a multi-level hierarchical adaptation method, performs cross-matching based on a standard surname database under different naming rules, name lengths, and other objective conditions, ensuring the accuracy of the recognition algorithm. Specifically, by fusing the standard surname database with the multi-level hierarchical adaptation method, surnames are extracted from feature dimensions such as naming rules, name length, surname weight, and separators. While ensuring high accuracy of the algorithm, the extracted results are more consistent with the actual judgment of most people, and it still has the ability to extract rare surnames, minority names, and English names.
[0220] Furthermore, this invention also proposes a surname recognition device, which includes: a memory, a processor, and a surname recognition program stored in the memory and executable on the processor. When the surname recognition program is executed by the processor, it implements the surname recognition method as described above.
[0221] The implementation principle of the surname recognition device of the present invention can be referred to the above embodiments, and will not be repeated here.
[0222] Furthermore, embodiments of the present invention also propose a computer-readable storage medium storing a surname recognition program, which, when executed by a processor, implements the surname recognition method as described above.
[0223] The principle of surname recognition in this invention can be referred to in the above embodiments, and will not be repeated here.
[0224] Compared with existing technologies, this invention selects commonly used single and double surnames from the entire set of single and double surnames by checking the population of each surname, and adjusts the weight of surname judgment when single and double surnames overlap. This makes the output of this algorithm universal; through a multi-level hierarchical adaptation method, cross-matching is performed based on a standard surname database under different naming rules, name lengths and other objective conditions to ensure the correctness of the algorithm.
[0225] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0226] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0227] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a recommendation effect evaluation system (which may be a mobile phone, computer, server, controlled terminal, or network device, etc.) to execute the methods of each embodiment of the present invention.
[0228] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.
Claims
1. A surname identification method, characterized in that, The method includes the following steps: Get the name to be identified; For the name to be identified, multi-level hierarchical adaptation is performed based on preset naming rules to extract the corresponding surname, specifically including: For the name to be identified, multi-level hierarchical adaptation is performed in conjunction with a pre-established standard surname database to extract the corresponding surname. The standard surname database is constructed by collecting publicly available surname datasets and different naming rules. The step of performing multi-level hierarchical adaptation on the name to be identified, combined with a pre-established standard surname database, to extract the corresponding surname includes: Based on a pre-constructed set of name separators, determine whether there are separators in the name to be identified; If a separator exists, obtain the array of names separated by the separator; Based on the number of separators, the surname weight, and the number, length, and / or content of the name array, cross-matching is performed according to naming rules and in conjunction with a pre-established standard surname database to extract the corresponding surname.
2. The method according to claim 1, characterized in that, Following the step of obtaining the name to be identified, the following is also included: Determine whether the name to be identified contains Chinese characters; If Chinese characters are present, the process of extracting Chinese surnames will proceed, and the following steps will be performed: for the name to be identified, multi-level hierarchical adaptation will be performed in combination with preset naming rules to extract the corresponding surname; If no Chinese characters are present but English characters are present, proceed to the English surname extraction process.
3. The method according to claim 1, characterized in that, The step of extracting the corresponding surname by cross-matching according to the number of delimiters, the surname weight, and the number, length, and / or content of the name array, based on naming rules and in conjunction with a pre-established standard surname database, includes: If the number of delimiters is greater than or equal to 2, or if the number of names in the name array is greater than or equal to 3, then the last index of the name array will be the last name. If the number of separators is equal to 1 and the number of name arrays is equal to 2, then determine whether one of the two text segments has a length greater than 1 character and the other text segment has a length greater than 2 characters. If one of the two text segments has a length greater than 1 character and the other has a length greater than 2 characters, then the last index of the name array will be the surname. If one of the two text segments is not longer than 1 character and the other is longer than 2 characters, then retrieve the text segment with index 0 in the name array; Based on the pre-established standard surname database, the text field with index 0 in the name array is matched sequentially with the set of all compound surnames, the set of all single surnames, and the set of commonly used names of ethnic minorities in the standard surname database, taking into account the surname weight. If the text field matches successfully, output the last name as the matched text field; otherwise, output the last index of the text field in the name array as the last name.
4. The method according to claim 3, characterized in that, The method further includes: If the separator is equal to 1 and the number of names in the array is equal to 1, it is treated as if there is no separator.
5. The method according to claim 1, characterized in that, Following the step of determining whether a separator exists in the name to be identified, the method further includes: If no separator is found, the length of the name to be identified is determined. If the length of the given name is equal to 1 character, then the surname is the character stated above; If the length of a name is equal to 2 characters, then the surname is the first character of the name; If the name is three or more characters long, then the corresponding surname is extracted by performing multi-level hierarchical adaptation based on the standard surname database.
6. The method according to claim 5, characterized in that, If the name length is greater than or equal to 3 characters, the steps to extract the corresponding surname by performing multi-level hierarchical adaptation based on the standard surname database include: If the name is 3 characters long, then the first two characters of the name will be matched with the set of commonly used compound surnames in the standard surname database; If a match is found, the surname will be the first two characters of the given name; otherwise... Match the first character of the surname with the set of commonly used single surnames in the standard surname database; If a match is found, the surname is the first character of the given name; otherwise... Match the first two characters of the given name with the entire set of compound surnames; If a match is found, the surname is the first two characters of the given name; otherwise, the surname is the first character of the given name.
7. The method according to claim 5, characterized in that, The method further includes: If the name is 4 or more characters long, then the first two characters of the name will be matched with the set of all compound surnames. If a match is found, the surname will be the first two characters of the given name; otherwise... Match the first two characters and the last two characters of the name with the set of commonly used ethnic minority names in the standard surname database; If a match is found, it indicates that there is no surname, and the given name is output; otherwise, the surname is the first character of the given name.
8. The method according to claim 2, characterized in that, The steps for proceeding to the English surname extraction process if no Chinese characters exist but English characters do include: If there are no Chinese characters but there are English characters, then the existence of a separator in the name to be identified is determined based on the pre-constructed set of name separators. If a separator exists, the last name is the last index of the name array separated by that separator. If no separator is present, determine whether the English characters are all uppercase or all lowercase. If the English characters are all uppercase, then the surname is the last uppercase character in the given name and the character range following it; If the English characters are all lowercase, then the surname is in full characters.
9. The method according to claim 1 or 8, characterized in that, Following the step of determining whether a separator exists in the name to be identified, the method further includes: If multiple delimiters exist, select several pre-defined high-priority delimiters as the actual delimiters, and convert the remaining low-priority delimiters into null characters.
10. The method according to claim 1, characterized in that, The step of obtaining the name to be identified includes the following prior to: Collect publicly available names to obtain a surname dataset; A standard surname database was constructed based on the aforementioned surname dataset and different naming rules; The population size of each surname is checked, and commonly used single surnames are selected from the set of single surnames, and commonly used compound surnames are selected from the set of compound surnames, in order to adjust the weight of surnames when single and compound surnames overlap.
11. A surname identification device, characterized in that, The apparatus includes: a memory, a processor, and a surname recognition program stored in the memory and executable on the processor, wherein the surname recognition program, when executed by the processor, implements the surname recognition method as described in any one of claims 1 to 10.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a surname recognition program, which, when executed by a processor, implements the surname recognition method as described in any one of claims 1 to 10.
Citation Information
Patent Citations
Chinese surname recognition method and device, as well as server
CN105988989A
Name comparison method and device
CN110609931A