A method and system for deduplicating massive short texts

Through MinHash coding and bucketing technology, combined with multi-level distance threshold and K-Means method, the problem of high vector library storage and calculation pressure in deduplication of massive short texts is solved, and efficient deduplication analysis and fast detection rate are achieved.

CN118331950BActive Publication Date: 2024-08-27CHENGDU SUGAR FREE INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410750394.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-12
Publication Date
2024-08-27
Estimated Expiration
2044-06-12

AI Technical Summary

Technical Problem

The existing technology has problems such as excessive vector library storage pressure and recall calculation pressure, and too slow detection speed when processing massive amounts of short text. In particular, real-time similarity recall cannot be achieved when processing hundreds of millions of vectors and tens of millions of vectors.

Method used

Adopt the MinHash encoding scheme to encode text into MinHash vectors, and build indexes through bucketing technology of temporary and persistent vector libraries. Combined with multi-level distance thresholds and K-Means methods, streaming data is cached for batch processing to reduce the number of global database queries. , using shorter MinHash encoding scheme and bucketing technology to reduce storage and computing pressure.

Benefits of technology

It achieves efficient deduplication analysis of massive short texts within limited resources, reduces storage pressure and recall calculation pressure, improves detection rate, and improves similarity recall accuracy of ultra-short texts through multi-level distance threshold and bucketing technology. Spend.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118331950B
    Figure CN118331950B
Patent Text Reader

Abstract

The present invention discloses a method and system for deduplication of massive short texts. The first step is to pre-process the texts to facilitate subsequent calculations; the second step is to use the MinHash scheme to encode the texts into MinHash vectors; the third step is to store the MinHash vectors generated in the second step into a MinHash vector library, which is divided into a temporary vector library and a persistent vector library; the fourth step is to set a multi-level distance threshold, and use the bucketing technology to index the MinHash vector library; the fifth step is to cache streaming data, and after accumulating a certain amount of data, form batch data, and perform deduplication analysis on the batch data to end the process. The present invention solves the problems of inaccurate short text positioning, high vector storage cost and high recall calculation cost in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of network texts, and in particular relates to a method and system for deduplicating massive short texts. Background Art

[0002] With the rapid development of information technology, a huge amount of text data has been generated on the Internet, including a large number of short texts, such as Tieba, Weibo, and video comments. These text characters are usually between 10 and 500 characters long, which are called short texts. They also include a small number of long texts of 500 to 4000 characters and ultra-short texts of less than 10 characters. The number of these texts is very large, but there are often a lot of repeated content, such as advertisements and spam posts. This not only takes up storage space, but also increases the difficulty of information retrieval and analysis.

[0003] Text deduplication is a technique for identifying text pairs with a character similarity threshold less than a certain threshold. This technique includes steps such as text feature extraction and similarity recall.

[0004] Existing text deduplication algorithms mainly use characters and words as features, project text into vector space, and then use vector distance to measure the similarity of text. However, for short texts, especially ultra-short texts with less than 10 characters, there is a vector sparsity problem. At this time, vector similarity cannot accurately reflect the similarity of texts. In addition, due to the high storage cost and recall calculation cost of these vectors, it is impossible to index hundreds of millions of vectors within limited resources, nor is it possible to perform real-time similarity recall on tens of millions of vectors per day. Therefore, new methods are needed to perform similarity deduplication analysis on short text data in real time. Summary of the invention

[0005] In view of the problems in the prior art of excessive storage pressure of the vector library and recall calculation pressure, and slow detection speed, the present invention proposes a method and system for deduplication of massive short texts. To achieve the above purpose, the technical solution adopted by the present invention is:

