An address element correction method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202311517994.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-14
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2043-11-14
AI Technical Summary
[0005]本申请提供了一种地址要素纠正方法、装置、电子设备及存储介质,用以解决现有技术中地址要素纠正准确性较差的问题
[0020]本申请中,获取到待纠正的地址并确定待纠正的地址的各个第一地址要素之后,首先基于地址文本识别模型对各个第一地址要素进行纠正,得到各个第二地址要素;然后将预先构建的多层级地址标准化库和各个第二地址要素进行匹配,根据匹配结果对各个第二地址要素进行纠正,得到地址要素纠正后的目标地址。本申请基于地址文本识别模型实现第一次纠正,基于预先构建的多层级地址标准化库实现第二次纠正,经过两次纠正,得到目标地址。提高了地址要素纠正的准确性。
Smart Images

Figure CN117556810B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to an address element correction method, apparatus, electronic device, and storage medium. Background Technology
[0002] The low quality of merchant addresses poses significant challenges to the company's merchant operations and management. For example, it makes it difficult to collaborate with commercial banks on targeted marketing campaigns, to effectively verify the authenticity of merchant onboarding information, and to accurately count merchants according to administrative divisions such as provinces, cities, and districts. In particular, the lack of standardized merchant address information and diverse wording results in inconsistent data quality, manifested in the following ways:
[0003] (1) Redundant address elements, with duplicate information; (2) Ambiguous address elements, with missing or incorrect address elements, abbreviations, traditional characters, etc. causing ambiguity in address elements; (3) Incorrect spatial constraint relationships of address elements, etc.
[0004] To address the issue of inconsistent merchant address data quality, existing technologies propose address completion methods based on full-text indexing. These methods first establish a standard address database, then use the segmented results of the addresses to be matched as search criteria for address matching, utilizing address elements from the standard address database to complete and correct addresses. However, existing technologies suffer from a problem: they only consider keyword matching, leading to significant mismatches when dealing with abbreviated or shortened address elements, resulting in poor accuracy in address element correction. Summary of the Invention
[0005] This application provides an address element correction method, apparatus, electronic device, and storage medium to solve the problem of poor address element correction accuracy in the prior art.
[0006] In a first aspect, this application provides an address element correction method, the method comprising:
[0007] Obtain the address to be corrected, and determine each first address element of the address to be corrected;
[0008] Each of the first address elements is input into the address text recognition model, and each of the first address elements is corrected based on the address text recognition model to obtain each of the second address elements;
[0009] The pre-built multi-level address standardization library is matched with each of the second address elements, and the second address elements are corrected according to the matching results to obtain the target address after address element correction.
[0010] Secondly, this application provides an address element correction device, the device comprising:
[0011] A determination module is used to obtain the address to be corrected and determine each first address element of the address to be corrected;
[0012] The first correction module is used to input the first address elements into the address text recognition model, and correct the first address elements based on the address text recognition model to obtain the second address elements.
[0013] The second correction module is used to match the pre-built multi-level address standardization library with each of the second address elements, and correct each of the second address elements according to the matching results to obtain the target address after address element correction.
[0014] Thirdly, this application provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;
[0015] Memory, used to store computer programs;
[0016] A processor, when executing a program stored in memory, implements the steps of the method described.
[0017] Fourthly, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the method described.
[0018] This application provides an address element correction method, apparatus, electronic device, and storage medium. The method includes: obtaining an address to be corrected and determining each first address element of the address to be corrected; inputting each first address element into an address text recognition model and correcting each first address element based on the address text recognition model to obtain each second address element; matching a pre-constructed multi-level address standardization library with each second address element and correcting each second address element according to the matching result.
[0019] The above technical solution has the following advantages or beneficial effects:
[0020] In this application, after obtaining the address to be corrected and determining its various first address elements, the first address elements are first corrected based on an address text recognition model to obtain various second address elements. Then, a pre-built multi-level address standardization library is matched with each second address element, and the second address elements are corrected according to the matching results to obtain the target address after address element correction. This application achieves the first correction based on an address text recognition model and the second correction based on a pre-built multi-level address standardization library. After two corrections, the target address is obtained. This improves the accuracy of address element correction. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 A schematic diagram illustrating the address element correction process provided for this application;
[0023] Figure 2 A schematic diagram illustrating the training process of the address text recognition model provided in this application;
[0024] Figure 3 A schematic diagram illustrating the training process of the address text recognition model provided in this application;
[0025] Figure 4 A schematic diagram illustrating the process of determining the various first address elements of the address to be corrected, as provided in this application;
[0026] Figure 5 A schematic diagram illustrating the process of correcting each second address element provided in this application;
[0027] Figure 6 Address element correction architecture diagram provided for this application;
[0028] Figure 7 A schematic diagram of the address element correction device provided in this application;
[0029] Figure 8 A schematic diagram of the electronic device structure provided in this application. Detailed Implementation
[0030] To make the objectives and implementation methods of this application clearer, the exemplary implementation methods of this application will be clearly and completely described below with reference to the accompanying drawings of the exemplary embodiments of this application. Obviously, the exemplary embodiments described are only some embodiments of this application, and not all embodiments.
[0031] It should be noted that the brief descriptions of terms in this application are only for the convenience of understanding the embodiments described below, and are not intended to limit the embodiments of this application. Unless otherwise stated, these terms should be understood in their ordinary and common meaning.
[0032] The terms "first," "second," "third," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar or related objects or entities, and do not necessarily imply a specific order or sequence, unless otherwise specified. It should be understood that such terms are interchangeable where appropriate.
[0033] The terms “comprising” and “having”, and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device that includes a range of components is not necessarily limited to all of the components that are clearly listed, but may include other components that are not clearly listed or that are inherent to such product or device.
[0034] The term "module" refers to any known or subsequently developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and / or software code that is capable of performing the functions associated with that element.
[0035] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
[0036] For ease of explanation, the above description has been provided in conjunction with specific embodiments. However, the above exemplary discussion is not intended to be exhaustive or to limit the embodiments to the specific forms disclosed above. Various modifications and variations can be obtained based on the above teachings. The selection and description of the above embodiments are for the purpose of better explaining the principles and practical applications, thereby enabling those skilled in the art to better utilize the described embodiments and various different variations of embodiments suitable for specific use considerations.
[0037] Figure 1 The address element correction process provided for this application includes the following steps:
[0038] S101: Obtain the address to be corrected and determine each first address element of the address to be corrected.
[0039] S102: Input each of the first address elements into the address text recognition model, and correct each of the first address elements based on the address text recognition model to obtain each of the second address elements.
[0040] S103: Match the pre-built multi-level address standardization library with each of the second address elements, and correct each of the second address elements according to the matching results to obtain the target address after address element correction.
[0041] The address element correction method provided in this application is applied to electronic devices, which may be PCs, tablets, or servers.
[0042] The address to be corrected obtained by the electronic device can be an address entered by the user or an address from the managed merchant address database. After obtaining the address to be corrected, word segmentation is performed on the address to be corrected to obtain the individual first address elements. For example, if the address to be corrected is "No. 11, Xindajie, Zhongsuo Town, Liangshan, Sichuan", the individual first address elements obtained after word segmentation are "Sichuan", "Liangshan", "Zhong", "Suo", "Town", "Xin", "Dajie", and "No. 11".
[0043] Electronic devices are equipped with pre-trained address text recognition models, which are trained based on sample addresses and corresponding address tag information from a sample database. Sample addresses in the database include, for example, abbreviated place names, ambiguous place names, and normal descriptive place names. Corresponding address tag information includes, for example, standard address information containing address levels. Address levels may include, for example, seven levels: Level 1 is a provincial-level administrative region, Level 2 is a prefecture-level administrative region, Level 3 is a county-level administrative region, Level 4 is a township-level administrative region, Level 5 is a village-level administrative region, Level 6 is a landmark building, and Level 7 is a house number, etc. It should be noted that the seven address levels are just an example; more levels can be included, such as Level 8 being a floor number, etc.
[0044] When training an address text recognition model, each sample address is input into the model. The model outputs predicted address information, and a loss value is determined based on the predicted address information and the corresponding label information of the sample address. The parameters of the address text recognition model are then adjusted based on the loss value. Training is complete when the loss value meets the requirements or the number of training iterations reaches a preset threshold. Alternatively, each address element in a sample address can be input as a separate sample address into the address text recognition model, and the corresponding label information of each address element can be used as the address label information for the sample address, thus completing the training of the address text recognition model. In this way, the first address elements of the address to be corrected are input into the address text recognition model, and the model corrects each first address element to obtain the second address elements.
[0045] Electronic devices store a pre-built multi-level address normalization library, which includes address levels, level descriptions, and characteristic keywords. For example, a multi-level address normalization library is shown in Table 1 below:
[0046]
[0047] Table 1
[0048] It should be noted that the information contained in the multi-level address standardization library shown in Table 1 is for illustrative purposes only. In addition to the information mentioned above, the multi-level address standardization library may also contain spatial constraint relationships between different address levels. For example, the spatial constraint relationship between "Zhejiang Province" and "Hangzhou City" may match, while the spatial constraint relationship between "Hebei Province" and "Hangzhou City" may not match, and so on.
[0049] The pre-built multi-level address standardization library is matched with each second address element. Based on the matching results, each second address element is corrected to obtain the target address after address element correction. Optionally, when matching the multi-level address standardization library with each second address element, if a second address element corresponding to a certain address level does not exist, the second address elements for each address level can be completed based on the address space constraints between the lower-level second address elements and the multi-level address standardization library. Optionally, based on the matching results between the multi-level address standardization library and each second address element, it can be determined whether there are second address elements with mismatched spatial constraints. If so, the mismatched second address elements are corrected.
[0050] In this application, after obtaining the address to be corrected and determining its various first address elements, the first address elements are first corrected based on an address text recognition model to obtain various second address elements. Then, a pre-built multi-level address standardization library is matched with each second address element, and the second address elements are corrected according to the matching results to obtain the target address after address element correction. This application achieves the first correction based on an address text recognition model and the second correction based on a pre-built multi-level address standardization library. After two corrections, the target address is obtained. This improves the accuracy of address element correction.
[0051] Figure 2 A schematic diagram illustrating the training process of the address text recognition model provided in this application includes the following steps:
[0052] S201: For each sample address in the sample library, determine the word frequency of each sample address element of the sample address;
[0053] S202: Determine the total number of word frequencies and the number of word frequency changes of the sample address based on the word frequency of each of the sample address elements;
[0054] S203: Determine the quality evaluation value of the sample address based on the total number of word frequencies, the number of word frequency changes, and the address string length;
[0055] S204: Based on the quality evaluation value of each sample address in the sample library, select each sample address to be trained, input each sample address to be trained and its corresponding address label information into the address text recognition model, and train the address text recognition model.
[0056] In this application, each sample address element of each sample address in the sample library is determined, and the word frequency of each sample address element is determined according to the number of times each sample address element appears in the sample library.
[0057] For each sample address in the sample database, the total number of word frequencies and the number of word frequency changes for that sample address can be determined based on the word frequencies of each element within that address. Specifically, determining the total number of word frequencies and the number of word frequency changes for the sample address based on the word frequencies of each element includes: determining the total number of word frequencies for the sample address based on the sum of the word frequencies of each element; determining the difference in word frequencies between any two elements within each element, and determining the number of word frequency changes for the sample address based on the sum of these differences. Optionally, the sum of the word frequencies of each element can be used as the total number of word frequencies for the sample address. The calculation of the difference in word frequencies between any two elements within each element, and the sum of these differences, can be used as the number of word frequency changes for the sample address.
[0058] For each sample address, the address string length of that sample address is obtained. Based on the total number of word frequencies, the number of word frequency variations, and the address string length of that sample address, a quality evaluation value for that sample address is determined. Optionally, the sum of the total number of word frequencies, the number of word frequency variations, and the address string length of that sample address is used as the quality evaluation value for that sample address. Preferably, determining the quality evaluation value of the sample address based on the total number of word frequencies, the number of word frequency variations, and the address string length includes: normalizing the total number of word frequencies, the number of word frequency variations, and the address string length respectively; and then performing a weighted sum of the normalized total number of word frequencies, the number of word frequency variations, and the address string length to obtain the quality evaluation value of the sample address.
[0059] Figure 3 A schematic diagram illustrating the training process of the address text recognition model provided in this application, which includes the following steps:
[0060] S301: For each sample address in the sample library, determine the word frequency of each sample address element of the sample address.
[0061] S302: Determine the total number of word frequencies of the sample address based on the sum of the word frequencies of each of the sample address elements; determine the difference in word frequencies between any two sample address elements; and determine the number of word frequency changes of the sample address based on the sum of the determined differences.
[0062] S303: Normalize the total number of word frequencies, the number of word frequency changes, and the address string length respectively, and then perform a weighted sum of the normalized total number of word frequencies, the number of word frequency changes, and the address string length to obtain the quality evaluation value of the sample address.
[0063] S304: Select each sample address to be trained according to the respective quality evaluation value of each sample address in the sample library, input each of the sample addresses to be trained and the corresponding address label information into the address text recognition model, and train the address text recognition model.
[0064] In this application, considering that abnormal characters in the address to be corrected cause great interference to address correction, in order to improve the accuracy of address element correction, Figure 4 is a schematic diagram of the process for determining each first address element of the address to be corrected provided by this application, including the following steps:
[0065] S401: Delete blank characters and special characters in the address to be corrected according to the pre-constructed address corpus library; and convert traditional Chinese characters in the address to be corrected into corresponding simplified Chinese characters to obtain a preprocessed address.
[0066] S402: Perform word segmentation processing on the preprocessed address to obtain each candidate address element.
[0067] S403: Perform regular matching with each of the candidate address elements according to the multi-level address standardization library, and perform address level completion processing on each of the candidate address elements according to the regular matching result to obtain each first address element.
[0068] The pre-constructed address corpus library contains special characters. Blank characters and special characters in the address to be corrected are deleted according to the pre-constructed address corpus library, and the special characters are, for example, "@", "。", "、", "!", etc. And the traditional Chinese characters in the address to be corrected are converted into corresponding simplified Chinese characters. For example, "贵州省遵义市凤冈县龙泉鎮双拥路" is converted into "贵州省遵义市凤冈县龙泉镇双拥路". It should be noted that in order to achieve more accurate address element correction, non-Chinese characters can be uniformly used as half-width characters according to preset rules, and all full-width characters existing in the address are converted into half-width characters, so that the preprocessed address is obtained.
[0069] After the preprocessed address is determined, word segmentation processing is performed on the preprocessed address to obtain each candidate address element. Optionally, the Chinese word segmentation component jieba or natural language processing HanLP is used to perform word segmentation processing on the preprocessed address, then feature word matching or named entity recognition is performed, and different candidate address elements are separated from the preprocessed address.
[0070] After each candidate address element is determined, regular matching is performed with each candidate address element according to the multi-level address standardization library, and address level completion processing is performed on each candidate address element according to the regular matching result to obtain each first address element.
[0071] Considering that the addresses to be corrected are manually entered, and due to the uncontrollable nature of manual expression, in some scenarios, the addresses may not contain feature keywords from the multi-level address standardization library, or the first address element may contain place name abbreviations. In these cases, regular expression matching cannot complete the address level for each candidate address element. Therefore, it is necessary to input each first address element into an address text recognition model, and correct each first address element based on the address text recognition model to obtain each second address element. Correcting each first address element based on the address text recognition model includes completing the address level for each first address element.
[0072] This application corrects the various second address elements in the following three aspects:
[0073] Firstly, the missing second address elements at the address level in the address to be corrected are supplemented.
[0074] Secondly, second address elements at the same address level in the addresses to be corrected are merged. Each second address element contains a triplet attribute of address location, address level, and address description. Merging second address elements at the same address level includes merging the triplet attributes of second address elements at the same address level.
[0075] Thirdly, the second address element with mismatched spatial constraints in the address to be corrected is corrected. The corrections for these three aspects are explained in detail below.
[0076] Firstly, the process of matching the pre-built multi-level address standardization library with the various second address elements, and correcting the various second address elements based on the matching results, includes:
[0077] The pre-built multi-level address standardization library is matched with each of the second address elements. For each preset address level, if it is determined from the multi-level address standardization library that there is no address element of the address level among the second address elements, the second address element of the address level is determined from the lower-level second address elements of the address level. Address element completion is performed based on the second address element of the address level.
[0078] The pre-built multi-level address standardization library is matched with each second address element. For each preset address level, it is determined whether an address element of that address level exists in each second address element. If it exists, no processing is performed; otherwise, the next-level second address element at that address level is determined. This could be the next-lower-level second address element. If the next-lower-level second address element still does not exist, then the next n-level second address element can be determined. Based on the spatial constraints between the next n-level second address elements and the multi-level address standardization library, the missing address-level second address elements can be identified. Then, address element completion is performed based on the identified missing address-level second address elements.
[0079] For example, the address to be corrected is "Shuangyong Road, Longquan Town, Fenggang County, Guizhou Province". By matching the multi-level address standardization database with "Shuangyong Road, Longquan Town, Fenggang County, Guizhou Province", it was found that the second address element at the prefecture-level administrative region level was missing. Based on the spatial constraint relationship, it was found that "Fenggang County" matches "Zunyi City". Therefore, "Shuangyong Road, Longquan Town, Fenggang County, Guizhou Province" was completed as "Shuangyong Road, Longquan Town, Fenggang County, Zunyi City, Guizhou Province".
[0080] Secondly, if there are second address elements with the same address level among the various second address elements, the various second address elements are sorted according to the order of address level, and the second address elements with the same address level are merged; wherein, each second address element contains a triplet attribute of address location, address level and address description, and merging the second address elements with the same address level includes merging the triplet attributes of the second address elements with the same address level.
[0081] Address elements are denoted as triplets t = [p, l, v], where p refers to the address position of the address element in the address, generally 0, 1, 2, etc., p = 0 indicates the first position in the address, p = 1 indicates the second position in the address, etc.; l is the address level of the address element, l = 1 indicates a provincial-level administrative region, l = 2 indicates a prefecture-level administrative region, l = 3 indicates a county-level administrative region, l = 4 indicates a township-level administrative region, l = 5 indicates a village-level administrative region, l = 6 indicates a landmark building, l = 7 indicates a house number, l = 8 indicates a floor, etc.; v is the address description of the specific place name of the address element.
[0082] Taking "Fourth Floor, Pharmacy Building, Xiangya Second Hospital, Central South University, Yuelu District, Yueyang City, Hunan Province" as an example, the elements of each secondary address are as follows:
[0083] S = {['0','1','Hunan Province'], ['1','2','Yueyang City'], ['2','3','Yuelu District'], ['3','6','Central South University'], ['4','6','Xiangya No. 2 Hospital'], ['5','7','Pharmacy Building'], ['6','8','Fourth Floor']}. Both "Central South University" and "Xiangya No. 2 Hospital" belong to level 6 address elements. Therefore, in S, the element ['3','6','Central South University'] is searched up to ['5','7','Pharmacy Building']. Address element 7 is already greater than address element 6, so there's no need to continue searching for other address elements. All address elements with a level of 6 are merged. The merged second address element is as follows:
[0084] S = {['0','1','Hunan Province'],['1','2','Yueyang City'],['2','3','Yuelu District'],['3','6','Xiangya Second Hospital of Central South University'],['4','7','Pharmacy Building'],['5','8','Fourth Floor']}.
[0085] Thirdly, for each of the second address elements, the second address elements above each of the second address elements are taken as third address elements; if, based on the multi-level address standardization library and the second address elements, it is determined that there is a third address element that does not match the spatial constraint relationship of the second address elements, the mismatched third address element is corrected according to the multi-level address standardization library.
[0086] Address correction is performed using a multi-level address standardization library. The highest address level for an address element is 1. Therefore, the search continues until an address element with an address level greater than 0 is found. All parent address elements of the current address element can be retrieved and compared with the multi-level address standardization library for correction. For example, if ['3', '6', 'Central South University'] is the current address element, in order to correct the accuracy of all parent address elements, it is necessary to search from the current node ['3', '6', 'Central South University'] all the way up to ['0', '1', 'Hunan Province'], and then determine whether the parent nodes conform to the standard address library. In this example, the parent address elements retrieved include: ['0','1','Hunan Province'],['1','2','Yueyang City'],['2','3','Yuelu District']. It was found that ['1','2','Yueyang City'] does not match Yuelu District, because Changsha City includes Yuelu District. Therefore, ['1','2','Yueyang City'] is corrected to ['1','2','Changsha City'].
[0087] Figure 5 The schematic diagram of the process for correcting each second address element provided in this application includes the following steps:
[0088] S501: Match the pre-built multi-level address standardization library with each of the second address elements. For each preset address level, if it is determined from the multi-level address standardization library that there is no address element of the address level among the second address elements, determine the second address element of the address level based on the lower-level second address element of the address level; and complete the address element based on the second address element of the address level.
[0089] S502: If there are second address elements with the same address level among the various second address elements, sort the various second address elements according to the order of address level, and merge the second address elements with the same address level; wherein, each second address element contains a triplet attribute of address location, address level and address description, and merging the second address elements with the same address level includes merging the triplet attributes of the second address elements with the same address level.
[0090] S503: For each of the second address elements, the second address elements above each of the second address elements are taken as third address elements; if, according to the multi-level address standardization library and the second address elements, it is determined that there is a third address element that does not match the spatial constraint relationship of the second address elements, the mismatched third address element is corrected according to the multi-level address standardization library.
[0091] This application proposes a method for automated merchant address completion and correction, the implementation of which yields the following results:
[0092] In the merchant address element classification sub-step, this application designs a weighted filtering method for merchant address samples that integrates three factors: the total word frequency of the merchant address, the number of word frequency changes of the merchant address elements, and the string length of the merchant address. This method selects high-quality merchant address samples for training the address text recognition model, reducing the workload of manual annotation and ensuring the accuracy of merchant address element recognition. In the merchant address completion and correction sub-step, this application constructs a multi-level address standardization library. Based on this library, it designs a backtracking completion method for address elements and an address verification and correction method to improve the accuracy of address completion and correction, especially for address space constraint errors, and is insensitive to changes in the hierarchical structure of the input address.
[0093] Figure 6 The address element correction architecture diagram provided in this application first preprocesses the merchant address data to reduce random interference in address processing, then uses address hierarchical feature words and address text recognition models to classify the merchant address data, and finally completes and corrects the classified address elements.
[0094] The following is based on Figure 6The diagram shown illustrates the process of address element correction in detail.
[0095] Step 1: Merchant address data preprocessing.
[0096] (1) Abnormal characters can greatly interfere with address processing. Remove whitespace characters and special symbols such as '@', '。', '、' and '!' from the address corpus.
[0097] (2) To avoid dictionary redundancy and the impact of synonyms with different forms on address processing, all traditional Chinese characters are filtered and converted to simplified Chinese characters. For example, “Shuangyong Road, Longquan Town, Fenggang County, Zunyi City, Guizhou Province” is changed to “Shuangyong Road, Longquan Town, Fenggang County, Zunyi City, Guizhou Province”.
[0098] (3) Non-Chinese characters should be uniformly converted to half-width characters, and all full-width characters in the address should be converted to half-width characters.
[0099] Step 2: Classified processing of merchant address elements.
[0100] To achieve address completion, a standard dataset, denoted as W, is first constructed based on the domestic four-level administrative division table published by the National Bureau of Statistics and the domestic road network database provided by OSM. Then, based on the standard database, the merchant address elements are classified, and the specific classification logic is as follows:
[0101] 2.1: Segment the merchant's address into words to identify different potential address elements.
[0102] Consider using jieba or HanLP to segment the address text t, then perform feature word matching or named entity recognition to separate different address elements from the address text t. These address elements are denoted as triples t = [p, l, v], where p represents the position of the address element in the address, l is the level of the address element, and v is the textual description of the specific location of the address element. This process is then applied to the potential address elements t formed after segmenting the merchant address. i =[p i ,l i ,v i All potential address elements are stored in the address element set S, and the level l of all potential address elements is initially assigned to -1; S = {[p1,l1,v1],[p2,l2,v2],…,[p n ,l n ,v n ]}; where n is the number of potential address elements formed after segmenting the merchant address t.
[0103] Taking the merchant address "No. 11, Xindajie, Zhongsuo Town, Liangshan, Sichuan" as an example, the set of address elements generated after word segmentation is as follows:
[0104] S={['0','-1','Sichuan'],['1','-1','Liangshan'],['2','-1','Zhong'],['3','-1','Suo'],['4','-1','Zhen'],['5','-1','Xin'],['6','-1','Dajie'],'7','-1','No.11']}.
[0105] 2.2: Perform regular expression matching of feature words on the set S of potential address elements of merchant addresses to achieve coarse labeling at different address element levels.
[0106] In most scenarios, the address elements in a merchant address contain obvious address-level characteristic keywords, as shown in Table 1 above. Based on the definition of the hierarchical relationship of merchant address elements in Table 1, a standard merchant address in this application consists of seven parts, T = {T1, T2, ..., T...}. N Here, N=7, and T represents the set of address elements after the original merchant address has been padded or corrected. Based on the address element feature keywords in the table above, regular expression matching can be performed on the potential address elements in the merchant address element set S to achieve level labeling of all address elements in S, i.e., level 1-N:
[0107] For example, the regular expression for a fourth-level administrative division is as follows: (? <province>[^province]+province|.+autonomous region)(? <city>[^Autonomous Prefecture]+Autonomous Prefecture|[^City]+City|[^League]+League|[^Region]+Region|.+Administration))(? <county>[^City]+City|[^County]+County|[^Banner]+Banner|.+District)? (?) <town>[^district]+district|.+town)? (? <village>.*).
[0108] 2.3: Select a high-quality merchant address training sample set, train a named entity recognition model at the address element level, and achieve fine labeling of different address element levels in S.
[0109] While using address element feature keywords is relatively accurate, since addresses are manually entered, the uncontrollable nature of human expression means that in some scenarios, the address text may not contain the aforementioned feature keywords, or the address elements may contain place name abbreviations. In such cases, named entity recognition models can be used to identify the address element levels within the address. Considering the inconsistent quality of merchant addresses, the following method is used to select merchant address samples with better features as the training set:
[0110] (1) Calculate the total word frequency of the merchant address.
[0111] The frequency of words in the merchant address substrings is calculated using a term frequency (TF) method, resulting in the total TF count for all address substrings. To more accurately count the TF of address elements within the address strings, words with the same frequency are removed during the calculation process, and the total TF count for the remaining address substrings is then calculated. Where n is the total length of the merchant address string.
[0112] (2) The number of word frequency changes in the merchant address substring.
[0113] As the semantic scope of address elements in a merchant address narrows, their frequency of use gradually decreases. This change is also reflected in the word frequency statistics of the address substring. Generally, changes in the hierarchical structure of address elements in a merchant address indicate a gradually narrowing address range and increasingly specific geographical location descriptions. More specific address elements tend to have lower usage frequencies, which is reflected in word frequency statistics. The more changes in the word frequency of a substring, the richer the feature information contained in the address. The specific calculation method is as follows: Where n is the total length of the merchant address string.
[0114] (3) Weighted calculation of merchant address quality.
[0115] The total word frequency of a merchant's address, the number of word frequency variations in its substrings, and the string length all reflect the magnitude of the address's inherent characteristics to some extent. Each characteristic influences the address's value. When selecting address corpora, choosing only one factor can be one-sided; all three factors need to be considered simultaneously, employing a weighted calculation: q = total tf ×w1+total wkn ×w2+n×w3; where w1, w2, and w3 represent different weights, and the specific weight values are obtained from sample statistical analysis. In the specific calculation process, the total word frequency of the merchant address, the number of word frequency changes in the merchant address substring, and the string length of the merchant address can be normalized separately. The specific normalization formula is as follows:
[0116] Finally, based on the merchant samples selected above, manual annotation was performed, and the address text recognition model was trained using the RoBERTa-wwm Chinese pre-trained language model as a foundation.
[0117] After hierarchical labeling of the potential address elements S of a merchant's address, the set of address elements S becomes the following set of address elements: S = {[p1,l1,v1],[p2,l2,v2],…,[p n ,l n ,v n ]}; where n is the number of potential address elements contained in merchant address t.
[0118] Taking the merchant address "No. 11, Xindajie, Zhongsuo Town, Liangshan Prefecture, Sichuan Province" as an example, after step two processing, the address element combined with S is:
[0119] S={['0','1','Sichuan'],['1','2','Liangshan'],['2','4','Zhongshangzhen'],['3','5','Xindajie'],['4','6','No.11']}.
[0120] Step 3: Complete and correct the merchant address.
[0121] The following address element verification, completion, and correction logic is iteratively executed in the set S of potential merchant address elements:
[0122] Assume m = l j (1≤l j ≤N), first extract the level of l from the merchant address element set S. j Corresponding address elements Make the following judgment:
[0123] 3.1 If not found in set S The following completion logic is then executed iteratively, using l j The lower-level address element locates the address element corresponding to the current level, i.e., l j The address element, specifically implemented according to the following logic:
[0124] Let m = l j +1, perform a backward search in the merchant address element data set W to find the nearest address element. s indicates that s steps were retrieved backwards, and then l was retrieved backwards from the address standard library W. j The standard address element information corresponding to the level is used as the merchant address. j The address element of the level is denoted as
[0125] 3.2 If found Then the following verification or correction logic will be executed:
[0126] (1) Merge address elements of the same level: from address elements Traverse backwards from the current position until an element with an address level higher than the current address level is found (assuming u steps are traversed). Perform an element comparison and merge operation, and denote the merged address string as...
[0127] (2) Verify and correct parent-level address elements: from address elements The search proceeds backward from the current level until an element with an address level greater than 0 is found. It then checks against the address standard library W to see if the parent address level and location name are identical. If they are inconsistent, the search is corrected based on the parent location name from the address standard library W. wait;
[0128] Taking "the fourth floor of the Pharmacy Building of the Second Xiangya Hospital of Central South University in Yuelu District, Yueyang City, Hunan Province" as an example, the set S after step two is as follows:
[0129] S = {['0','1','Hunan Province'],['1','2','Yueyang City'],['2','3','Yuelu District'],['3','6','Central South University'],['4','6','Xiangya No. 2 Hospital'],['5','7','Pharmacy Building'],['6','8','Fourth Floor']}.
[0130] Both "Central South University" and "Xiangya No. 2 Hospital" belong to the sixth level of address elements, so they need to be merged. The main search in S is from element ['3','6','Central South University'] up to ['5','7','Pharmacy Building']. Address element 7 is already greater than address element 6, so there is no need to continue searching for other address elements. All address elements with an address level of 6 are merged.
[0131] 3.2 Step (2) Verify and correct the parent level address elements. The standard address database is mainly used for correction. Since the highest level of the address element is 1, the search continues until an element with an address level greater than 0 is found. All the parent address elements of the current address element can be searched and compared with the standard address database for correction. For example, if ['3', '6', 'Central South University'] is the current address element, in order to correct the accuracy of all the parent address elements, it is necessary to search from the current node ['3', '6', 'Central South University'] all the way to ['0', '1', 'Hunan Province'], and then determine whether the parent node conforms to the standard address database. In this example, the retrieved parent address elements include: ['0','1','Hunan Province'],['1','2','Yueyang City'],['2','3','Yuelu District']. It was found that ['1','2','Yueyang City'] is incorrect and should be corrected to ['1','2','Changsha City'], as Changsha City includes Yuelu District.
[0132] 3.3 Let m = l j +1, continue with the next iteration, until all elements of the original merchant address element set t are iterated, ultimately forming the completed and corrected merchant address element set T = {T1, T2, ..., T...} N Then, the information is pieced together to form the completed and corrected merchant address.
[0133] Taking the merchant address "No. 11, Xindajie, Zhongsuo Town, Liangshan, Sichuan" as an example, after step three processing, the address element combined with S is:
[0134] S = {['0','1','Sichuan Province'],['1','2','Liangshan Yi Autonomous Prefecture'],['2','3','Yuexi County'],['3','4','Zhongsuo Town'],['4','5','Xindajie'],'5','6','No. 11']}; The final, complete, and corrected business address is: "No. 11, Xindajie, Zhongsuo Town, Yuexi County, Liangshan Yi Autonomous Prefecture, Sichuan Province".
[0135] Figure 7 The schematic diagram of the address element correction device provided in this application includes:
[0136] The determination module 71 is used to obtain the address to be corrected and determine each first address element of the address to be corrected.
[0137] The first correction module 72 is used to input the first address elements into the address text recognition model, and correct the first address elements based on the address text recognition model to obtain the second address elements.
[0138] The second correction module 73 is used to match the pre-built multi-level address standardization library with each of the second address elements, and correct each of the second address elements according to the matching results to obtain the target address after address element correction.
[0139] The device further includes:
[0140] Training module 74 is used to determine the word frequency of each sample address element for each sample address in the sample address database; determine the total word frequency and word frequency variation of the sample address based on the word frequency of each sample address element; determine the quality evaluation value of the sample address based on the total word frequency, word frequency variation, and address string length; select each sample address to be trained based on the quality evaluation value of each sample address in the sample database, input the sample address to be trained and its corresponding address label information into the address text recognition model, and train the address text recognition model.
[0141] The training module 74 is specifically used to determine the total number of word frequencies of the sample address based on the sum of the word frequencies of each of the sample address elements.
[0142] The difference in word frequency between any two sample address elements is determined, and the sum of the determined differences is used to determine the number of word frequency changes of the sample address.
[0143] The training module 74 is specifically used to normalize the total number of word frequencies, the number of word frequency changes, and the address string length, respectively, and to perform a weighted summation of the normalized total number of word frequencies, the number of word frequency changes, and the address string length to obtain the quality evaluation value of the sample address.
[0144] The determining module 71 is specifically used to delete blank characters and special characters in the address to be corrected according to the pre-built address corpus; convert the traditional Chinese characters in the address to be corrected into the corresponding simplified Chinese characters to obtain the preprocessed address; perform word segmentation on the preprocessed address to obtain each candidate address element; perform regular expression matching between the multi-level address standardization library and each candidate address element; and perform address level completion processing on each candidate address element according to the regular expression matching result to obtain each first address element.
[0145] The second correction module 73 is specifically used to match the pre-built multi-level address standardization library with each of the second address elements. For each preset address level, if it is determined from the multi-level address standardization library that there is no address element of the address level among the various second address elements, the second address element of the address level is determined from the lower-level second address elements of the address level; and address element completion is performed based on the second address element of the address level.
[0146] The second correction module 73 is further configured to sort the second address elements according to the address level if there are second address elements with the same address level among the various second address elements, and merge the second address elements with the same address level; wherein, each second address element includes a triplet attribute of address location, address level and address description, and merging the second address elements with the same address level includes merging the triplet attributes of the second address elements with the same address level.
[0147] The second correction module 73 is further configured to, for each of the second address elements, take each of the upper-level second address elements of the second address elements as third address elements; if, based on the multi-level address standardization library and the second address elements, it is determined that there exists a third address element that does not match the spatial constraint relationship of the second address elements, the mismatched third address element is corrected according to the multi-level address standardization library.
[0148] This application also provides an electronic device, such as Figure 8 As shown, it includes: processor 801, communication interface 802, memory 803 and communication bus 804, wherein processor 801, communication interface 802 and memory 803 communicate with each other through communication bus 804.
[0149] The memory 803 stores a computer program, which, when executed by the processor 801, causes the processor 801 to perform any of the above method steps.
[0150] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0151] Communication interface 802 is used for communication between the above-mentioned electronic device and other devices.
[0152] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0153] The processors mentioned above can be general-purpose processors, including central processing units, network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits, field-programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0154] This application also provides a computer-readable storage medium storing a computer program executable by an electronic device, which, when run on the electronic device, causes the electronic device to perform any of the above method steps.
[0155] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.
[0156] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.< / village> < / town> < / county> < / city> < / province>
Claims
1. A method for correcting address elements, characterized in that, The method includes: Obtain the address to be corrected, and determine each first address element of the address to be corrected; Each of the first address elements is input into the address text recognition model, and each of the first address elements is corrected based on the address text recognition model to obtain each of the second address elements; The pre-built multi-level address standardization library is matched with each of the second address elements, and the second address elements are corrected according to the matching results to obtain the target address after address element correction. The training process of the address text recognition model includes: For each sample address in the sample library, determine the word frequency of each sample address element of that sample address; The total number of word frequencies and the number of word frequency changes of the sample address are determined based on the word frequency of each of the sample address elements. The quality evaluation value of the sample address is determined based on the total number of word frequencies, the number of word frequency changes, and the address string length. Based on the quality evaluation value of each sample address in the sample library, select each sample address to be trained, input each sample address to be trained and its corresponding address label information into the address text recognition model, and train the address text recognition model. Determining the total number of word frequencies and the number of word frequency changes of the sample address based on the word frequency of each of the sample address elements includes: The total word frequency of the sample address is determined based on the sum of the word frequencies of each of the sample address elements. The difference in word frequency between any two sample address elements is determined, and the sum of the determined differences is used to determine the number of word frequency changes of the sample address.
2. The method as described in claim 1, characterized in that, The quality evaluation value of the sample address is determined based on the total number of word frequencies, the number of word frequency changes, and the address string length. The total number of word frequencies, the number of word frequency changes, and the address string length are normalized respectively. The normalized total number of word frequencies, the number of word frequency changes, and the address string length are then weighted and summed to obtain the quality evaluation value of the sample address.
3. The method as described in claim 1, characterized in that, The first address elements for determining the address to be corrected include: Based on a pre-built address corpus, whitespace characters and special characters are removed from the address to be corrected; and traditional Chinese characters in the address to be corrected are converted to their corresponding simplified Chinese characters to obtain the pre-processed address. The preprocessed addresses are segmented to obtain candidate address elements; The multi-level address standardization library is used to perform regular expression matching with each candidate address element. Based on the regular expression matching results, address level completion processing is performed on each candidate address element to obtain each first address element.
4. The method as described in claim 1, characterized in that, The step of matching the pre-built multi-level address standardization library with each of the second address elements, and correcting each of the second address elements based on the matching results, includes: The pre-built multi-level address standardization library is matched with each of the second address elements. For each preset address level, if it is determined from the multi-level address standardization library that there is no address element of the address level among the second address elements, the second address element of the address level is determined from the lower-level second address elements of the address level. Address element completion is performed based on the second address element of the address level.
5. The method as described in claim 4, characterized in that, The method further includes: If there are second address elements with the same address level among the various second address elements, the various second address elements are sorted according to the order of address level, and the second address elements with the same address level are merged; wherein, each second address element contains a triplet attribute of address location, address level and address description, and merging the second address elements with the same address level includes merging the triplet attributes of the second address elements with the same address level.
6. The method as described in claim 4 or 5, characterized in that, The method further includes: For each of the second address elements, the second address elements above each of the second address elements are taken as third address elements; if, based on the multi-level address standardization library and the second address elements, it is determined that there are third address elements that do not match the spatial constraint relationship of the second address elements, the mismatched third address elements are corrected according to the multi-level address standardization library.
7. An address element correction device, characterized in that, The device includes: A determination module is used to obtain the address to be corrected and determine each first address element of the address to be corrected; The first correction module is used to input the first address elements into the address text recognition model, and correct the first address elements based on the address text recognition model to obtain the second address elements. The second correction module is used to match the pre-built multi-level address standardization library with each of the second address elements, and correct each of the second address elements according to the matching results to obtain the target address after address element correction. The device further includes: The training module is used to determine the word frequency of each element of a sample address for each sample address in the sample library; determine the total word frequency and word frequency variation of the sample address based on the word frequency of each element; determine the quality evaluation value of the sample address based on the total word frequency, word frequency variation, and address string length; select each sample address to be trained based on the quality evaluation value of each sample address in the sample library, and input the sample address to be trained and its corresponding address tag information into the address text recognition model to train the address text recognition model. The training module is specifically used to determine the total number of word frequencies of the sample address based on the sum of the word frequencies of each of the sample address elements. The difference in word frequency between any two sample address elements is determined, and the sum of the determined differences is used to determine the number of word frequency changes of the sample address.
8. The apparatus as claimed in claim 7, characterized in that, The training module is specifically used to normalize the total number of word frequencies, the number of word frequency changes, and the address string length, respectively, and to perform a weighted summation of the normalized total number of word frequencies, the number of word frequency changes, and the address string length to obtain the quality evaluation value of the sample address.
9. The apparatus as claimed in claim 7, characterized in that, The determining module is specifically used to delete blank characters and special characters in the address to be corrected according to a pre-built address corpus; convert traditional Chinese characters in the address to be corrected into corresponding simplified Chinese characters to obtain a pre-processed address; perform word segmentation on the pre-processed address to obtain each candidate address element; perform regular expression matching between the multi-level address standardization library and each candidate address element; and perform address level completion processing on each candidate address element according to the regular expression matching result to obtain each first address element.
10. The apparatus as claimed in claim 7, characterized in that, The second correction module is specifically used to match the pre-built multi-level address standardization library with each of the second address elements. For each preset address level, if it is determined from the multi-level address standardization library that there is no address element of the address level among the various second address elements, the second address element of the address level is determined from the lower-level second address elements of the address level; and address element completion is performed based on the second address element of the address level.
11. The apparatus as claimed in claim 10, characterized in that, The second correction module is further configured to, if there are second address elements with the same address level among the various second address elements, sort the various second address elements according to the order of address level, and merge the second address elements with the same address level; wherein, each second address element includes a triplet attribute of address location, address level and address description, and merging the second address elements with the same address level includes merging the triplet attributes of the second address elements with the same address level.
12. The apparatus as claimed in claim 10 or 11, characterized in that, The second correction module is further configured to, for each of the second address elements, take each of the upper-level second address elements of the second address elements as third address elements; if, based on the multi-level address standardization library and the second address elements, it is determined that there exists a third address element that does not match the spatial constraint relationship of the second address elements, the mismatched third address element is corrected according to the multi-level address standardization library.
13. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the steps of the method described in any one of claims 1-6.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method described in any one of claims 1-6.
Citation Information
Patent Citations
Address text recognition method and device, medium and electronic equipment
CN111695355A
Address error correction method and system
CN112364113A
