Enterprise name storage method and enterprise name matching method based on prefix tree

By using prefix tree structures to store enterprise names in massive industrial and commercial libraries and matching them with editing distance algorithms, the problems of long construction time and slow search speed in the existing technology are solved, and efficient and accurate enterprise name matching is achieved.

CN119807474APending Publication Date: 2025-04-11BAIWEIJINKE (SHANGHAI) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411694426.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-25
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

When the existing technology matches enterprise names in massive industrial and commercial libraries, there are problems such as long construction time and slow search speed, and the editing distance algorithm cannot effectively handle attribute differences in company names.

Method used

The enterprise name is stored using a prefix tree structure. By dividing the full name of the enterprise into place name field, name field and attribute field, two chains are built to form a prefix tree and stored in the place name library. When matching, use the edit distance algorithm to calculate the similarity, and sorting returns the result.

Benefits of technology

It realizes efficient enterprise name retrieval and storage, supports flexible scalability and branch name processing, and improves query accuracy and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119807474A_ABST
    Figure CN119807474A_ABST
Patent Text Reader

Abstract

The invention provides an enterprise name storage and matching method, and aims to solve the problem of efficiency of enterprise name matching in a big data environment. The method comprises the following steps: firstly, decomposing a full name of an enterprise into place names, names and attribute fields, constructing two chains to form a prefix tree, and storing the prefix tree in a place name library; for branch company names, full names are stored on mother company nodes. According to the matching method, preliminary matching is performed through a place name library, then results are sorted by using an editing distance algorithm, and the query accuracy is improved. According to the method, storage and retrieval of the enterprise names are optimized, branch company name processing is supported, and matching efficiency and user experience are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of big data, and in particular relates to a method for storing enterprise names and a method for matching enterprise names based on a prefix tree. Background Art

[0002] Most existing enterprise name matching methods use edit distance to match enterprise names in candidate databases. When searching a large number of industrial and commercial enterprise information databases, a common method is to use a search algorithm such as a bk tree.

[0003] The disadvantage of this solution is that when matching a large number of enterprises, it is impossible to match all of them due to the large number of enterprises. Search algorithms based on bk trees are also not competent in the matching process of a large number of industrial and commercial enterprise databases. The construction of the Bk tree takes a lot of time, and after the construction is completed, the search speed of the Bk tree is still unacceptable for the task of matching tens of millions of enterprise names.

[0004] In addition, there are many unreasonable places in the process of using edit distance to match corporate names. For example, there are AA Limited Liability Company and AB Limited Liability Company in the database. When the name of the company to be queried is "AA Limited Liability Company", according to the edit distance, AB Limited Liability Company will be closer to the name of the company to be queried, which is obviously unreasonable. When writing company names, many people will mix up "Limited Liability Company" and "Limited Liability Company", and companies with different names obviously cannot be directly matched. Therefore, using edit distance directly cannot solve this problem well. Summary of the invention

[0005] The technical problem to be solved by the present invention is to provide a method for storing enterprise names and a method for matching enterprise names based on a prefix tree in view of the deficiencies in the above-mentioned prior art, so as to solve the problem of matching enterprise names in massive industrial and commercial databases.

[0006] The first aspect of the present invention discloses a method for storing enterprise names, comprising the following steps:

[0007] Step 1: Get the full name of the enterprise to be stored, and divide the full name of the enterprise into a place name field, a name field, and an attribute field;

[0008] Step 2: Build the full name of the enterprise into one chain, build the name field into another chain, and build the two chains into a prefix tree;

[0009] Step 3: According to the place name field, the prefix tree of the full name of the enterprise to be stored is stored in the storage space corresponding to the place name field in the place name database.

[0010] In the above-mentioned enterprise name storage method, in the two chains of the prefix tree, the node of the last word on each chain stores the full name of the enterprise corresponding to the prefix tree.

[0011] In the above-mentioned enterprise name storage method, when the full name of the enterprise to be stored is a branch company, the chain constructed by the full name of the enterprise stores the full name of the parent company at the node of the last character of the parent company field, and stores the full name of the branch company at the node of the last character of the chain constructed by the full name of the enterprise;

[0012] The full corporate name of the branch company and the full corporate name of the parent company are stored at the node of the last word of the chain constructed by the name field.

[0013] The second aspect of the present invention discloses a method for matching enterprise names based on a prefix tree, comprising the following steps:

[0014] Step 1. Get the name of the company to be queried;

[0015] Step 2, match the name field of the enterprise name to be queried in the place name database to determine whether there is a matching result, if so, proceed to step 3, if not, return empty; the place name database is constructed by the enterprise name storage method described in the first aspect;

[0016] Step 3: Determine whether there is only one matching result. If so, return the matching result. If not, go to step 4.