[0006] A method for deduplication of massive short texts, the first step is to pre-process the text to facilitate subsequent operations; the second step is to use the MinHash scheme to encode the text into a MinHash vector; the third step is to store the MinHash vector generated in the second step into a MinHash vector library, which is divided into a temporary vector library and a persistent vector library; the fourth step is to set a multi-level distance threshold, and use the bucketing technology to index the MinHash vector library; the fifth step is to cache streaming data, and after accumulating a certain amount of data and forming batch data, perform deduplication analysis on the batch data to end the process.

[0007] Preferably, the first step of preprocessing the text includes the following steps:

[0008] Add start and end tags at the beginning and end of the text; convert traditional Chinese characters to simplified Chinese; replace the numbers before the quantifier with regular expressions; split the text to obtain all character segments that are no longer than the preset length.

[0009] Preferably, the second step includes the following steps:

[0010] First, different hash functions are used, each of which maps a byte string of any length into a binary space of bytes of a preset length;

[0011] Apply the hash function to all character fragments. The hash function takes the smallest value, and the hash function obtains the same number of hash values. Arrange them in the order of the hash function to obtain the MinHash vector.

[0012] Preferably, the temporary vector library in the third step only stores vectors of a certain batch of data, and the space is released when the batch operation of the stored vectors of the batch of data ends; the persistent vector library stores vectors of global data.

[0013] Preferably, both the temporary vector library and the persistent vector library have several buckets, each bucket stores several vectors, a vector is stored in and only exists in one bucket, each bucket has a bucket center, and the bucket center is obtained by training the randomly sampled MinHash vectors using the K-Means method.

[0014] Preferably, the detailed process of the fourth step is as follows: first input the text, then use the method in the second step to obtain the MinHash vector of the text, and define it as the query vector; then calculate the distance between each bucket center of the vector library and the query vector, and select the bucket centers with the closest distance of a specific value, traverse all the vectors in the bucket, and calculate the distance between each vector and the query vector; when there is a vector whose distance with the query vector is less than the distance threshold, exit the traversal process in the fourth step, and then determine that the texts represented by the two vectors are similar and repeated; if the traversal is completed and there is no vector whose distance with the query vector is less than the threshold, then it is determined that the text represented by the query vector is not similar and repeated with any historical text data, and the query vector is inserted into the bucket with the smallest distance to the query vector.

[0015] Preferably, in the fifth step, the specific process is as follows: first, cache the streaming data and form batch data, assuming that the batch data has B texts; input the batch data into the second step to obtain the MinHash vectors of all texts; traverse the MinHash vectors, use the temporary vector library and the method in the fourth step to obtain all similar text pairs; use the text corresponding to the first stored MinHash vector as the cluster center, and classify all similar text pairs into the corresponding cluster. The number of cluster centers is i, i is less than or equal to B; traverse all cluster centers, use the persistent vector library and the method in the fourth step to recall all similar text pairs in the cluster center, and the process ends.

[0016] Preferably, when the cache cycle ends or the cache data volume reaches a preset number, the current batch cache is stopped, and batch data is formed at this time.

[0017] Preferably, in the fifth step, if there is a similar text in the cluster center, then all the texts in the cluster are determined to be similar and repeated with the recalled similar text; if there is no similar text, then all the texts in the cluster are determined to be similar and repeated with the cluster center.

[0018] A massive short text deduplication system, including the following modules:

[0019] Preprocessing module:

[0020] Add start and end tags at the beginning and end of the text, convert the text into simplified Chinese, use regular expressions to replace the numbers before the quantifiers, and finally segment the text to obtain all character segments that are not greater than the specified length;

[0021] Vector encoding module:

[0022] Use N different hash functions, each of which maps a byte string of any length into a binary space of M bytes; then apply the hash function to all character fragments, taking the smallest value, and N hash functions will get N hash values, which are arranged in the order of the hash functions to get the MinHash vector;

[0023] MinHash vector library module:

[0024] The MinHash vector library is divided into a temporary vector library and a persistent vector library; each vector library has several buckets, each bucket stores several vectors, a vector is stored in and only exists in one bucket, and each bucket has a bucket center. The K-Means method is used to train the randomly sampled MinHash vectors to obtain the bucket center.

