Text deduplication method, device and electronic device
By combining the vector space hashing algorithm and the minimum common substring matching algorithm, webpage features are extracted and similar flags are set, which solves the problems of low webpage deduplication efficiency and large memory consumption in the existing technology, and achieves efficient text deduplication effect. .
Patent Information
- Application Number
- CN202111618080.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-27
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2041-12-27
AI Technical Summary
Existing text deduplication methods are inefficient and consume large amounts of memory when processing large amounts of web page data. Duplication checking based on the Jaccard algorithm is slow, and short text deduplication based on the sim-hash algorithm is inaccurate.
Combining the vector space hash algorithm and the minimum common substring matching algorithm, it extracts web page title and text features, sets similar flags for grouping, and deletes non-target web pages to achieve deduplication.
It improves the accuracy and efficiency of web page text deduplication, saves memory resources, and is suitable for deduplication tasks of long and short texts.
Smart Images

Figure CN114417102B
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of computer technology, and in particular to a text deduplication method, device, and electronic device. Background Art
[0002] There are usually a lot of mutual reprints on some Internet websites. For example, local government websites reprint news from central government websites. This will cause the crawled data to be repeated in search engine retrieval, resulting in a bad user experience.
[0003] Existing text deduplication methods are based on vector space hashing (sim-hash) algorithms or minimum common substring matching (Jaccard) algorithms. However, duplicate checking based on the Jaccard algorithm involves a lot of calculations, is relatively slow, and requires some computer memory. If the webpage text to be checked is too long, it will cause memory overflow. Duplicate checking based on the sim-hash algorithm is more suitable for long text similarity comparison, and the deduplication effect for short texts may be inaccurate. Summary of the invention
[0004] This disclosure section is provided to introduce concepts in a brief form, which will be described in detail in the detailed description section below. This disclosure section is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0005] The embodiments of the present disclosure provide a text deduplication method, device and electronic device, which improve the deduplication efficiency and save memory while improving the deduplication effect of web page text.
[0006] In a first aspect, an embodiment of the present disclosure provides a method for deduplicating text, comprising: obtaining a set of web pages to be deduplicated; for each web page to be deduplicated in the set of web pages to be deduplicated, extracting web page features from the web page data of the web page to be deduplicated, using the web page title and web page body of the web page to be deduplicated, based on a vector space hash algorithm and a minimum common substring matching algorithm, determining whether there is a web page similar to the web page to be deduplicated in a candidate web page set, and if so, setting a similar flag of the web page to be deduplicated, wherein the web page features include the web page title and the web page body, and similar web pages have the same similar flag; using the similar flag, grouping the web pages to be deduplicated in the set of web pages to be deduplicated; based on the web page features, selecting a target web page from each group of web pages to be deduplicated, deleting other web pages other than the target web page, and obtaining a set of deduplicated web pages.
[0007] In a second aspect, an embodiment of the present disclosure provides a text deduplication device, comprising: an acquisition unit, for acquiring a set of web pages to be deduplicated; a setting unit, for extracting web page features from the web page data of each web page to be deduplicated in the set of web pages to be deduplicated, and using the web page title and web page body of the web page to be deduplicated, based on a vector space hash algorithm and a minimum common substring matching algorithm, determining whether there is a web page similar to the web page to be deduplicated in the candidate web page set, and if so, setting the similarity flag of the web page to be deduplicated, wherein the web page features include the web page title and the web page body, and similar web pages have the same similarity flag; a grouping unit, for grouping the web pages to be deduplicated in the set of web pages to be deduplicated using the similarity flag; a deduplication unit, for selecting a target web page from each group of web pages to be deduplicated based on the web page features, deleting other web pages other than the target web page, and obtaining a set of deduplicated web pages.
[0008] In a third aspect, an embodiment of the present disclosure provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the text deduplication method as described in the first aspect.
[0009] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the text deduplication method as described in the first aspect.
[0010] The text deduplication method, device and electronic device provided by the embodiments of the present disclosure obtain a set of web pages to be deduplicated; for each web page to be deduplicated in the set of web pages to be deduplicated, extract web page features from the web page data of the web page to be deduplicated, use the web page title and web page body of the web page to be deduplicated, and determine whether there is a web page similar to the web page to be deduplicated in the candidate web page set based on the vector space hash algorithm and the minimum common substring matching algorithm. If so, set the similar flag of the web page to be deduplicated; then, use the similar flag to group the web pages to be deduplicated in the set of web pages to be deduplicated; finally, based on the web page features, select a target web page from each group of web pages to be deduplicated, delete other web pages other than the target web page, and obtain a set of deduplicated web pages. In this way, the vector space hash algorithm and the minimum common substring matching algorithm are combined to improve the deduplication effect of web page text while improving the deduplication efficiency and saving memory. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0012] Figure 1 is an exemplary system architecture diagram in which various embodiments of the present disclosure may be applied;
[0013] Figure 2 is a flowchart of an embodiment of a text deduplication method according to the present disclosure;
[0014] Figure 3 is a flowchart of another embodiment of the text deduplication method according to the present disclosure;
[0015] Figure 4 is a structural schematic diagram of an embodiment of a text deduplication device according to the present disclosure;
[0016] Figure 5 It is a schematic diagram of the structure of a computer system suitable for implementing the electronic device of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0017] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain 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 construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0018] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0019] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0020] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0021] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0022] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0023] Figure 1 An exemplary system architecture 100 is shown to which an embodiment of the text deduplication method of the present disclosure may be applied.
[0024] like Figure 1 As shown, the system architecture 100 may include terminal devices 1011, 1012, 1013, a network 102, and a server 103. The network 102 is used to provide a medium for communication links between the terminal devices 1011, 1012, 1013 and the server 103. The network 102 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0025] The user can use the terminal devices 1011, 1012, 1013 to interact with the server 103 through the network 102 to send or receive messages, etc. For example, the server 103 can obtain a set of web pages to be deduplicated from the terminal devices 1011, 1012, 1013. Various communication client applications, such as browser applications, instant messaging software, etc., can be installed on the terminal devices 1011, 1012, 1013.
[0026] Terminal devices 1011, 1012, 1013 can be hardware or software. When terminal devices 1011, 1012, 1013 are hardware, they can be various electronic devices with display screens and supporting information interaction, including but not limited to smart phones, tablet computers, laptop portable computers, etc. When terminal devices 1011, 1012, 1013 are software, they can be installed in the electronic devices listed above. It can be implemented as multiple software or software modules (for example, multiple software or software modules for providing distributed services), or it can be implemented as a single software or software module. No specific limitation is made here.
[0027] Server 103 may be a server that provides various services. For example, it may be a background server that performs deduplication on a set of web pages to be deduplicated. Server 103 may first obtain a set of web pages to be deduplicated; then, for each web page to be deduplicated in the set of web pages to be deduplicated, web page features may be extracted from the web page data of the web page to be deduplicated, and the web page title and web page body of the web page to be deduplicated may be used to determine whether there is a web page similar to the web page to be deduplicated in the candidate web page set based on the vector space hash algorithm and the minimum common substring matching algorithm. If so, the similar flag of the web page to be deduplicated is set; then, the similar flag may be used to group the web pages to be deduplicated in the set of web pages to be deduplicated; finally, based on the web page features, a target web page may be selected from each group of web pages to be deduplicated, and other web pages other than the target web page may be deleted to obtain a set of deduplicated web pages.
[0028] It should be noted that the server 103 can be hardware or software. When the server 103 is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server 103 is software, it can be implemented as multiple software or software modules (for example, for providing distributed services), or it can be implemented as a single software or software module. No specific limitation is made here.
[0029] It should also be noted that the text deduplication method provided in the embodiment of the present disclosure is usually executed by the server 103 , and the text deduplication device is usually set in the server 103 .
[0030] It should also be noted that if the set of web pages to be deduplicated is stored locally on the server 103 , the system architecture 100 may not have the terminal devices 1011 , 1012 , 1013 and the network 102 .
[0031] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0032] Continue to refer Figure 2 , shows a process 200 of an embodiment of a text deduplication method according to the present disclosure. The text deduplication method comprises the following steps:
[0033] Step 201, obtaining a set of web pages to be deduplicated.
[0034] In this embodiment, the execution body of the text deduplication method (for example Figure 1 The server shown in the figure) may be a set of web pages to be deduplicated. The set of web pages to be deduplicated may contain web pages with the same or similar web page contents. In this case, deduplication processing needs to be performed on the set of web pages to be deduplicated.
[0035] Here, the web pages to be deduplicated may include web pages in Internet government websites.
[0036] Step 202: for each web page to be deduplicated in the set of web pages to be deduplicated, extract web page features from the web page data of the web page to be deduplicated.
[0037] In this embodiment, for each web page to be deduplicated in the set of web pages to be deduplicated obtained in step 201, the execution subject may analyze the web page data of the web page to be deduplicated, and extract web page features from the web page data of the web page to be deduplicated. The web page features may include the web page body and the web page title. In addition, the web page features may also include, but are not limited to: the name of the website to which the web page belongs, web page content keywords, and web page character length.
[0038] Step 203 , using the web page title and web page body of the web page to be deduplicated, based on a vector space hash algorithm and a minimum common substring matching algorithm, determines whether there is a web page similar to the web page to be deduplicated in the candidate web page set.
[0039] In this embodiment, the execution subject can use the webpage title and webpage body of the webpage to be deduplicated to determine whether there is a webpage similar to the webpage to be deduplicated in the candidate webpage set based on the vector space hash algorithm and the minimum common substring matching algorithm. There are no duplicate webpages in the candidate webpage set.
[0040] The sim-hash algorithm is used to detect similar web pages. Sim-hash generates an n-bit fingerprint for the input text. Unlike traditional hash functions such as MD5 (MD5 Message-Digest Algorithm) and SHA-1 (Secure Hash Algorithm 1), for similar texts, the fingerprints generated by sim-hash are also similar. The more similar the texts are, the fewer binary digits (denoted as k) their fingerprints are different. For two texts, the steps to compare their sim-hash similarity are as follows: Step 1, word segmentation, the text is segmented, in order to reduce the impact of stop words and other common words (for example, of, is, in...), use TF-IDF (Term Frequency-Inverse Document Frequency) to increase the weight of each word, where TF refers to the frequency of a word in the text, and IDF is related to the commonness of a word (that is, the number of texts containing this word). The more common the word, the lower its IDF value. TF-IDF weight is the product of TF and IDF. In a text, words with relatively high TF-IDF weight become the keywords of this text. Step 2, hash, calculate the hash value of each word, and improve the calculation efficiency by converting text into numbers. Step 3, weighting, multiply 1 in the hash by the positive weight, and 0 by the negative weight. Step 4, merge, add the weighted hash values by column to get a sequence of numbers. Step 5, dimensionality reduction, convert the digital sequence obtained in step 4 into a 0, 1 string, convert numbers greater than 0 into 1, and convert numbers less than 0 into 0. Step 6, similarity comparison, compare the Hamming distance of the generated sim-hash values.
[0041] The Jaccard algorithm is used to calculate the similarity of two sets by taking the ratio of the intersection of the two sets to the union as the similarity of the two sets.
[0042] If it is determined that there is a web page similar to the web page to be deduplicated in the candidate web page set, the execution entity may execute step 204 .
[0043] Step 204: If so, set the similarity flag of the web page to be deduplicated.
[0044] In this embodiment, if it is determined in step 203 that there is a web page similar to the web page to be deduplicated in the candidate web page set, the execution subject can set the similarity flag of the web page to be deduplicated. Here, a web page usually has a similarity flag, which is used to indicate whether two or more web pages are similar. If the similarity flags of two web pages are the same, it can be said that the two web pages are similar.
[0045] Specifically, the execution subject may set the value of the similarity flag of the web page to be deduplicated to the value of the similarity flag of the web page in the candidate web page set that is similar to the web page to be deduplicated. As an example, if the similarity flag of the web page in the candidate web page set that is similar to the web page to be deduplicated is 2, the execution subject may set the value of the similarity flag of the web page to be deduplicated to 2.
[0046] It should be noted that, at the beginning, the value of the similarity flag of the web page to be deduplicated in the above-mentioned set of web pages to be deduplicated can be initialized to a target value, for example, -1. When it is determined that there is a web page similar to the web page to be deduplicated in the above-mentioned candidate web page set, the value of the similarity flag of the web page to be deduplicated can be updated from -1 to the value of the similarity flag of the web page similar to the web page to be deduplicated.
[0047] Step 205: using similarity flags, grouping the web pages to be deduplicated in the set of web pages to be deduplicated.
[0048] In this embodiment, the execution subject may group the web pages to be deduplicated in the set of web pages to be deduplicated using similarity flags. Specifically, the execution subject may group the web pages in the set of web pages to be deduplicated with the same similarity flag into one group.
[0049] It should be noted that if at the beginning, the values of the similarity flags of the web pages to be deduplicated in the above-mentioned set of web pages to be deduplicated are initialized to the target values, then each web page to be deduplicated whose similarity flag value is the initialized value can be grouped separately.
[0050] Step 206 , based on the web page features, select a target web page from each group of web pages to be deduplicated, delete other web pages except the target web page, and obtain a deduplicated web page set.
[0051] In this embodiment, the execution subject may select a target web page from each group of web pages to be deduplicated based on the web page features, delete other web pages other than the target web page, and obtain a deduplicated web page set. As an example, if the web page features include web page character length, the execution subject may select the web page with the longest web page character length from each group of web pages to be deduplicated as the target web page.
[0052] The method provided by the above-mentioned embodiment of the present disclosure is to obtain a set of web pages to be deduplicated; for each web page to be deduplicated in the above-mentioned set of web pages to be deduplicated, extract web page features from the web page data of the web page to be deduplicated, and use the web page title and web page body of the web page to be deduplicated to determine whether there is a web page similar to the web page to be deduplicated in the candidate web page set based on the vector space hash algorithm and the minimum common substring matching algorithm. If so, set the similar flag of the web page to be deduplicated; then, use the similar flag to group the web pages to be deduplicated in the above-mentioned set of web pages to be deduplicated; finally, based on the above-mentioned web page features, select a target web page from each group of web pages to be deduplicated, delete other web pages other than the above-mentioned target web page, and obtain a set of web pages after deduplication. In this way, the vector space hash algorithm and the minimum common substring matching algorithm are combined, which improves the deduplication efficiency and saves memory while improving the deduplication effect of web page text.
[0053] In some optional implementations, the web page features may include the weight of the website to which the web page belongs. The execution subject may select the target web page from each group of web pages to be deduplicated based on the web page features in the following manner: the execution subject may select the web page with the highest weight of the website to which the web page belongs from each group of web pages to be deduplicated as the target web page.
[0054] In some optional implementations, the web page features may include web page publishing time. The execution subject may select a target web page from each group of web pages to be deduplicated based on the web page features in the following manner: for each group of web pages to be deduplicated, if the weights of the websites to which the web pages in the group of web pages to be deduplicated belong are the same, the execution subject may select the web page with the earliest web page publishing time from the group of web pages to be deduplicated as the target web page.
[0055] In some optional implementations, the above-mentioned execution entity can select the target web page from each group of web pages to be deduplicated based on the above-mentioned web page features in the following manner: for each group of web pages to be deduplicated, if the weights of the websites to which the web pages in the group of web pages to be deduplicated belong are the same and the web page publishing time is the same, then the above-mentioned execution entity can select the web page with the earliest crawling time from the group of web pages to be deduplicated as the target web page.
[0056] Further references Figure 3 , which shows a process 300 of another embodiment of a text deduplication method. The process 300 of the text deduplication method includes the following steps:
[0057] Step 301: Obtain a collection of web pages to be deduplicated
[0058] Step 302: for each web page to be deduplicated in the set of web pages to be deduplicated, extract web page features from the web page data of the web page to be deduplicated.
[0059] In this embodiment, steps 301 - 302 may be performed in a manner similar to steps 201 - 202 , and will not be described in detail herein.
[0060] Step 303: Using a vector space hash algorithm, obtain a vector space hash value for the web page title and the web page body of the web page to be deduplicated.
[0061] In this embodiment, the execution body of the text deduplication method (for example Figure 1 The server shown in the figure can use the vector space hash algorithm to obtain the vector space hash value for the web page title and web page body of the web page to be deduplicated.
[0062] Here, the specific method of using the vector space hash algorithm to obtain the vector space hash value of the text is not repeated here.
[0063] Step 304 : for each candidate web page in the candidate web page set, determine the Hamming distance between the vector space hash value of the web page body of the to-be-deduplicated web page and the vector space hash value of the web page body of the candidate web page as the first Hamming distance.
[0064] In this embodiment, for each candidate web page in the candidate web page set, the execution subject can determine the Hamming distance between the vector space hash value of the web page body of the web page to be deduplicated and the vector space hash value of the web page body of the candidate web page as the first Hamming distance. The Hamming distance represents the number of different characters in the corresponding positions of two equal-length strings. Perform a binary XOR operation on the two strings and count the number of results that are 1, which is the Hamming distance.
[0065] Here, the vector space hash value of the webpage body of each candidate webpage in the above candidate webpage set is usually obtained in advance.
[0066] Step 305: using the first Hamming distance, determine whether the first web page exists in the candidate web page set.
[0067] In this embodiment, the execution subject may use the first Hamming distance to determine whether the first web page exists in the candidate web page set. The web page body of the first web page is usually similar to the web page body of the web page to be deduplicated. Specifically, the execution subject may determine whether the first Hamming distance is less than a preset first distance threshold. If the first Hamming distance is less than the first distance threshold, it can be determined that the first web page exists in the candidate web page set.
[0068] If the first web page exists in the candidate web page set, the execution entity may execute step 306 .
[0069] Step 306: If the first web page exists in the candidate web page set, it is determined that there exists a web page similar to the web page to be deduplicated in the candidate web page set.
[0070] In this embodiment, if it is determined in step 305 that the first web page exists in the candidate web page set, the execution entity may determine that a web page similar to the web page to be deduplicated exists in the candidate web page set, and the first web page in the candidate web page set is a web page similar to the web page to be deduplicated.
[0071] Step 307: If the first web page does not exist in the candidate web page set, for each candidate web page in the candidate web page set, determine the Hamming distance between the vector space hash value of the web page title of the web page to be deduplicated and the vector space hash value of the web page title of the candidate web page as the second Hamming distance.
[0072] In this embodiment, if it is determined in step 305 that the first web page does not exist in the candidate web page set, the execution subject may determine, for each candidate web page in the candidate web page set, the Hamming distance between the vector space hash value of the web page title of the web page to be deduplicated and the vector space hash value of the web page title of the candidate web page as the second Hamming distance. Specifically, the execution subject may perform a binary XOR operation on the vector space hash value of the web page title of the web page to be deduplicated and the vector space hash value of the web page title of the candidate web page, and the XOR result is the Hamming distance.
[0073] Here, the vector space hash value of the webpage title of each candidate webpage in the candidate webpage set is usually obtained in advance.
[0074] Step 308: Determine whether the second web page set exists in the candidate web page set by using the second Hamming distance.
[0075] In this embodiment, the execution subject may use the second Hamming distance to determine whether there is a second web page set in the candidate web page set. The web page title of the second web page in the second web page set is similar to the web page title of the web page to be deduplicated. Specifically, the execution subject may determine whether the second Hamming distance is less than a preset second distance threshold. If the second Hamming distance is less than the second distance threshold, it can be determined that there is a second web page set in the candidate web page set.
[0076] If the second web page set exists in the candidate web page set, the execution subject may execute step 309 .
[0077] Step 309: If there is a second web page set in the candidate web page set, for each second web page in the second web page set, the web page body of the second web page is compared with the web page body of the web page to be deduplicated by performing a minimum common substring comparison.
[0078] In this embodiment, if it is determined in step 308 that the second web page set exists in the candidate web page set, the execution subject may compare the web page text of each second web page in the second web page set with the web page text of the web page to be deduplicated by the least common substring. Specifically, the execution subject may first obtain the intersection of the web page text of the second web page and the web page text of the web page to be deduplicated; then, obtain the union of the web page text of the second web page and the web page text of the web page to be deduplicated; finally, the ratio of the intersection to the union may be obtained as the similarity between the web page text of the second web page and the web page text of the web page to be deduplicated.
[0079] Step 310: Determine whether the webpage text of the second webpage is similar to the webpage text of the webpage to be deduplicated.
[0080] In this embodiment, the execution subject may determine whether the webpage text of the second webpage is similar to the webpage text of the webpage to be deduplicated. Specifically, the execution subject may determine whether the similarity between the webpage text of the second webpage and the webpage text of the webpage to be deduplicated is greater than a preset similarity threshold. If it is greater than the similarity threshold, step 311 may be executed.
[0081] Step 311: If the webpage text of the second webpage is similar to the webpage text of the webpage to be deduplicated, it is determined that there is a webpage similar to the webpage to be deduplicated in the candidate webpage set.
[0082] In this embodiment, if it is determined in step 310 that the webpage body of the second webpage is similar to the webpage body of the webpage to be deduplicated, the execution subject can determine that there is a webpage similar to the webpage to be deduplicated in the candidate webpage set. The second webpage in the candidate webpage set whose webpage body is similar to the webpage body of the webpage to be deduplicated is a webpage similar to the webpage to be deduplicated.
[0083] Step 312: If it is determined in step 306 and step 311 that there is a web page similar to the web page to be deduplicated in the candidate web page set, then a similar flag of the web page to be deduplicated is set.
[0084] Step 313: using the similarity flag, grouping the web pages to be deduplicated in the set of web pages to be deduplicated.
[0085] Step 314, based on the web page features, select a target web page from each group of web pages to be deduplicated, delete other web pages except the target web page, and obtain a deduplicated web page set.
[0086] In this embodiment, steps 312-314 may be performed in a manner similar to steps 204-206, and will not be described in detail herein.
[0087] from Figure 3 It can be seen that Figure 2 Compared with the corresponding embodiment, the process 300 of the text deduplication method in this embodiment embodies the steps of using the sim-hash algorithm to determine the similarity of the web page text, and if similar web pages are not determined using this method, then using the sim-hash algorithm to determine the similarity of the web page titles, and then using the Jaccard algorithm to compare the web page texts of web pages with similar titles. Therefore, the scheme described in this embodiment provides a method for determining similar web pages by combining the vector space hash algorithm and the minimum common substring matching algorithm, which improves the accuracy of deduplication of short texts, and has a significant improvement in speed compared to the Jaccard algorithm, and optimizes memory usage.
[0088] In some optional implementations, if it is determined in step 311 that the webpage text of the second webpage is not similar to the webpage text of the webpage to be deduplicated, the execution entity may add the webpage to be deduplicated to the candidate webpage set.
[0089] In some optional implementations, if it is determined in step 308 that the second web page set does not exist in the candidate web page set, the execution entity may add the web page to be deduplicated to the candidate web page set.
[0090] In some optional implementations, the execution subject may use the vector space hash algorithm to obtain the vector space hash value of the web page title and web page body of the web page to be deduplicated in the following manner: when the execution subject uses the vector space hash algorithm to segment the web page title and web page body of the web page to be deduplicated, the web page title and web page body of the web page to be deduplicated may be segmented by window sliding so that the character length of each segmentation result is equal. Through this segmentation method, the length of each segmentation result is the same, and they have the same weight when calculating sim-hash, avoiding the offset of the segmentation content due to the length of the segmentation, thereby causing the problem that the Hamming distance calculated by sim-hash is not accurate enough.
[0091] As an example, if the text is "How to deduplicate text", window sliding segmentation is performed on every four characters of the text, and the segmentation results are: how to deduplicate text, what to do with the text, how to deduplicate the text, and how to deduplicate the text.
[0092] Further references Figure 4 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a text deduplication device, and the device embodiment is Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0093] like Figure 4 As shown, the text deduplication device 400 of this embodiment includes: an acquisition unit 401, a setting unit 402, a grouping unit 403 and a deduplication unit 404. The acquisition unit 401 is used to acquire a set of web pages to be deduplicated; the setting unit 402 is used to extract web page features from the web page data of each web page to be deduplicated in the set of web pages to be deduplicated, and use the web page title and web page body of the web page to be deduplicated to determine whether there is a web page similar to the web page to be deduplicated in the candidate web page set based on the vector space hash algorithm and the minimum common substring matching algorithm. If there is, the similar flag of the web page to be deduplicated is set, wherein the web page features include the web page title and the web page body, and similar web pages have the same similar flag; the grouping unit 403 is used to group the web pages to be deduplicated in the set of web pages to be deduplicated using the similar flag; the deduplication unit 404 is used to select a target web page from each group of web pages to be deduplicated based on the web page features, delete other web pages other than the target web page, and obtain a set of deduplicated web pages.
[0094] In this embodiment, the specific processing of the acquisition unit 401 of the text deduplication device 400 can be referred to Figure 2 Corresponding to step 201 in the embodiment, the specific processing of setting unit 402 can refer to Figure 2 The specific processing of the grouping unit 403 in the corresponding embodiment of step 202, step 203 and step 204 can refer to Figure 2 The specific processing of the deduplication unit 404 in the corresponding embodiment of step 205 can be referred to Figure 2 This corresponds to step 206 in the embodiment.
[0095] In some optional implementations, the setting unit 402 may be further used to determine whether there is a web page similar to the web page to be deduplicated in the candidate web page set by using the web page title and web page body of the web page to be deduplicated, based on a vector space hash algorithm and a minimum common substring matching algorithm, in the following manner: the setting unit 402 may use the vector space hash algorithm to obtain a vector space hash value for the web page title and web page body of the web page to be deduplicated; then, for each candidate web page in the candidate web page set, the Hamming distance between the vector space hash value of the web page body of the web page to be deduplicated and the vector space hash value of the web page body of the candidate web page may be determined as a first Hamming distance; then, the first Hamming distance may be used to determine whether there is a first web page in the candidate web page set, wherein the web page body of the first web page is similar to the web page body of the web page to be deduplicated; if the first web page exists in the candidate web page set, the setting unit 402 may determine that there is a web page similar to the web page to be deduplicated in the candidate web page set.
[0096] In some optional implementations, after using the first Hamming distance to determine whether the first web page exists in the candidate web page set, if the first web page does not exist in the candidate web page set, the setting unit 402 may determine, for each candidate web page in the candidate web page set, the Hamming distance between the vector space hash value of the web page title of the web page to be deduplicated and the vector space hash value of the web page title of the candidate web page as the second Hamming distance; thereafter, the second Hamming distance may be used to determine whether a second web page set exists in the candidate web page set, wherein the web page title of the second web page is similar to the web page title of the web page to be deduplicated; if the second web page set exists in the candidate web page set, for each second web page in the second web page set, a minimum common substring comparison is performed between the web page body of the second web page and the web page body of the web page to be deduplicated to determine whether the web page body of the second web page is similar to the web page body of the web page to be deduplicated; if the web page body of the second web page is similar to the web page body of the web page to be deduplicated, the setting unit 402 may determine that there is a web page similar to the web page to be deduplicated in the candidate web page set.
[0097] In some optional implementations, after determining whether the web page text of the second web page is similar to the web page text of the web page to be deduplicated, if the web page text of the second web page is not similar to the web page text of the web page to be deduplicated, the setting unit 402 may add the web page to be deduplicated to the candidate web page set.
[0098] In some optional implementations, after using the second Hamming distance to determine whether there is a second web page set in the candidate web page set, if the second web page set does not exist in the candidate web page set, the setting unit 402 may add the web page to be deduplicated to the candidate web page set.
[0099] In some optional implementations, the setting unit 402 can be further used to obtain vector space hash values for the web page title and web page body of the web page to be deduplicated using the vector space hash algorithm in the following manner: the setting unit 402 can perform window sliding word segmentation on the web page title and web page body of the web page to be deduplicated, wherein the character length of each word segmentation result is equal.
[0100] In some optional implementations, the above-mentioned web page features may include the weight of the website to which the web page belongs; and the above-mentioned deduplication unit 404 may be further used to select a target web page from each group of web pages to be deduplicated based on the above-mentioned web page features in the following manner: the above-mentioned deduplication unit 404 may select the web page with the highest weight of the website to which the web page belongs from each group of web pages to be deduplicated as the target web page.
[0101] In some optional implementations, the above-mentioned web page features may include the web page publishing time; and the above-mentioned deduplication unit 404 can be further used to select a target web page from each group of web pages to be deduplicated based on the above-mentioned web page features in the following manner: for each group of web pages to be deduplicated, if the weights of the websites to which the web pages in the group of web pages to be deduplicated belong are the same, then the above-mentioned deduplication unit 404 can select the web page with the earliest web page publishing time from the group of web pages to be deduplicated as the target web page.
[0102] In some optional implementations, the above-mentioned deduplication unit 404 can be further used to select a target web page from each group of web pages to be deduplicated based on the above-mentioned web page features in the following manner: for each group of web pages to be deduplicated, if the weights of the websites to which the web pages in the group of web pages to be deduplicated belong are the same and the web page publishing time is the same, then the above-mentioned deduplication unit 404 can select the web page with the earliest crawling time from the group of web pages to be deduplicated as the target web page.
[0103] Reference below Figure 5 , which shows an electronic device (eg, Figure 1 A schematic diagram of the structure of the server 500 in FIG. Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0104] like Figure 5 As shown, the electronic device 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0105] Typically, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 5 The electronic device 500 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 5Each block shown in the figure may represent one device, or may represent multiple devices as required.
[0106] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, the above functions defined in the method of the embodiment of the present disclosure are executed. It should be noted that the computer-readable medium described in the embodiment of the present disclosure can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection with one or more conductors, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In an embodiment of the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, an apparatus, or a device. In an embodiment of the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in combination with an instruction execution system, an apparatus, or a device. The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wire, optical cable, RF (radio frequency), etc., or any suitable combination of the foregoing.
[0107] The computer-readable medium may be included in the electronic device; or it may exist independently without being installed in the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: obtains a set of web pages to be deduplicated; for each web page to be deduplicated in the set of web pages to be deduplicated, extracts web page features from the web page data of the web page to be deduplicated, and uses the web page title and web page body of the web page to be deduplicated, based on the vector space hash algorithm and the minimum common substring matching algorithm, determines whether there is a web page similar to the web page to be deduplicated in the candidate web page set, and if so, sets the similar flag of the web page to be deduplicated, wherein the web page features include the web page title and the web page body, and similar web pages have the same similar flag; uses the similar flag to group the web pages to be deduplicated in the set of web pages to be deduplicated; based on the web page features, selects a target web page from each group of web pages to be deduplicated, deletes other web pages other than the target web page, and obtains a set of deduplicated web pages.
[0108] Computer program code for performing the operations of embodiments of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on a user's computer, partially on a user's computer, as a separate software package, partially on a user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0109] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0110] According to one or more embodiments of the present disclosure, a text deduplication method is provided, the method comprising: obtaining a set of web pages to be deduplicated; for each web page to be deduplicated in the set of web pages to be deduplicated, extracting web page features from web page data of the web page to be deduplicated, using the web page title and web page body of the web page to be deduplicated, based on a vector space hash algorithm and a minimum common substring matching algorithm, determining whether there is a web page similar to the web page to be deduplicated in a candidate web page set, if so, setting a similar flag of the web page to be deduplicated, wherein the web page features include the web page title and the web page body, and similar web pages have the same similar flag; using the similar flag, grouping the web pages to be deduplicated in the set of web pages to be deduplicated; based on the web page features, selecting a target web page from each group of web pages to be deduplicated, deleting other web pages other than the target web page, and obtaining a set of deduplicated web pages.
[0111] According to one or more embodiments of the present disclosure, the web page title and web page body of the web page to be deduplicated are used to determine whether there is a web page similar to the web page to be deduplicated in a candidate web page set based on a vector space hash algorithm and a minimum common substring matching algorithm, including: using the vector space hash algorithm to obtain a vector space hash value for the web page title and web page body of the web page to be deduplicated; for each candidate web page in the candidate web page set, determining the Hamming distance between the vector space hash value of the web page body of the web page to be deduplicated and the vector space hash value of the web page body of the candidate web page as a first Hamming distance; using the first Hamming distance, determining whether there is a first web page in the candidate web page set, wherein the web page body of the first web page is similar to the web page body of the web page to be deduplicated; if the first web page exists in the candidate web page set, determining whether there is a web page similar to the web page to be deduplicated in the candidate web page set.
[0112] According to one or more embodiments of the present disclosure, after using the first Hamming distance to determine whether the first web page exists in the candidate web page set, the method also includes: if the first web page does not exist in the candidate web page set, then for each candidate web page in the candidate web page set, determining the Hamming distance between the vector space hash value of the web page title of the web page to be deduplicated and the vector space hash value of the web page title of the candidate web page as the second Hamming distance; using the second Hamming distance, determining whether there is a second web page set in the candidate web page set, wherein the web page title of the second web page is similar to the web page title of the web page to be deduplicated; if the second web page set exists in the candidate web page set, then for each second web page in the second web page set, performing a minimum common substring comparison between the web page text of the second web page and the web page text of the web page to be deduplicated, and determining whether the web page text of the second web page is similar to the web page text of the web page to be deduplicated; if the web page text of the second web page is similar to the web page text of the web page to be deduplicated, determining that there is a web page similar to the web page to be deduplicated in the candidate web page set.
[0113] According to one or more embodiments of the present disclosure, after determining whether the web page text of the second web page is similar to the web page text of the web page to be deduplicated, the method includes: if the web page text of the second web page is not similar to the web page text of the web page to be deduplicated, adding the web page to be deduplicated to the candidate web page set.
[0114] According to one or more embodiments of the present disclosure, after determining whether there is a second web page set in the candidate web page set using the second Hamming distance, the method includes: if there is no second web page set in the candidate web page set, adding the web page to be deduplicated to the candidate web page set.
[0115] According to one or more embodiments of the present disclosure, a vector space hash algorithm is used to obtain vector space hash values for the web page title and web page body of the web page to be deduplicated, including: performing window sliding word segmentation on the web page title and web page body of the web page to be deduplicated, wherein the character length of each word segmentation result is equal.
[0116] According to one or more embodiments of the present disclosure, web page features include the weight of the website to which the web page belongs; and based on the web page features, a target web page is selected from each group of web pages to be deduplicated, including: selecting the web page with the highest weight of the website to which the web page belongs from each group of web pages to be deduplicated as the target web page.
[0117] According to one or more embodiments of the present disclosure, web page features include web page publishing time; and based on the web page features, a target web page is selected from each group of web pages to be deduplicated, including: for each group of web pages to be deduplicated, if the weights of the websites to which the web pages in the group of web pages to be deduplicated belong are the same, then the web page with the earliest web page publishing time is selected from the group of web pages to be deduplicated as the target web page.
[0118] According to one or more embodiments of the present disclosure, a target web page is selected from each group of web pages to be deduplicated based on web page features, including: for each group of web pages to be deduplicated, if the weights of the websites to which the web pages in the group of web pages to be deduplicated belong are the same and the web pages are published at the same time, then the web page with the earliest crawling time is selected from the group of web pages to be deduplicated as the target web page.
[0119] According to one or more embodiments of the present disclosure, a text deduplication device is provided, which includes: an acquisition unit, which is used to acquire a set of web pages to be deduplicated; a setting unit, which is used to extract web page features from the web page data of each web page to be deduplicated in the set of web pages to be deduplicated, and use the web page title and web page body of the web page to be deduplicated to determine whether there is a web page similar to the web page to be deduplicated in the candidate web page set based on a vector space hash algorithm and a minimum common substring matching algorithm, and if so, set the similarity flag of the web page to be deduplicated, wherein the web page features include the web page title and the web page body, and similar web pages have the same similarity flag; a grouping unit, which is used to group the web pages to be deduplicated in the set of web pages to be deduplicated using the similarity flag; and a deduplication unit, which is used to select a target web page from each group of web pages to be deduplicated based on the web page features, delete other web pages other than the target web page, and obtain a set of web pages after deduplication.
[0120] According to one or more embodiments of the present disclosure, the setting unit is further used to use the web page title and web page body of the web page to be deduplicated, based on the vector space hash algorithm and the minimum common substring matching algorithm, to determine whether there is a web page similar to the web page to be deduplicated in the candidate web page set: using the vector space hash algorithm, obtain the vector space hash value of the web page title and web page body of the web page to be deduplicated; for each candidate web page in the candidate web page set, determine the Hamming distance between the vector space hash value of the web page body of the web page to be deduplicated and the vector space hash value of the web page body of the candidate web page as the first Hamming distance; using the first Hamming distance, determine whether there is a first web page in the candidate web page set, wherein the web page body of the first web page is similar to the web page body of the web page to be deduplicated; if the first web page exists in the candidate web page set, determine whether there is a web page similar to the web page body of the web page to be deduplicated in the candidate web page set.
[0121] According to one or more embodiments of the present disclosure, after using the first Hamming distance to determine whether a first web page exists in the candidate web page set, the setting unit is further used to determine, if the first web page does not exist in the candidate web page set, the Hamming distance between the vector space hash value of the web page title of the web page to be deduplicated and the vector space hash value of the web page title of the candidate web page as the second Hamming distance for each candidate web page in the candidate web page set; using the second Hamming distance, determine whether a second web page set exists in the candidate web page set, wherein the web page title of the second web page is similar to the web page title of the web page to be deduplicated; if the second web page set exists in the candidate web page set, for each second web page in the second web page set, perform a minimum common substring comparison between the web page text of the second web page and the web page text of the web page to be deduplicated, and determine whether the web page text of the second web page is similar to the web page text of the web page to be deduplicated; if the web page text of the second web page is similar to the web page text of the web page to be deduplicated, it is determined that there is a web page similar to the web page to be deduplicated in the candidate web page set.
[0122] According to one or more embodiments of the present disclosure, after determining whether the web page text of the second web page is similar to the web page text of the web page to be deduplicated, the setting unit is further used to add the web page to be deduplicated to the candidate web page set if the web page text of the second web page is not similar to the web page text of the web page to be deduplicated.
[0123] According to one or more embodiments of the present disclosure, after determining whether there is a second web page set in the candidate web page set using the second Hamming distance, the setting unit is further configured to add the web page to be deduplicated to the candidate web page set if there is no second web page set in the candidate web page set.
[0124] According to one or more embodiments of the present disclosure, the setting unit is further used to obtain the vector space hash value for the web page title and the web page body of the web page to be deduplicated by using the vector space hash algorithm in the following manner: performing window sliding word segmentation on the web page title and the web page body of the web page to be deduplicated, wherein the character length of each word segmentation result is equal.
[0125] According to one or more embodiments of the present disclosure, web page features include the weight of the website to which the web page belongs; and the deduplication unit is further used to select a target web page from each group of web pages to be deduplicated based on the web page features in the following manner: select the web page with the highest weight of the website to which the web page belongs from each group of web pages to be deduplicated as the target web page.
[0126] According to one or more embodiments of the present disclosure, web page features include web page publishing time; and the deduplication unit is further used to select a target web page from each group of web pages to be deduplicated based on the web page features in the following manner: for each group of web pages to be deduplicated, if the weights of the websites to which the web pages in the group of web pages to be deduplicated belong are the same, then the web page with the earliest web page publishing time is selected from the group of web pages to be deduplicated as the target web page.
[0127] According to one or more embodiments of the present disclosure, the deduplication unit is further used to select a target web page from each group of web pages to be deduplicated based on web page features in the following manner: for each group of web pages to be deduplicated, if the weights of the websites to which the web pages in the group of web pages to be deduplicated belong are the same and the web page publishing time is the same, then the web page with the earliest crawling time is selected from the group of web pages to be deduplicated as the target web page.
[0128] The units involved in the embodiments described in the present disclosure may be implemented by software or by hardware. The described units may also be set in a processor, for example, may be described as: a processor includes an acquisition unit, a setting unit, a grouping unit and a deduplication unit. Among them, the names of these units do not constitute a limitation on the unit itself under certain circumstances. For example, the grouping unit may also be described as "a unit that uses similarity flags to group the web pages to be deduplicated in the set of web pages to be deduplicated."
[0129] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, the above-mentioned features are replaced with the technical features with similar functions disclosed in the embodiments of the present disclosure (but not limited to) to form a technical solution.
Claims
1. A text deduplication method, characterized in that: include: Get the set of web pages to be deduplicated; For each web page to be deduplicated in the set of web pages to be deduplicated, extract web page features from web page data of the web page to be deduplicated, use the web page title and web page body of the web page to be deduplicated, and based on the vector space hash algorithm and the minimum common substring matching algorithm, determine whether there is a web page similar to the web page to be deduplicated in the candidate web page set, and if so, set the similar flag of the web page to be deduplicated, wherein the web page features include the web page title and the web page body, and similar web pages have the same similar flag; Using similar flags, grouping the web pages to be deduplicated in the set of web pages to be deduplicated, wherein the similar flags corresponding to the groups of web pages to be deduplicated obtained by grouping are different; Based on the web page features, a target web page is selected from each group of web pages to be deduplicated, and other web pages other than the target web page are deleted to obtain a deduplicated web page set; and The method utilizes the webpage title and webpage body of the webpage to be deduplicated, based on a vector space hash algorithm and a minimum common substring matching algorithm, to determine whether there is a webpage similar to the webpage to be deduplicated in the candidate webpage set, including: Using a vector space hash algorithm, obtain a vector space hash value for the webpage title and the webpage body of the webpage to be deduplicated; For each candidate web page in the candidate web page set, determine the Hamming distance between the vector space hash value of the web page body of the web page to be deduplicated and the vector space hash value of the web page body of the candidate web page as the first Hamming distance; Using the first Hamming distance, determining whether there is a first web page in the candidate web page set, wherein the web page body of the first web page is similar to the web page body of the web page to be deduplicated; If the first web page exists in the candidate web page set, determining that a web page similar to the web page to be deduplicated exists in the candidate web page set; If the first web page does not exist in the candidate web page set, then for each candidate web page in the candidate web page set, determining the Hamming distance between the vector space hash value of the web page title of the to-be-deduplicated web page and the vector space hash value of the web page title of the candidate web page as a second Hamming distance; Using the second Hamming distance, determining whether there is a second web page set in the candidate web page set, wherein the web page title of the second web page is similar to the web page title of the web page to be deduplicated; If the second web page set exists in the candidate web page set, for each second web page in the second web page set, a minimum common substring comparison is performed between the web page text of the second web page and the web page text of the web page to be deduplicated, to determine whether the web page text of the second web page is similar to the web page text of the web page to be deduplicated; If the web page text of the second web page is similar to the web page text of the web page to be deduplicated, it is determined that there is a web page similar to the web page to be deduplicated in the candidate web page set.
2. The method according to claim 1, characterized in that After determining whether the webpage text of the second webpage is similar to the webpage text of the webpage to be deduplicated, the method includes: If the web page text of the second web page is not similar to the web page text of the web page to be deduplicated, the web page to be deduplicated is added to the candidate web page set.
3. The method according to claim 1, characterized in that After using the second Hamming distance to determine whether a second web page set exists in the candidate web page set, the method includes: If the second web page set does not exist in the candidate web page set, the web page to be deduplicated is added to the candidate web page set.
4. The method according to claim 1, characterized in that: The method of using the vector space hash algorithm to obtain the vector space hash value of the web page title and the web page body of the web page to be deduplicated includes: The web page title and web page body of the web page to be deduplicated are segmented using a window sliding, wherein the character length of each segmentation result is equal.
5. The method according to claim 1, characterized in that The web page features include the weight of the website to which the web page belongs; as well as The step of selecting a target web page from each group of web pages to be deduplicated based on the web page features includes: From each group of web pages to be deduplicated, select the web page with the highest weight of the website to which the web page belongs as the target web page.
6. The method according to claim 5, characterized in that The web page features include the time when the web page was published; as well as The step of selecting a target web page from each group of web pages to be deduplicated based on the web page features includes: For each group of web pages to be deduplicated, if the weights of the websites to which the web pages in the group of web pages to be deduplicated belong are the same, the web page with the earliest publishing time is selected from the group of web pages to be deduplicated as the target web page.
7. The method according to claim 6, characterized in that The step of selecting a target web page from each group of web pages to be deduplicated based on the web page features includes: For each group of web pages to be deduplicated, if the weights of the websites to which the web pages in the group belong are the same and the web pages are published at the same time, the web page with the earliest crawling time is selected from the group of web pages to be deduplicated as the target web page.
8. A text deduplication device, characterized in that: include: An acquisition unit, used for acquiring a set of web pages to be deduplicated; A setting unit is used to extract web page features from web page data of each web page to be deduplicated in the set of web pages to be deduplicated, and to determine whether there is a web page similar to the web page to be deduplicated in the candidate web page set based on a vector space hash algorithm and a minimum common substring matching algorithm using the web page title and web page body of the web page to be deduplicated, and if so, to set a similar flag of the web page to be deduplicated, wherein the web page features include the web page title and the web page body, and similar web pages have the same similar flag; A grouping unit, used to group the web pages to be deduplicated in the set of web pages to be deduplicated by using similar flags, wherein the similar flags corresponding to the groups of web pages to be deduplicated obtained by grouping are different; a deduplication unit, configured to select a target web page from each group of web pages to be deduplicated based on the web page features, delete other web pages except the target web page, and obtain a deduplicated web page set; and The setting unit is further used to: use a vector space hash algorithm to obtain a vector space hash value for the web page title and the web page body of the web page to be deduplicated; For each candidate web page in the candidate web page set, determine the Hamming distance between the vector space hash value of the web page body of the web page to be deduplicated and the vector space hash value of the web page body of the candidate web page as the first Hamming distance; Using the first Hamming distance, determining whether there is a first web page in the candidate web page set, wherein the web page body of the first web page is similar to the web page body of the web page to be deduplicated; If the first web page exists in the candidate web page set, determining that a web page similar to the web page to be deduplicated exists in the candidate web page set; If the first web page does not exist in the candidate web page set, then for each candidate web page in the candidate web page set, determining the Hamming distance between the vector space hash value of the web page title of the to-be-deduplicated web page and the vector space hash value of the web page title of the candidate web page as a second Hamming distance; Using the second Hamming distance, determining whether there is a second web page set in the candidate web page set, wherein the web page title of the second web page is similar to the web page title of the web page to be deduplicated; If the second web page set exists in the candidate web page set, for each second web page in the second web page set, a minimum common substring comparison is performed between the web page text of the second web page and the web page text of the web page to be deduplicated, to determine whether the web page text of the second web page is similar to the web page text of the web page to be deduplicated; If the web page text of the second web page is similar to the web page text of the web page to be deduplicated, it is determined that there is a web page similar to the web page to be deduplicated in the candidate web page set.
9. An electronic device, characterized in that: include: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Duplicate removal method and system for news public opinions
CN110750731A
Text duplicate removal method and device and storage medium
CN113688629A
System and method for detecting duplicate data records
US20190034475A1