[0017] Step 4: Calculate the similarity between each matching result and the company name to be queried based on the edit distance algorithm, sort the multiple matching results based on the similarity, and return the sorted multiple matching results.

[0018] In the above-mentioned prefix tree-based enterprise name matching method, step 1 also includes directly matching the enterprise name to be queried in the place name database after obtaining the enterprise name to be queried, and if no matching result is found, executing steps 2 to 4.

[0019] In the above-mentioned prefix tree-based enterprise name matching method, in Step 2, before matching in the place name library according to the name field of the enterprise name to be queried, the place name field in the enterprise name to be queried is used to find the storage space of the corresponding place name field in the place name library, and then matching is performed in the place name library according to the name field.

[0020] Compared with the prior art, the present invention has the following advantages: by using a prefix tree structure to store enterprise names, efficient name retrieval and storage optimization are achieved, while supporting flexible scalability and the ability to process branch company names, and improving query accuracy and user experience through an edit distance algorithm. The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1The figure is a flowchart of the prefix tree construction process of the present invention.

[0022] Figure 2 The figure is a flow chart of adding branches to the prefix tree of the present invention.

[0023] Figure 3 The figure is a flow chart of the enterprise name matching method based on prefix tree of the present invention. DETAILED DESCRIPTION

[0024] like Figure 1 As shown, a method for storing enterprise names includes the following steps:

[0025] Step 1: Get the full name of the enterprise to be stored, and divide the full name of the enterprise into a place name field, a name field, and an attribute field;

[0026] Step 2: Build the full name of the enterprise into one chain, build the name field into another chain, and build the two chains into a prefix tree;

[0027] Step 3: According to the place name field, the prefix tree of the full name of the enterprise to be stored is stored in the storage space corresponding to the place name field in the place name database.

[0028] It should be noted that when building a place name database, it is necessary to count provinces, cities, and counties. In actual scenarios, secondary place names often appear in company names, such as "Changsha City, Hunan Province". The appearance of secondary place names will greatly interfere with the query results. If only the first-level place names are matched, the original name of the company such as "BB Company in Changsha City, Hunan Province" may become "Changsha City BB" after division.

[0029] First, you need to build a query table for place names. The query table needs to include place names and the first-level place names under these place names. For example, under the "Hunan" project, it needs to include "Changsha", "Zhuzhou", "Xiangtan", etc. When dividing the company's place names, after removing the first-level place names, you need to check whether the following characters contain the subordinate place names of the first-level place names in the place name query table. If so, you need to remove the second-level place names as well.

[0030] In this embodiment, in the two chains of the prefix tree, the node of the last word in each chain stores the full name of the enterprise in the corresponding prefix tree.

[0031] like Figure 2 As shown, in this embodiment, when the full name of the enterprise to be stored is a branch company, the chain constructed by the full name of the enterprise stores the full name of the parent company at the node of the last character of the parent company field, and stores the full name of the branch company at the node of the last character of the chain constructed by the full name of the enterprise;

[0032] The full corporate name of the branch company and the full corporate name of the parent company are stored at the node of the last word of the chain constructed by the name field.

[0033] It should be noted that a prefix tree is constructed separately for enterprises in each location. This is done because constructing one tree for all enterprises will consume too much space and affect query efficiency. When each local enterprise constructs a prefix tree separately, query requests can be distributed more evenly. First, a complete enterprise name is constructed into a chain, and the full name of the enterprise is stored on the node of the last character. In addition, after splitting the full name of the enterprise (that is, removing the place name and company attributes, etc.), another chain is also constructed, and the name of the enterprise is also stored on the node of the last character. The purpose of performing two storages is to prevent inconsistent company attributes. For example, the "AA Limited Liability Company" and "AA Co., Ltd." mentioned above, when the attributes are ignored, the two names can be successfully matched. When there is a branch, as shown in Figure 2 As shown, nodes with the full name will continue to be added, but under the name "AA", two companies will appear.

[0034] like Figure 3 As shown, the present invention also discloses a method for matching enterprise names based on a prefix tree, comprising the following steps:

[0035] Step 1. Get the name of the company to be queried;

[0036] Step 2, match the name field of the enterprise name to be queried in the place name database to determine whether there is a matching result, if so, proceed to step 3, if not, return empty; the place name database is constructed by the above-mentioned enterprise name storage method;

[0037] Step 3: Determine whether there is only one matching result. If so, return the matching result. If not, go to step 4.

[0038] Step 4: Calculate the similarity between each matching result and the company name to be queried based on the edit distance algorithm, sort the multiple matching results based on the similarity, and return the sorted multiple matching results.

[0039] In this embodiment, the step 1 also includes directly matching the company name to be queried in the place name database after obtaining the company name to be queried. If no matching result is found, step 2 to step 4 are executed.