[0025] Similar recall module:

[0026] First, input the text, and use the vector encoding module to obtain the MinHash vector of the text, called the query vector; and calculate the applicable multi-level threshold according to the length of the text; then calculate the distance between each bucket center of the vector library and the query vector; then select the first n_query bucket centers with the closest distance, traverse all the vectors in the bucket, and calculate the distance between each vector and the query vector; when there is a vector whose distance with the query vector is less than the distance threshold, exit the traversal process and determine that the texts represented by the two vectors are similar and repeated; if the traversal is completed and there is no vector whose distance with the query vector is less than the threshold, then it is determined that the text represented by the query vector is not similar and repeated with any historical text data, and the query vector is inserted into the bucket with the smallest distance.

[0027] Data batch processing

[0028] First, cache the streaming data. When the cache cycle ends or the cached data volume reaches a certain number, stop caching the current batch and form batch data. Suppose the batch data has B texts. Input the batch data into the vector encoding module to obtain the MinHash vectors of all texts. Traverse the MinHash vectors and use the temporary vector library and the similarity recall module to obtain all similar text pairs. Take the text corresponding to the first vector stored in the library as the cluster center and classify all similar text pairs into the corresponding cluster. Suppose the number of cluster centers is i, i is less than or equal to B. Traverse all cluster centers and use the persistent vector library and the similarity recall module to recall similar text pairs in all cluster centers. If a cluster center has similar text, then all texts in the cluster are determined to be similar and repeated with the recalled similar text. If no similar text exists, then all texts in the cluster are determined to be similar and repeated with the cluster center and the process ends.

[0029] Compared with the prior art, the technical solution of the present invention has the following advantages / benefits:

[0030] 1. Using a shorter MinHash encoding scheme, each text data only occupies 50 bytes, which can greatly reduce the storage pressure and recall calculation pressure of the vector library.

[0031] 2. Cache streaming data and then batch process it, first perform repeated analysis locally to form similar groups, and then perform repeated analysis on similar groups globally. This can reduce the number of queries to the global database and significantly reduce the computing power requirements in the recall phase.

[0032] 3. Use multi-level distance thresholds. When the number of text characters is too small, set a smaller distance threshold to make the recalled text more similar, avoiding the situation where ultra-short texts are judged similar due to a small number of character changes.

[0033] 4. When recalling similar vectors, a strategy that meets the distance threshold requirement, i.e., determines similar repetitions, can be used to terminate the traversal early, avoid redundant calculations, and greatly improve the detection rate. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0035] Figure 1 The present invention is a flow chart of a method for deduplicating massive short texts.

[0036] Figure 2The present invention is a flow chart of a system for deduplicating massive short texts.

[0037] Figure 3 It is a schematic diagram of the data batch processing process used in the present invention. DETAILED DESCRIPTION

[0038] In order to make the purpose, technical solutions and advantages of the present invention clearer, the technical solutions in the embodiments of the present invention are clearly and completely described below. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present invention. Therefore, the detailed description of the embodiments of the present invention provided below is not intended to limit the scope of the claimed invention, but merely represents the selected embodiments of the present invention.

[0039] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and thus, once an item is defined in one drawing, it may not be further defined or explained in the subsequent drawings.

[0040] Embodiment 1:

[0041] like Figure 1 As shown in the figure, a method for removing duplicates from massive short texts:

