Address clustering method, device, electronic device and storage medium
By clustering the address data in text and latitude and longitude, forming a third address class of intersections and loop matching and incorporating them, the problem of inaccurate clustering results in the existing technology is solved, and the accuracy and coverage of address clustering are improved. .
Patent Information
- Application Number
- CN202111058800.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-09
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2041-09-09
AI Technical Summary
When existing address clustering based on text similarity clustering or latitude and longitude clustering after partitioning, the clustering results are easily inaccurate, ignore the address data between partitions or cannot process address data beyond the latitude and longitude distance, resulting in no clustering results. precise.
A method is adopted to divide the address data first and cluster it according to text and longitude respectively to obtain the first and second address classes, form the third address class based on the intersection of the two, and loop to obtain the third address The address characteristics of the class are matched and incorporated into the third address class until the preset conditions are met.
By combining the correlation between text and latitude and longitude dimensions, the accuracy and breadth of address clustering are improved, ensuring the accuracy and coverage of clustering results.
Smart Images

Figure CN113868351B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and more specifically, to an address clustering method, device, electronic device and storage medium. Background Art
[0002] Address clustering is a technology that classifies addresses based on the features in the address information so that the similarity of addresses in the same class is as large as possible, and the similarity of addresses in different classes is as small as possible. It can be applied to scenarios such as map navigation, gang mining, and merchant analysis.
[0003] At present, address data is often partitioned, and the similarity between addresses is calculated based on the text of address data in different partitions, so as to cluster the address data in the partitions; or, the distance is determined based on the latitude and longitude distribution of the address data to perform clustering.
[0004] However, partitioning the address data and then clustering it based on text similarity may cause address data related to each partition to be ignored; clustering based on the longitude and latitude of the address data cannot cluster addresses that are beyond the longitude and latitude distance, which will cause the correlation between text features of address data that are far away to be ignored, making the clustering results inaccurate. Summary of the invention
[0005] The present application provides an address clustering method, device, electronic device and storage medium to solve the problem of inaccurate clustering results obtained by adopting solutions such as clustering according to address text after partitioning or clustering according to address latitude and longitude in address clustering.
[0006] In a first aspect, the present application provides an address clustering method, which may include:
[0007] Get address data;
[0008] Divide the address data into regions, and cluster the address data in different regions according to the text of the address data to obtain at least one first address class;
[0009] Clustering the address data according to the latitude and longitude of the address data to obtain at least one second address class;
[0010] In the case where the address data in the first address class and the second address class have an intersection, obtaining a third address class according to the intersection;
[0011] The following steps are executed in a loop, and the loop is terminated when the third address class meets the preset clustering condition:
[0012] Obtaining address characteristics of the address data in the third address class;
[0013] The address data is matched according to the address features, and the address data matched outside the third address class is incorporated into the third address class.
[0014] Optionally, matching the address data according to the address feature includes:
[0015] Determine a target address range according to the longitude and latitude of the address data in the third address class, wherein the target address range is larger than the range of the address data in the third address class;
[0016] The address data within the target address range is matched according to the address feature.
[0017] Optionally, the address feature includes a first address keyword, and the step of acquiring the address feature of the address data in the third address class includes:
[0018] Segmenting the text of the address data in the third address class to obtain an address word library;
[0019] The first address keyword is determined according to word frequency information in the address word library.
[0020] Optionally, the preset clustering condition includes at least one of the following:
[0021] The number of loop executions reaches the preset number;
[0022] The increment of the address data in the third address class in two adjacent loop executions is less than or equal to a preset increment.
[0023] Optionally, clustering the address data in different areas according to the text of the address data to obtain at least one first address class includes:
[0024] Segmenting the text of the address data to obtain a second address keyword;
[0025] generating an address vector corresponding to the address data according to the second address keyword;
[0026] Determining similarity for the address data in each of the regions according to the address vector;
[0027] The address data in different areas are clustered according to the similarities to obtain at least one of the first address classes.
[0028] Optionally, clustering the address data according to the latitude and longitude of the address data to obtain at least one second address class includes:
[0029] Generate a geographic hash code corresponding to the address data according to the latitude and longitude of the address data;
[0030] The address data is clustered according to the geo-hash code to obtain at least one of the second address classes.
[0031] Optionally, the acquiring address data includes:
[0032] Cleaning the address data;
[0033] Standardizing the cleaned address data to obtain text corresponding to the address data;
[0034] The longitude and latitude corresponding to the address data are obtained according to the cleaned address data.
[0035] A second aspect of the present application provides an address clustering device, which may include:
[0036] A data acquisition module, used for acquiring address data;
[0037] A first clustering module, configured to divide the address data into regions, and cluster the address data in different regions according to the text of the address data to obtain at least one first address class;
[0038] A second clustering module, configured to cluster the address data according to the latitude and longitude of the address data to obtain at least one second address class;
[0039] A third clustering module, configured to obtain a third address class according to the intersection when there is an intersection between the address data in the first address class and the second address class;
[0040] A loop execution module is used to loop the following steps and terminate the loop when the third address class meets the preset clustering condition:
[0041] Obtaining address characteristics of the address data in the third address class;
[0042] The address data is matched according to the address features, and the address data matched outside the third address class is incorporated into the third address class.
[0043] Optionally, the loop execution module includes:
[0044] A target range determination submodule, configured to determine a target address range according to the longitude and latitude of the address data in the third address class, wherein the target address range is larger than the range of the address data in the third address class;
[0045] The address data matching submodule is used to match the address data within the target address range according to the address characteristics.
[0046] Optionally, the address feature includes a first address keyword, and the loop execution module includes:
[0047] A first word segmentation submodule is used to segment the text of the address data in the third address class to obtain an address word library;
[0048] The first keyword submodule is used to determine the first address keyword according to the word frequency information in the address word library.
[0049] Optionally, the preset clustering condition includes at least one of the following:
[0050] The number of loop executions reaches the preset number;
[0051] The increment of the address data in the third address class in two adjacent loop executions is less than or equal to a preset increment.
[0052] Optionally, the first clustering module includes:
[0053] A second word segmentation submodule is used to segment the text of the address data to obtain a second address keyword;
[0054] A vector generation submodule, used to generate an address vector corresponding to the address data according to the second address keyword;
[0055] A similarity determination submodule, configured to determine the similarity of the address data in each of the regions according to the address vector;
[0056] The first clustering submodule is used to cluster the address data in different areas according to the similarity to obtain at least one first address class.
[0057] Optionally, the second clustering module includes:
[0058] An address coding submodule, used to generate a geographic hash code corresponding to the address data according to the latitude and longitude of the address data;
[0059] The second clustering submodule is used to cluster the address data according to the geographic hash code to obtain at least one of the second address classes.
[0060] Optionally, the data acquisition module includes:
[0061] A data cleaning submodule, used for cleaning the address data;
[0062] An address text determination submodule, used for standardizing the cleaned address data to obtain text corresponding to the address data;
[0063] The address longitude and latitude determination submodule is used to obtain the longitude and latitude corresponding to the address data according to the cleaned address data.
[0064] The third aspect of the present application provides an electronic device, which includes: an interface, a bus, a memory and a processor, wherein the interface, the memory and the processor are connected via the bus, the memory is used to store an executable program, and the processor is configured to run the executable program to implement the steps of the address clustering method described in the first aspect.
[0065] A fourth aspect of the present application provides a computer storage medium, on which an executable program is stored. The executable program is executed by a processor to implement the steps of the address clustering method described in the first aspect.
[0066] Compared with the related art, this application has the following advantages:
[0067] In an embodiment of the present application, after obtaining the address data, the address data can be divided into regions, and the address data in different regions can be clustered according to the text of the address data to obtain at least one first address class, and the address data can be clustered according to the longitude and latitude of the address data to obtain at least one second address class. In the case where there is an intersection between the first address class and the second address class, a third address class can be obtained according to the intersection, and the address features of the address data in the third address class can be obtained by cyclic execution, and the address data can be matched according to the address features, and the matched address data outside the third address class can be incorporated into the third address class until the third address class meets the preset clustering conditions. In the above-mentioned address clustering method, the address data is respectively partitioned and clustered according to the text to obtain the first address class, and clustered according to the longitude and latitude to obtain the second address class, and the third address class, which is the intersection of the first address class and the second address class, is extracted. The address data in the third address class are correlated in both the text and distance dimensions, and then the address features are determined according to the third address class, and the address data is matched to expand the third address class, thereby ensuring the accuracy and breadth of address clustering and effectively improving the accuracy of address clustering.
[0068] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0070] Figure 1 It is a flowchart of the steps of an address clustering method provided in an embodiment of the present application;
[0071] Figure 2 is a flowchart of another address clustering method provided in an embodiment of the present application;
[0072] Figure 3 This is a schematic diagram of a third address class determination principle provided by an embodiment of the present invention;
[0073] Figure 4 It is a structural block diagram of an address clustering device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0074] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0075] In the various embodiments of the present application, it should be understood that the size of the serial numbers of the following processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0076] Figure 1 is a flowchart of a method for clustering addresses provided in an embodiment of the present application. The method may include:
[0077] Step 101: Obtain address data.
[0078] In an embodiment of the present application, address data may be data describing the geographic location of any entity obtained online or offline, wherein the address data may include texts such as provinces, cities, districts, street numbers, names, etc. divided according to administrative regions, and may also include geographic coordinates, longitude and latitude coordinates, etc., wherein the address data of all entities that can be collected can be obtained indiscriminately online and offline, or the address data can be obtained in different ways according to actual needs. For example, in a risk control scenario, when address clustering is used for gang mining, address data can be obtained for areas with a high frequency of risk events, or the address range can be expanded according to the determined risk address, and the address data within the address range can be obtained, or address data such as the registered address in the credit transaction can be obtained according to the risk control object; when address clustering is used to analyze merchants and industries, the shipping and receiving addresses of online transactions can be obtained, or the registered addresses of each merchant on the online platform can be obtained. In the embodiment of the present invention, there is no specific restriction on the source of address data and the method of obtaining address data.
[0079] Step 102: divide the address data into regions, and cluster the address data in different regions according to the text of the address data to obtain at least one first address class.
[0080] In the embodiment of the present invention, since there is a lot of address data, the address data can be divided into regions, and then the address data in the divided regions can be clustered to simplify the calculation amount. Optionally, the address data can be divided into regions according to actual administrative regions. For example, if the city M includes the M1 area, the M2 area, and the M3 area, the address data of the city M can be divided into regions according to the M1 area, the M2 area, and the M3 area. Alternatively, different blocks can be divided according to the location distribution of the address data so that the amount of address data in different blocks is more evenly distributed. The embodiment of the present invention does not specifically limit the method of regional division.
[0081] In an embodiment of the present invention, after dividing the regions, the address data can be clustered according to the text of the address data in different regions, wherein the text of the address data can be text of province, city, district, street number, name, etc., such as A province B city B district B1 street C bank, A province B city B2 district E street number F hotel, etc. The correlation between different address data can be determined according to the text of the address data, thereby performing clustering to obtain at least one first address class. Optionally, in the same region, the text corresponding to the region can be removed from the text of the address data to further simplify the amount of calculation, such as in the address data in province A, clustering is performed only according to the text of the city, district, street number, name, etc., and in the address data in city B, clustering is performed only according to the text of the district, street number, name, etc.; in addition, different clustering algorithms can be used to cluster the address data according to the text of the address data, such as a mean clustering algorithm, a hierarchical clustering algorithm, a density clustering algorithm, etc., which are not specifically limited in the embodiment of the present invention.
[0082] Step 103: cluster the address data according to the longitude and latitude of the address data to obtain at least one second address class.
[0083] In an embodiment of the present invention, the address data can also be clustered according to the longitude and latitude of the address data, and the distance between the address data can be determined according to the longitude and latitude, so as to determine the clustering of the address data according to the size of the distance, wherein the address data with a distance less than a preset distance can be determined as address data with clustering, or the longitude and latitude can be encoded, and the address data can be clustered according to the encoding results to obtain at least one second address class.
[0084] In the embodiment of the present invention, the execution order of step 102 and step 103 is not specifically limited. Step 102 may be executed first and then step 103, or step 103 may be executed first and then step 102, or step 102 and step 103 may be executed simultaneously. The embodiment of the present invention does not specifically limit this.
[0085] Step 104: When there is an intersection between the address data in the first address class and the second address class, obtain a third address class according to the intersection.
[0086] In the embodiment of the present invention, the intersection refers to a set of address data belonging to both the first address class and the second address class. When the intersection exists, the address data in the intersection are correlated in the text dimension and the longitude and latitude dimension. Therefore, the address data in the intersection can be used as the third address class to effectively improve the accuracy of the clustering results. Optionally, the existence of the intersection can be determined when the number of address data belonging to both the first address class and the second address class is greater than or equal to a certain number, where the certain number can be a value greater than 0; or, the existence of the intersection is determined when the distance between the address data that exist in both the first address class and the second address class and the center of at least one of the classes is less than or equal to a preset distance, where the distance can be a vector distance or a geographic distance, and the embodiment of the present invention does not impose specific restrictions on this.
[0087] Step 105: loop through the following steps, and terminate the loop if the third address class meets the preset clustering condition:
[0088] Step 106: Acquire address features of the address data in the third address class.
[0089] In an embodiment of the present invention, when the third address class is determined, further clustering can be performed with the third address class as the cluster center, wherein the address features of the address data in the third address class can be obtained, and the address features are used to characterize the comprehensive features of all address data in the third address class. Optionally, it can be text features, longitude and latitude features, etc. of the address data in the third address class, and can also be obtained by splicing the text features and longitude and latitude features.
[0090] Step 107: Match the address data according to the address features, and incorporate the address data matched outside the third address class into the third address class.
[0091] In an embodiment of the present invention, address data can be matched according to address features. Optionally, only address data outside the third address class can be matched, or address data both inside and outside the third address class can be matched. Address data outside the third address class that has been successfully matched can be incorporated into the third address class, and further clustering can be performed based on address features with the third address class as the clustering center, thereby avoiding omissions in clustering of address data and improving the accuracy of clustering.
[0092] In an embodiment of the present invention, steps 106 and 107 may be executed in a loop. After the third address class is updated based on the address features, the address features of the address data in the third address class may be reacquired based on the updated third address class, and then the address data may be matched according to the updated address features, and the matched address data outside the third address class may be incorporated into the third address class. The loop may be repeated until the third address class meets a preset clustering condition, thereby terminating the loop. The preset clustering condition is used to limit the state of the third address class when the loop terminates. Optionally, the loop may terminate when the benefit of the loop execution is lower than the overhead, or the loop termination may be limited according to the number of loop executions, the amount of address data in the third address class, etc. The embodiment of the present invention does not impose specific restrictions on this.
[0093] In an embodiment of the present application, after obtaining the address data, the address data can be divided into regions, and the address data in different regions can be clustered according to the text of the address data to obtain at least one first address class, and the address data can be clustered according to the longitude and latitude of the address data to obtain at least one second address class. In the case where there is an intersection between the first address class and the second address class, a third address class can be obtained according to the intersection, and the address features of the address data in the third address class can be obtained by cyclic execution, and the address data can be matched according to the address features, and the matched address data outside the third address class can be incorporated into the third address class until the third address class meets the preset clustering conditions. In the above-mentioned address clustering method, the address data is respectively partitioned and clustered according to the text to obtain the first address class, and clustered according to the longitude and latitude to obtain the second address class, and the third address class, which is the intersection of the first address class and the second address class, is extracted. The address data in the third address class are correlated in both the text and distance dimensions, and then the address features are determined according to the third address class, and the address data is matched to expand the third address class, thereby ensuring the accuracy and breadth of address clustering and effectively improving the accuracy of address clustering.
[0094] Figure 2 is a flowchart of another address clustering method provided in an embodiment of the present application. Figure 2 As shown, the method may include:
[0095] Step 201: clean the address data.
[0096] In the embodiment of the present invention, the address data can be obtained from any source and method. Therefore, there may be errors in the format, text, etc. of the address data. There may also be duplication problems, or irrelevant data. At this time, the address data can be cleaned, including removing duplicate data, irrelevant data, unifying data formats, correcting text errors, etc.
[0097] Step 202: Standardize the cleaned address data to obtain text corresponding to the address data.
[0098] In an embodiment of the present invention, standardizing the cleaned address data may refer to standardizing the text of the address data according to administrative divisions, such as filling in, correcting, etc. the province, city, district, street number, name, etc. of the address data according to the existing text, location coordinates, etc. of the address data. For example, if the address data includes B city, C street, and D bank, it is standardized to determine that B city belongs to A province, and C street belongs to B1 district, then the address data is standardized to obtain the text "A province, B city, B1 district, C street, and D bank", or if the address data includes location coordinates (x, y), it is standardized to determine that the coordinates (x, y) correspond to the text "A province, B city, B2 district, E street, and F hotel", etc.
[0099] Step 203: Obtain the longitude and latitude corresponding to the address data according to the cleaned address data.
[0100] In an embodiment of the present invention, the longitude and latitude corresponding to the address data can be obtained based on the cleaned address data, wherein the coordinate position of the address data can be obtained to determine the longitude and latitude corresponding to the address data. Optionally, the coordinate position corresponding to the address data can be obtained when the address data is obtained, or the corresponding coordinate position can be retrieved from a map database based on the text corresponding to the address data. The embodiment of the present invention does not impose specific restrictions on this.
[0101] Step 204: divide the address data into regions and segment the text of the address data to obtain a second address keyword.
[0102] In an embodiment of the present invention, the text of the address data can be segmented, wherein the algorithm for segmenting the text of the address data is not limited. Optionally, a segmentation algorithm such as character matching and semantic analysis can be used. For example, the jieba (stammering) segmentation algorithm can be used to segment the address data to obtain a second address keyword corresponding to the address data.
[0103] In the embodiment of the present invention, the region division of the address data may correspond to the relevant description of the aforementioned step 102, which will not be described again to avoid repetition.
[0104] Step 205: Generate an address vector corresponding to the address data according to the second address keyword.
[0105] In an embodiment of the present invention, an address vector corresponding to the address data can be generated based on the second address keyword corresponding to the address data. Optionally, the second address keyword can be converted using models such as Gensim and TF-IDF (term frequency–inverse document frequency) to obtain the address vector corresponding to the address data.
[0106] Step 206: Determine the similarity of the address data in each area according to the address vector.
[0107] In an embodiment of the present invention, in each region, the similarity between address data can be calculated based on the address vector. Optionally, determining the similarity based on the address vector can be calculating the cosine distance, Pearson correlation coefficient, Euclidean distance, standardized Euclidean distance, Mahalanobis distance, etc. between the address vectors. The embodiment of the present invention does not impose any specific limitation on this.
[0108] Step 207: Cluster the address data in different areas according to the similarity to obtain at least one of the first address classes.
[0109] In an embodiment of the present invention, the similarity of the text between address data determined based on the address vector can characterize the correlation between the address data, and can express different meanings in different scenarios. For example, in a risk control scenario, since the text of different address data in the same gang may include literal code information, the correlation of the text can characterize the possibility that the address data belongs to the same gang. In industry analysis, it can characterize the possibility that the address data belongs to the same type of business organization. The greater the similarity, the higher the possibility, so that the address data can be clustered according to the similarity to obtain at least one first address class. The specific clustering method can refer to the relevant description of the aforementioned step 102. To avoid repetition, it will not be repeated here.
[0110] Step 208: Generate a geographic hash code corresponding to the address data according to the longitude and latitude of the address data.
[0111] In an embodiment of the present invention, the address data can also be clustered according to the longitude and latitude of the address data, wherein a geographic hash code corresponding to the address data can be generated according to the longitude and latitude of the address data. The geographic hash code, i.e., Geohash, is an algorithm that partitions the surface into multiple levels according to longitude and latitude, and then encodes the levels in sequence. It can convert two-dimensional information into one-dimensional information and represent the information of the address data through a character string.
[0112] Step 209: cluster the address data according to the geographic hash code to obtain at least one of the second address classes.
[0113] In an embodiment of the present invention, based on the coding principle of geo-hash coding, geographic data with the same code of preset coding bits in geo-hash coding can be clustered. The same code of preset coding bits indicates that the address data belongs to the same partition in the geo-hash coding and is clustered in longitude and latitude. The preset coding bits can be set according to business needs, historical experience, etc. For example, it can be considered that geographic data with the same code of the first 7 bits in the geo-hash coding have geographic clustering. Then, after encoding the longitude and latitude, the geographic data with the same code of the first 7 bits can be clustered to obtain at least one second address class.
[0114] Step 210: When there is an intersection between the address data in the first address class and the second address class, obtain a third address class according to the intersection.
[0115] In the embodiment of the present invention, step 210 may correspond to the relevant description of the aforementioned step 104, and will not be described again here to avoid repetition.
[0116] Figure 3 : is a schematic diagram of a third address class determination principle provided by an embodiment of the present invention, such as Figure 3 As shown, it includes all address data 301, the first address class 302 and the second address class 303, wherein the first address class 301 is obtained by clustering according to the text similarity of the address data in the region, and the second address class 303 is obtained by clustering according to the longitude and latitude geographic hash coding of the address data. It can be seen that there is an intersection between the first address class 302 and the second address class 303. At this time, the address data in the intersection can be determined as the third address class 304.
[0117] Step 211: loop through the following steps, and terminate the loop when the third address class meets the preset clustering condition:
[0118] Step 212: Acquire address features of the address data in the third address class.
[0119] In the embodiment of the present invention, step 212 may correspond to the relevant description of the aforementioned step 106, and will not be described again here to avoid repetition.
[0120] Optionally, the address feature includes a first address keyword, and step 212 includes:
[0121] Step S11: segment the text of the address data in the third address class to obtain an address word library.
[0122] In an embodiment of the present invention, the address feature may be a first address keyword, which is obtained by segmenting the text of the address data. The segmentation of the text of the address data may correspond to the relevant description of the aforementioned step 204, which will not be described again to avoid repetition.
[0123] In an embodiment of the present invention, an address vocabulary corresponding to the third address class can be established based on word segmentation. The address vocabulary can store text segmentation results of all address data in the third address class. Optionally, the word segmentation results can be further processed, such as counting word frequency information of the word segmentation results, removing high-frequency words such as street, number, building, and room, and ranking the word segmentation results according to the word frequency information. The word segmentation results can also be associated with the corresponding word frequency information to establish a word frequency dictionary, such as {"points": 5, "street": 1}, where the word segmentation is in the quotation marks on the left, and the word frequency information corresponding to the word segmentation is on the right.
[0124] Step S12: Determine the first address keyword according to the word frequency information in the address word library.
[0125] In an embodiment of the present invention, the address vocabulary includes the word segmentation results of the text corresponding to all address data in the third address class. According to the word segmentation results, the word frequency information corresponding to each word segmentation result can be determined. Optionally, the first address keyword corresponding to the third address class can be determined according to the word frequency information. For example, the word segmentation results can be sorted according to the word frequency information, and the word segmentation results with a preset number of digits in the ranking order are determined as the first address keyword.
[0126] Step 213: determine a target address range according to the longitude and latitude of the address data in the third address class, wherein the target address range is larger than the range of the address data in the third address class.
[0127] In an embodiment of the present invention, in order to avoid the problem of high overhead and low efficiency caused by matching address data that is far away in a large amount of data, the target address range can be determined according to the longitude and latitude of the address data in the third address class. Optionally, the target address range whose regional range is larger than the distribution range of each address data in the third address class can be determined according to the longitude and latitude of each address data in the third address class, and the target address range includes the address data in the third address class and a certain number of address data outside the third address class. The target address range can also be determined according to geographic hash coding. For example, when the geographic data is clustered according to a preset number of coding bits, the preset number of coding bits can be reduced to expand the regional range. According to the reduced preset number of coding bits, the address data with the same coding of the preset number of coding bits are determined as address data within the target address range, that is, the target address range is larger than the range of the address data in the third address class.
[0128] For example, the first six digits of the geo-hash codes corresponding to the three address data of "Hotel 1, H Town, G County, B City", "Hotel 2, H Town, G County, B City", and "School 1, H Town, G County, B City" are the same as "wthc6h". The geo-hash code of "G County, B City" is "wthc", which is the same as the first four digits of the above three address data, and the geo-hash code of "B City" is "wt", which is the same as the first two digits of the above three address data. Therefore, when obtaining the second address class, the first six digits can be used as the preset number of coding digits to cluster the address data with the same first six digits. When determining the target address range, the preset number of coding digits can be reduced to the first four or first two digits, and then the address data with the same first four or first two digits can be clustered, thereby expanding the regional range by reducing the preset number of coding digits to determine a target address range that is larger than the address data range in the third address class.
[0129] Step 214: Match the address data within the target address range according to the address features, and incorporate the matched address data outside the third address class into the third address class.
[0130] In the embodiment of the present invention, the address data within the target address range can be matched based on the address characteristics. For details, reference can be made to the relevant description of the aforementioned step 107. To avoid repetition, no further description is given here. In addition, during the process of looping through steps 212 to 214, the target address range can remain unchanged or can be changed according to the distribution of the address data in the third type of address. The embodiment of the present invention does not impose any specific restrictions on this.
[0131] Optionally, the preset clustering condition includes at least one of the following:
[0132] The number of loop executions reaches the preset number;
[0133] The increment of the address data in the third address class in two adjacent loop executions is less than or equal to a preset increment.
[0134] In the embodiment of the present invention, the preset clustering condition may correspond to the relevant description of the aforementioned step 107, and will not be described again here to avoid repetition. Optionally, the preset clustering condition may be that the number of times steps 212 to 214 are executed in a loop reaches a preset number, or that the increment of address data in the third address class in two adjacent loop executions is less than a preset increment, or that the increment of address data in the third address class after executing steps 212 to 214 is 0, and the embodiment of the present invention does not impose any specific restrictions on this.
[0135] In an embodiment of the present application, after obtaining the address data, the address data can be divided into regions, and the address data in different regions can be clustered according to the text of the address data to obtain at least one first address class, and the address data can be clustered according to the longitude and latitude of the address data to obtain at least one second address class. In the case where there is an intersection between the first address class and the second address class, a third address class can be obtained according to the intersection, and the address features of the address data in the third address class can be obtained by cyclic execution, and the address data can be matched according to the address features, and the matched address data outside the third address class can be incorporated into the third address class until the third address class meets the preset clustering conditions. In the above-mentioned address clustering method, the address data is respectively partitioned and clustered according to the text to obtain the first address class, and clustered according to the longitude and latitude to obtain the second address class, and the third address class, which is the intersection of the first address class and the second address class, is extracted. The address data in the third address class are correlated in both the text and distance dimensions, and then the address features are determined according to the third address class, and the address data is matched to expand the third address class, thereby ensuring the accuracy and breadth of address clustering and effectively improving the accuracy of address clustering.
[0136] Figure 4 is a structural block diagram of an address clustering device 40 provided in an embodiment of the present application, such as Figure 4 As shown, the device 40 may include:
[0137] Data acquisition module 401, used to acquire address data;
[0138] A first clustering module 402 is used to divide the address data into regions, and cluster the address data in different regions according to the text of the address data to obtain at least one first address class;
[0139] A second clustering module 403, configured to cluster the address data according to the latitude and longitude of the address data to obtain at least one second address class;
[0140] A third clustering module 404 is configured to obtain a third address class according to the intersection when there is an intersection between the address data in the first address class and the second address class;
[0141] The loop execution module 405 is used to loop the following steps and terminate the loop when the third address class meets the preset clustering condition:
[0142] Obtaining address characteristics of the address data in the third address class;
[0143] The address data is matched according to the address features, and the address data matched outside the third address class is incorporated into the third address class.
[0144] Optionally, the loop execution module 405 includes:
[0145] A target range determination submodule, configured to determine a target address range according to the longitude and latitude of the address data in the third address class, wherein the target address range is larger than the range of the address data in the third address class;
[0146] The address data matching submodule is used to match the address data within the target address range according to the address characteristics.
[0147] Optionally, the address feature includes a first address keyword, and the loop execution module 405 includes:
[0148] A first word segmentation submodule is used to segment the text of the address data in the third address class to obtain an address word library;
[0149] The first keyword submodule is used to determine the first address keyword according to the word frequency information in the address word library.
[0150] Optionally, the preset clustering condition includes at least one of the following:
[0151] The number of loop executions reaches the preset number;
[0152] The increment of the address data in the third address class in two adjacent loop executions is less than or equal to a preset increment.
[0153] Optionally, the first clustering module 402 includes:
[0154] A second word segmentation submodule is used to segment the text of the address data to obtain a second address keyword;
[0155] A vector generation submodule, used to generate an address vector corresponding to the address data according to the second address keyword;
[0156] A similarity determination submodule, configured to determine the similarity of the address data in each of the regions according to the address vector;
[0157] The first clustering submodule is used to cluster the address data in different areas according to the similarity to obtain at least one first address class.
[0158] Optionally, the second clustering module 403 includes:
[0159] An address coding submodule, used to generate a geographic hash code corresponding to the address data according to the latitude and longitude of the address data;
[0160] The second clustering submodule is used to cluster the address data according to the geographic hash code to obtain at least one of the second address classes.
[0161] Optionally, the data acquisition module 401 includes:
[0162] A data cleaning submodule, used for cleaning the address data;
[0163] An address text determination submodule, used for standardizing the cleaned address data to obtain text corresponding to the address data;
[0164] The address longitude and latitude determination submodule is used to obtain the longitude and latitude corresponding to the address data according to the cleaned address data.
[0165] In an embodiment of the present application, after obtaining the address data, the address data can be divided into regions, and the address data in different regions can be clustered according to the text of the address data to obtain at least one first address class, and the address data can be clustered according to the longitude and latitude of the address data to obtain at least one second address class. In the case where there is an intersection between the first address class and the second address class, a third address class can be obtained according to the intersection, and the address features of the address data in the third address class can be obtained by cyclic execution, and the address data can be matched according to the address features, and the matched address data outside the third address class can be incorporated into the third address class until the third address class meets the preset clustering conditions. In the above-mentioned address clustering method, the address data is respectively partitioned and clustered according to the text to obtain the first address class, and clustered according to the longitude and latitude to obtain the second address class, and the third address class, which is the intersection of the first address class and the second address class, is extracted. The address data in the third address class are correlated in both the text and distance dimensions, and then the address features are determined according to the third address class, and the address data is matched to expand the third address class, thereby ensuring the accuracy and breadth of address clustering and effectively improving the accuracy of address clustering.
[0166] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0167] An embodiment of the present invention further provides an electronic device, the electronic device comprising: an interface, a bus, a memory and a processor, the interface, the memory and the processor are connected via the bus, the memory is used to store an executable program, and the processor is configured to run the executable program to implement the following Figure 1 to Figure 2 Any of the steps of the address clustering method described above.
[0168] The embodiment of the present invention further provides a computer storage medium, wherein the computer readable storage medium stores an executable program, and the executable program is executed by a processor to implement the following Figure 1 to Figure 2 Any of the steps of the address clustering method described above.
[0169] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0170] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0171] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the claims.
[0172] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. An address clustering method, characterized in that: The method comprises: Get address data; Divide the address data into regions, and cluster the address data in different regions according to the text of the address data to obtain at least one first address class; Clustering the address data according to the latitude and longitude of the address data to obtain at least one second address class; In the case where the address data in the first address class and the second address class have an intersection, obtaining a third address class according to the intersection; The following steps are executed in a loop, and the loop is terminated when the third address class meets the preset clustering condition: Obtaining address characteristics of the address data in the third address class; The address data is matched according to the address features, and the address data matched outside the third address class is incorporated into the third address class.
2. The method according to claim 1, characterized in that The matching of the address data according to the address feature includes: Determine a target address range according to the longitude and latitude of the address data in the third address class, wherein the target address range is larger than the range of the address data in the third address class; The address data within the target address range is matched according to the address feature.
3. The method according to claim 1, characterized in that The address feature includes a first address keyword, and the step of acquiring the address feature of the address data in the third address class includes: Segmenting the text of the address data in the third address class to obtain an address word library; The first address keyword is determined according to word frequency information in the address word library.
4. The method according to claim 1, characterized in that: The preset clustering condition includes at least one of the following: The number of loop executions reaches the preset number; The increment of the address data in the third address class in two adjacent loop executions is less than or equal to a preset increment.
5. The method according to claim 1, characterized in that The step of clustering the address data in different areas according to the text of the address data to obtain at least one first address class includes: Segmenting the text of the address data to obtain a second address keyword; generating an address vector corresponding to the address data according to the second address keyword; Determining similarity for the address data in each of the regions according to the address vector; The address data in different areas are clustered according to the similarities to obtain at least one of the first address classes.
6. The method according to claim 1, characterized in that The step of clustering the address data according to the latitude and longitude of the address data to obtain at least one second address class includes: Generate a geographic hash code corresponding to the address data according to the latitude and longitude of the address data; The address data is clustered according to the geo-hash code to obtain at least one of the second address classes.
7. The method according to claim 1, characterized in that The acquiring of address data comprises: Cleaning the address data; Standardizing the cleaned address data to obtain text corresponding to the address data; The longitude and latitude corresponding to the address data are obtained according to the cleaned address data.
8. An address clustering device, characterized in that: The device comprises: A data acquisition module, used for acquiring address data; A first clustering module, configured to divide the address data into regions, and cluster the address data in different regions according to the text of the address data to obtain at least one first address class; A second clustering module, configured to cluster the address data according to the latitude and longitude of the address data to obtain at least one second address class; A third clustering module, configured to obtain a third address class according to the intersection when there is an intersection between the address data in the first address class and the second address class; A loop execution module is used to loop the following steps and terminate the loop when the third address class meets the preset clustering condition: Obtaining address characteristics of the address data in the third address class; The address data is matched according to the address features, and the address data matched outside the third address class is incorporated into the third address class.
9. An electronic device, comprising: An interface, a bus, a memory and a processor, wherein the interface, the memory and the processor are connected via the bus, the memory is used to store an executable program, and the processor is configured to run the executable program to implement the steps of the address clustering method as described in any one of claims 1 to 7.
10. A computer storage medium, wherein an executable program is stored on the computer-readable storage medium, and the executable program is executed by a processor to implement the steps of the address clustering method according to any one of claims 1 to 7.