[0040] In this embodiment, in Step 2, before matching in the place name library according to the name field of the enterprise name to be queried, the place name field in the enterprise name to be queried is used to find the storage space of the corresponding place name field in the place name library, and then matching is performed in the place name library according to the name field.

[0041] In actual implementation, when the name matches completely, a corresponding node can be found in the prefix tree. This scenario is not described in detail.

[0042] The following uses the search for "Shanghai AA Company xx Branch" and "Shanghai AA Co., Ltd." to illustrate the process of prefix tree search.

[0043] In the search for "Shanghai AA Company xx Branch", there is no complete match at first, so the company name is segmented, and after removing the place name, it becomes "AA Company xx Branch". Then remove the company attributes, and the name behind the company attributes should be removed together, and it becomes "AA". On the node corresponding to AA, there are two company names, "Shanghai AA Co., Ltd." and "Shanghai AA Co., Ltd. xx Branch". Find the closest one and get "Shanghai AA Co., Ltd. xx Branch". Note that the place name is only to reduce the query pressure. For example, the place of "Shanghai AA Co., Ltd. xx Branch" should not be Shanghai, but xx City, but it is still classified as Shanghai here.

[0044] In the search for "Shanghai AA Co., Ltd.", first of all, there is no complete match, so the place name and company name are removed and the search is continued to obtain "AA". On the path corresponding to "AA", two company names, "Shanghai AA Co., Ltd." and "Shanghai AA Co., Ltd. xx Branch" are found. At this time, the two company names are sorted and it is found that "Shanghai AA Co., Ltd." is the closest to the name to be queried, so "Shanghai AA Co., Ltd." is returned.

[0045] After multiple companies are queried at a node, the most suitable company needs to be selected for matching. At this time, the distance between the candidate company name and the name to be queried needs to be determined. The simplest method is to use the edit distance. This is reasonable because most of the unreasonable distances have been eliminated after the prefix tree screening. For example, as mentioned above, the database contains "AA Limited Liability Company" and "AB Limited Company". When the company name to be queried is "AA Limited Company", due to the prefix tree screening, "AB Limited Company" will definitely not be included in the candidate words.

[0046] However, in order to make the query results more accurate, other more sophisticated distance designs can be adopted. For example, when calculating the distance, the weight of the company attributes can be reduced.

[0047] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any way. Any simple modification, change and equivalent structural change made to the above embodiment based on the technical essence of the present invention still falls within the protection scope of the technical solution of the present invention.

Claims

1. A method for storing enterprise names, characterized in that: The following steps are involved: Step 1: Get the full name of the enterprise to be stored, and divide the full name of the enterprise into a place name field, a name field, and an attribute field; Step 2: Build the full name of the enterprise into one chain, build the name field into another chain, and build the two chains into a prefix tree; Step 3: According to the place name field, the prefix tree of the full name of the enterprise to be stored is stored in the storage space corresponding to the place name field in the place name database.

2. The method for storing enterprise names according to claim 1, characterized in that: In the two chains of the prefix tree, the node of the last word in each chain stores the full name of the enterprise corresponding to the prefix tree.

3. The enterprise name storage method according to claim 2, characterized in that: When the full name of the enterprise to be stored is a branch company, the chain constructed by the full name of the enterprise stores the full name of the parent company at the node of the last character of the parent company field, and stores the full name of the branch company at the node of the last character of the chain constructed by the full name of the enterprise; The full corporate name of the branch company and the full corporate name of the parent company are stored at the node of the last word of the chain constructed by the name field.

4. The enterprise name matching method based on prefix tree is characterized by: The following steps are involved: Step 1. Get the name of the company to be queried; Step 2, match the name field of the enterprise name to be queried in the place name database to determine whether there is a matching result, if so, proceed to step 3, if not, return empty; the place name database is constructed by the enterprise name storage method described in claim 3; Step 3: Determine whether there is only one matching result. If so, return the matching result. If not, go to step 4. Step 4: Calculate the similarity between each matching result and the company name to be queried based on the edit distance algorithm, sort the multiple matching results based on the similarity, and return the sorted multiple matching results.

5. The enterprise name matching method based on prefix tree according to claim 4, characterized in that: The step 1 also includes directly matching the name of the enterprise to be queried in the place name database after obtaining the name of the enterprise to be queried. If no matching result is found, step 2 to step 4 are executed.

6. The enterprise name matching method based on prefix tree according to claim 1, characterized in that: In Step 2, before matching in the place name database according to the name field of the enterprise name to be queried, the place name field in the enterprise name to be queried is used to find the storage space of the corresponding place name field in the place name database, and then matching is performed in the place name database according to the name field.