[0042] The first step is to pre-process the text by adding start and end tags at the beginning and end of the text; convert traditional Chinese characters into simplified Chinese characters; replace the numbers before the quantifiers with regular expressions, for example, replace 3 yuan with x yuan; segment the text to obtain all character segments that are not greater than the specified length. The preset length in this embodiment is 3. The result of this step on the sample string "abcde" is: "a", "b", "c", "d", "e", "ab", "bc", "cd", "de", "abc", "bcd", "cde". The second step is to use the MinHash scheme to encode the text into a MinHash vector. This method uses a shorter MinHash encoding scheme, and each text data only occupies 50 bytes, which can greatly reduce the storage pressure and recall calculation pressure of the vector library. First, use N different hash functions. Each hash function maps a byte string of any length into a binary space of M bytes. In this example, N is 50 and M is 1. Apply the hash function to all character fragments and take the smallest value. N hash functions will get N hash values, which are arranged in the order of the hash functions to get the MinHash vector.

[0043] The third step is to store the MinHash vectors generated in the second step into the temporary vector library and the persistent vector library. The temporary vector library only stores vectors of a batch of data and releases the space when the batch job ends; the persistent vector library stores vectors of global data. Both the temporary vector library and the persistent vector library have several buckets, each of which stores several vectors. A vector is stored in and only exists in one bucket. Each bucket has a bucket center. The K-Means method is used to train the randomly sampled MinHash vectors to obtain the bucket center.

[0044] The fourth step is to set multi-level distance thresholds and use bucketing technology to index the MinHash vector library. Specifically, first input the text, and then use the method in the second step to obtain the MinHash vector of the text, that is, the query vector.

[0045] Then, the applicable multi-level threshold is calculated according to the length of the text. The shorter the text, the smaller the distance threshold is applied. The multi-level threshold calculation method in this example is: 0.05 for lengths of 2-5, 0.15 for lengths of 6-10, 0.2 for lengths of 11-30, and 0.25 for lengths above 30. Then, the distance between each bucket center of the vector library and the query vector is calculated. This distance can be one of Hamming and Jaccard (Hamming distance is used in this example), and the bucket center with the closest distance of a specific value is selected. All vectors in the bucket are traversed to calculate the distance between each vector and the query vector. When there is a vector whose distance with the query vector is less than the distance threshold, the traversal process in the fourth step is exited, and the texts represented by the two vectors are determined to be similar and repeated. If the traversal is completed and there is no vector whose distance with the query vector is less than the threshold, it is determined that the text represented by the query vector is not similar and repeated with any historical text data, and the query vector is inserted into the bucket with the smallest distance.

[0046] The fifth step is to cache streaming data, form batch data after accumulating a certain amount of data, and perform deduplication analysis on the batch data to end the process. By caching streaming data and then performing batch processing, first perform repeated analysis locally to form similar groups, and then perform global repeated analysis on similar groups, this can reduce the number of queries to the global database and significantly reduce the computing power requirements in the recall stage.

[0047] like Figure 3As shown in the figure, the specific process of data batch processing is as follows: first, cache the streaming data and form batch data. Assume that the batch data has B texts; input the batch data into the second step to obtain the MinHash vectors of all texts; traverse the MinHash vectors, use the temporary vector library and the method in the fourth step to obtain all similar text pairs; take the text corresponding to the first vector stored in the library as the cluster center, and classify all similar text pairs into the corresponding cluster. The number of cluster centers is i, i is less than or equal to B; traverse all cluster centers, use the persistent vector library and the method in the fourth step to recall the similar text pairs of all cluster centers, and the process ends. When the cache cycle ends or the cached data volume reaches a certain number, the batch cache is stopped, and the batch data is formed at this time. In this step, if there is a similar text in a cluster center, all the texts in the cluster are determined to be similar and repeated with the recalled similar text; if there is no similar text, all the texts in the cluster are determined to be similar and repeated with the cluster center.

[0048] By caching streaming data and then performing batch processing, repeated analysis is first performed locally to form similar groups, and then similar groups are globally repeated. This can reduce the number of queries to the global database and significantly reduce the computing power requirements during the recall phase.

[0049] Using multi-level distance thresholds, when the number of text characters is too small, a smaller distance threshold is set to make the recalled text more similar, avoiding the situation where ultra-short texts are judged similar due to a small number of character changes.

[0050] When recalling similar vectors, a strategy of determining similar repetitions by satisfying the distance threshold requirement is used, which can end the traversal early, avoid redundant calculations, and greatly improve the detection rate.

[0051] This method uses a data batch processing process, first caching real-time streaming data as batch data, then performing local deduplication analysis on the batch data to generate similar groups, and finally performing global deduplication analysis on the similar groups;

[0052] This method uses an optimized MinHash encoding scheme, uses a hash function with more than 50 and less than 100, and the byte length of each hash value is 1, which can not only maintain the similarity measurement performance of short texts, but also save a lot of storage space and computing time;

[0053] This method uses multi-level distance thresholds, which can flexibly cope with scene data with variable text lengths; it uses the k-means bucketing method to recall similar data, and returns the result when data less than the distance threshold is detected in the database, reducing the amount of calculation in the recall stage.

[0054] Example 2: Figure 2 As shown, a massive short text deduplication system includes the following modules:

[0055] Preprocessing module:

[0056] Add start and end tags at the beginning and end of the text, convert the text into simplified Chinese, use regular expressions to replace the numbers before the quantifiers, and finally segment the text to obtain all character segments that are not greater than the specified length;

[0057] Vector encoding module:

[0058] Use N different hash functions, each of which maps a byte string of any length into a binary space of M bytes; then apply the hash function to all character fragments, taking the smallest value, and N hash functions will get N hash values, which are arranged in the order of the hash functions to get the MinHash vector;

[0059] This module uses MinHash technology to encode the character segments obtained by the preprocessing module into vectors. Jaccard, Hamming, and L2 can be used to measure the distance between two vectors. When the distance between two MinHash vectors is less than a certain distance threshold, the texts represented by the two vectors are judged to be similar.

[0060] An optimized MinHash parameter scheme is used. There are two key parameters in MinHash encoding that affect short texts: the number of hash functions and the length of the hash value. The number of bytes occupied by each MinHash vector is equal to the number of hash functions multiplied by the length of the hash value. Reducing the values ​​of the above two parameters will reduce the computational and storage costs of the vector, but too small parameter values ​​will affect the recall quality of the vector. After experiments, when the number of hash functions is 50 and the hash value length is 1 byte, the computational and storage costs can be greatly reduced without significantly affecting the recall quality.

[0061] MinHash vector library module:

[0062] Stores the MinHash vector encoded by the vector encoding module to facilitate calculation by the vector recall module.

[0063] The MinHash vector library is divided into a temporary vector library and a persistent vector library; the temporary vector library only stores vectors of a batch of data and is released when the batch job ends, while the persistent vector library stores vectors of global data; each vector library has several buckets, each bucket stores several vectors, a vector exists in and only in one bucket, and each bucket has a bucket center. The K-Means method is used to train the randomly sampled MinHash vectors to obtain the bucket center.

[0064] Similar recall module:

[0065] First, input the text, and use the vector encoding module to obtain the MinHash vector of the text, called the query vector; and calculate the applicable multi-level threshold according to the length of the text; then calculate the distance between each bucket center of the vector library and the query vector; then select the bucket center with the closest distance of the previous specific value, traverse all the vectors in the bucket, and calculate the distance between each vector and the query vector; when there is a vector whose distance with the query vector is less than the distance threshold, exit the traversal process and determine that the texts represented by the two vectors are similar and repeated; if the traversal is completed and there is no vector whose distance with the query vector is less than the threshold, then it is determined that the text represented by the query vector is not similar and repeated with any historical text data, and the query vector is inserted into the bucket with the smallest distance.

[0066] By setting multi-level distance thresholds, the shorter the text, the smaller the threshold, which can improve the accuracy of short text similarity recall. Use bucketing technology to index the MinHash vector library. When a MinHash vector is input, quickly find and return similar vectors with a distance less than the threshold in the MinHash vector library. If at least one similar vector is recalled, it is determined that the query text is similar to the text corresponding to the vector that meets the distance threshold constraint. If no vector that meets the distance threshold is recalled, the query vector is inserted.

[0067] Data batch processing module:

[0068] like Figure 3 As shown in the figure, firstly, the streaming data is cached. When the cache cycle ends or the cached data volume reaches a certain number, the current batch cache is stopped to form batch data. Assume that the batch data has B texts; the batch data is input into the vector encoding module to obtain the MinHash vectors of all texts; the MinHash vectors are traversed, and the temporary vector library and the similar recall module are used to obtain all similar text pairs; the text corresponding to the first vector stored in the library is used as the cluster center, and all similar text pairs are classified into the corresponding clusters; the number of cluster centers is set to i, i is less than or equal to B; all cluster centers are traversed, and the persistent vector library and the similar recall module are used to recall the similar text pairs of all cluster centers; if a cluster center has similar text, then all the texts in the cluster are determined to be similar and repeated with the recalled similar text; if there is no similar text, then all the texts in the cluster are determined to be similar and repeated with the cluster center, and the process ends.

[0069] The beginning of a batch job is marked by the establishment of a temporary vector library. The temporary vector library and the recall module realize the internal repeated analysis of the batch data. The persistent vector library and the recall module can make global corrections to the aforementioned internal repeated analysis results. The end mark is the acquisition of the global repeated analysis results of this batch of data.

[0070] The above are only preferred embodiments of the present invention. It should be noted that the above preferred embodiments should not be regarded as limiting the present invention, and the protection scope of the present invention should be based on the scope defined by the claims. For ordinary technicians in this technical field, several improvements and modifications can be made without departing from the spirit and scope of the present invention, and these improvements and modifications should also be regarded as the protection scope of the present invention.

Claims

1. A method for deduplicating massive short texts. It is characterized in that The first step is to pre-process the text to facilitate subsequent operations; the second step is to use the MinHash scheme to encode the text into a MinHash vector; the third step is to store the MinHash vector generated in the second step into the MinHash vector library, which is divided into a temporary vector library and a persistent vector library; the fourth step is to set a multi-level distance threshold and use the bucketing technology to index the MinHash vector library; the fifth step is to cache streaming data, accumulate a certain amount of data and form batch data, and perform deduplication analysis on the batch data to end the process; The temporary vector library in the third step only stores vectors of a certain batch of data, and releases the space when the batch operation of the vectors of the stored batch of data ends; the persistent vector library stores vectors of global data; The detailed process of the fourth step is as follows: first input the text, then use the method of the second step to obtain the MinHash vector of the text, and define it as a query vector; then calculate the distance between each bucket center of the vector library and the query vector, and select the bucket centers with the closest distance of a specific value, traverse all the vectors in the bucket, and calculate the distance between each vector and the query vector; when there is a vector whose distance with the query vector is less than the distance threshold, exit the traversal process in the fourth step, and then determine that the texts represented by the two vectors are similar and repeated; if the traversal is completed, and there is no vector whose distance with the query vector is less than the threshold, then it is determined that the text represented by the query vector is not similar and repeated with any historical text data, and the query vector is inserted into the bucket with the smallest distance to the query vector; In the fifth step, the specific process is as follows: first, cache the streaming data and form batch data, assuming that the batch data has B texts; input the batch data into the second step to obtain the MinHash vectors of all texts; traverse the MinHash vectors, use the temporary vector library and the method of the fourth step to obtain all similar text pairs; take the text corresponding to the first MinHash vector stored in the library as the cluster center, and classify all similar text pairs into the corresponding cluster; The number of cluster centers is i, i is less than or equal to B; traverse all cluster centers, use the persistent vector library and the method in step 4 to recall similar text pairs of all cluster centers, and the process ends; In the fifth step, if there is a similar text in the cluster center, then all the texts in the cluster are determined to be similar and repeated with the recalled similar text; if there is no similar text, then all the texts in the cluster are determined to be similar and repeated with the cluster center.

2. A method for deduplicating massive short texts according to claim 1, It is characterized in that The first step of text preprocessing includes the following steps: Add start and end tags at the beginning and end of the text; convert traditional Chinese characters to simplified Chinese; replace the numbers before the quantifier with regular expressions; split the text to obtain all character segments that are no longer than the preset length.

3. A method for deduplicating massive short texts according to claim 1, It is characterized in that The second step includes the following steps: First, different hash functions are used, each of which maps a byte string of any length into a binary space of bytes of a preset length; Apply the hash function to all character fragments. The hash function takes the smallest value, and the hash function obtains the same number of hash values. Arrange them in the order of the hash function to obtain the MinHash vector.

4. A method for deduplicating massive short texts according to claim 1, It is characterized in that The temporary vector library and the persistent vector library both have several buckets, each bucket stores several vectors, a vector is stored in and only exists in one bucket, each bucket has a bucket center, and the bucket center is obtained by training the randomly sampled MinHash vectors using the K-Means method.

5. A method for deduplicating massive short texts according to claim 1, It is characterized in that When the cache cycle ends or the cached data volume reaches a preset number, the current batch cache is stopped and batch data is formed.

6. A system for deduplicating massive short texts. It is characterized in that Includes the following modules: Preprocessing module: Add start and end tags at the beginning and end of the text, convert the text into simplified Chinese, use regular replacement rules to replace the numbers before the quantifier, and finally segment the text to obtain all character segments that are not greater than the preset length; Vector encoding module: Use different hash functions, each of which maps byte strings of any length into a binary space of a preset byte length; then apply the hash function to all character fragments, take the smallest value, and the hash function will get the same number of hash values, arrange them in the order of the hash function, and get the MinHash vector; MinHash vector library module: The MinHash vector library is divided into a temporary vector library and a persistent vector library. The temporary vector library only stores the MinHash vectors of a batch of data and is released when the batch job ends. The persistent vector library stores the MinHash vectors of global data. Each vector library has several buckets, each bucket stores several vectors, and a vector is stored in and only exists in one bucket. Each bucket has a bucket center, and the K-Means method is used to train the randomly sampled MinHash vectors to obtain the bucket center. Similar recall module: First, input the text, and use the vector encoding module to obtain the MinHash vector of the text, called the query vector; and calculate the applicable multi-level threshold according to the length of the text; then calculate the distance between each bucket center of the vector library and the query vector; then select the first n_query bucket centers with the closest distance, traverse all the vectors in the bucket, and calculate the distance between each vector and the query vector; when there is a vector whose distance with the query vector is less than the distance threshold, exit the traversal process and determine that the texts represented by the two vectors are similar and repeated; if the traversal is completed and there is no vector whose distance with the query vector is less than the threshold, then it is determined that the text represented by the query vector is not similar and repeated with any historical text data, and the query vector is inserted into the bucket with the smallest distance; Data batch processing module: First, cache the streaming data. When the cache cycle ends or the cached data volume reaches a certain number, stop caching the current batch and form batch data. Assume that the batch data has B texts. Input the batch data into the vector encoding module to obtain the MinHash vectors of all texts. Traverse the MinHash vectors and use the temporary vector library and similarity recall module to obtain all similar text pairs. Take the text corresponding to the first vector stored in the library as the cluster center and classify all similar text pairs into the corresponding cluster. set up The number of cluster centers is i, i is less than or equal to B; all cluster centers are traversed, and similar text pairs of all cluster centers are recalled using the persistent vector library and similar recall module; if a cluster center has similar text, all texts in the cluster are determined to be similar and repeated with the recalled similar text; if no similar text exists, all texts in the cluster are determined to be similar and repeated with the cluster center, and the process ends.