Method and apparatus for detecting original document
By segmenting documents and comparing them using multi-level hash algorithms, the limitations of existing technologies in terms of limited database coverage and low detection accuracy are solved, achieving efficient and accurate original document detection.
Patent Information
- Application Number
- CN202611256694.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-18
- Publication Date
- 2026-11-27
AI Technical Summary
Existing document originality detection methods based on keyword similarity have limited database coverage, cannot recall similar content outside the database, and have difficulty identifying documents that have undergone synonym replacement, word order adjustment, and paragraph reorganization, resulting in low detection accuracy.
By segmenting the document to be detected and multiple similar documents into blocks, using the SimHash algorithm to filter similar document blocks, and combining this with the CTPH algorithm for fine comparison, originality detection results are generated, expanding the search coverage and improving detection accuracy.
It significantly improves the accuracy and efficiency of document originality detection, distinguishing between overall plagiarism and partial similarity, and avoiding misjudging legitimately cited content as non-original documents.
Smart Images

Figure CN123178593A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information retrieval technology, and in particular to a method and apparatus for detecting original documents. Background Technology
[0002] Currently, detecting whether a target document is original is an important technical task. Common document originality detection methods mainly include keyword extraction-based similarity comparison methods: these methods segment the original and target documents, extract keywords, and then determine whether the target document is original by calculating the similarity between the keyword sets of the two documents.
[0003] However, the aforementioned keyword similarity-based detection methods typically compare documents only with documents in a fixed database. This limited database coverage means that documents with similar content outside the database cannot be recalled, leading to low detection accuracy. Furthermore, relying solely on keyword similarity to determine document originality makes it difficult for detection algorithms to effectively identify documents that, after rewriting operations such as synonym replacement, word order adjustment, and paragraph reorganization, still maintain substantial similarity to the original document, further contributing to low detection accuracy. Summary of the Invention
[0004] In view of the above problems, embodiments of this application provide a method and apparatus for detecting original documents that overcomes or at least partially solves the above problems.
[0005] In a first aspect, embodiments of this application provide a method for detecting original documents, the method comprising: The first document to be detected and the multiple second documents are respectively divided into blocks to obtain a first document block set corresponding to the first document and a second document block set corresponding to the multiple second documents; wherein, the multiple second documents are multiple similar documents obtained by the first document through similarity search of multiple data sources; The first document block set and the second document block set are respectively subjected to a first hash process to filter out a set of similar document blocks that are similar to the first document block set from the second document block set, and the set of similar document blocks is aggregated to obtain an aggregated document; The first document block set and the aggregated document are respectively subjected to a second hash process to filter out identical document blocks that are similar to the aggregated document from the first document block set; Based on the identical document blocks and the first document, the originality detection result of the first document is generated.
[0006] Secondly, embodiments of this application also provide an original document detection device, the device comprising: The processing module is used to perform block processing on the first document to be detected and the multiple second documents respectively to obtain a first document block set corresponding to the first document and a second document block set corresponding to the multiple second documents; wherein, the multiple second documents are multiple similar documents obtained by the first document through similarity search of multiple data sources; The first document block set and the second document block set are respectively subjected to a first hash process to filter out a set of similar document blocks that are similar to the first document block set from the second document block set, and the set of similar document blocks is aggregated to obtain an aggregated document; The first document block set and the aggregated document are respectively subjected to a second hash process to filter out identical document blocks that are similar to the aggregated document from the first document block set; The generation module is used to generate the originality detection result of the first document based on the similar document blocks and the first document.
[0007] Thirdly, embodiments of this application also provide an electronic device, including a memory, a transceiver, and a processor: A memory for storing computer programs; a transceiver for sending and receiving data under the control of a processor; and a processor for reading the computer programs from the memory and executing the method described in the first aspect above.
[0008] Fourthly, embodiments of this application also provide a processor-readable storage medium storing a computer program for causing the processor to perform the method described in the first aspect above.
[0009] In the above embodiments of this application, a similarity search is first performed on the first document to be detected to obtain multiple similar second documents. By performing a similarity search on the documents, second documents similar to the first document are selected from a massive number of documents, thus narrowing the candidate range for subsequent fine comparison from the full data source, reducing computational overhead, and improving detection efficiency. Furthermore, the first document and multiple second documents are segmented into blocks to obtain a set of first document blocks corresponding to the first document and a set of second document blocks corresponding to the multiple second documents. A first hash process is then applied to both the first and second document block sets to filter out similar document block sets from the second document block sets. These similar document block sets are then aggregated to obtain an aggregated document. A second hash process is then applied to both the first document block set and the aggregated document to filter out identical document blocks from the first document block set that are identical to the aggregated document. In essence, the document is split into document blocks. First, the first hash process is used to filter out a set of similar document blocks with high similarity to the first document. Then, the more accurate second hash process is used to filter out the first document blocks to be tested that have high overall similarity to the similar document block sets. This two-level document block filtering mechanism can accurately locate the identical parts in the first document, improving both the accuracy of document comparison and the detection efficiency. Furthermore, based on the similar document blocks and the first document, the originality detection result of the first document is generated. That is, by comparing the similar parts in the first document with the entire first document, the proportion of the similar parts in the whole document can be quantified, thereby distinguishing between the two different situations of overall plagiarism and partial similarity. This avoids misjudging documents containing legally cited content as non-original documents and improves the accuracy of the detection results. Attached Figure Description
[0010] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 A flowchart illustrating the original document detection method provided in this application embodiment; Figure 2 A detailed flowchart of the original document detection method provided in this application embodiment; Figure 3 A structural block diagram of the original document detection device provided in the embodiments of this application; Figure 4 A structural block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0012] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0013] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0014] The original document detection method provided in this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.
[0015] Specifically, this application provides a method for detecting original documents, such as... Figure 1 As shown, the specific steps may include the following: Step 101: The first document to be detected and the multiple second documents are respectively divided into blocks to obtain a set of first document blocks corresponding to the first document and a set of second document blocks corresponding to the multiple second documents; wherein, the multiple second documents are multiple similar documents obtained by the first document through similarity search.
[0016] Specifically, the first document to be detected is obtained, and a similarity search is performed on the first document to obtain multiple second documents similar to the first document. By performing a similarity search on the documents, second documents similar to the first document are selected from a massive number of documents, which narrows the candidate range for subsequent fine comparison from the full data source, reduces computational overhead, and improves detection efficiency.
[0017] The first document is divided into blocks by paragraphs, resulting in a set of first document blocks, which contains multiple first document blocks. Similarly, each second document is divided into blocks by paragraphs, resulting in a set of second document blocks, which contains the second document blocks corresponding to each second document. This process of splitting the first document and multiple similar second documents into document blocks allows for comparison at the document block level, effectively filtering out irrelevant content and improving the robustness and reliability of the detection results.
[0018] During the paragraph-based block processing, if a paragraph's word count is greater than or equal to the first word count threshold and less than the second word count threshold, the paragraph is treated as a single document block. If a paragraph's word count is less than the first word count threshold, it is merged with the next paragraph, and the merged paragraph is treated as a single document block. If a paragraph's word count is greater than or equal to the second word count threshold, the paragraph is split into multiple document blocks, ensuring that the word count of each resulting document block is less than the second word count threshold. The first word count threshold is less than the second word count threshold.
[0019] In one embodiment, document blocks containing a large number of characters contain more comprehensive word frequency statistics, resulting in more stable and discriminative SimHash fingerprints. Conversely, if a document block has too few characters and insufficient word frequency statistics, the robustness of the SimHash fingerprint decreases, affecting the accuracy of subsequent similarity comparisons. Therefore, based on the characteristics of the SimHash algorithm, a first character count threshold is set to ensure that the character count of each document block meets the stability requirements of the SimHash algorithm.
[0020] Step 102: Perform a first hash process on the first document block set and the second document block set respectively, so as to filter out a similar document block set that is similar to the first document block set from the second document block set, and then perform an aggregation process on the similar document block set to obtain an aggregated document.
[0021] Specifically, a first hash process is performed on each first document block in the first document block set, and the same process is applied to each second document block in the second document block set. By comparing the hash results of each first document block with the hash results of each second document block, second document blocks similar to those in the first document block set are selected from the second document block set. These selected second document blocks form a similar document block set. The second document blocks in the similar document block set are then aggregated to obtain an aggregated document, which is essentially a single aggregated document.
[0022] In one embodiment, the first hash processing specifically employs the SimHash algorithm, which has a relatively fast processing speed.
[0023] Step 103: Perform a second hash process on the first document block set and the aggregated document respectively, so as to filter out identical document blocks that are similar to the aggregated document from the first document block set.
[0024] Specifically, a second hash process is performed on each first document block in the first document block set, and a second hash process is performed on the aggregated document. By comparing the hash results of each first document block with the hash results of the aggregated document, first document blocks similar to the aggregated document are selected from the first document block set, and the selected first document blocks are regarded as identical document blocks.
[0025] In one embodiment, the second hashing process specifically employs the Context-Triggered Piecewise Hashing Algorithm (CTPH), which has a high processing accuracy.
[0026] Step 104: Based on the identical document blocks and the first document, generate the originality detection result of the first document.
[0027] Specifically, by comparing the identical document blocks in the first document with the entire first document, the proportion of identical parts in the whole document can be quantified, thereby distinguishing between the two different situations of overall plagiarism and partial similarity. This avoids misjudging documents containing legally cited content as non-original documents and improves the accuracy of detection results.
[0028] In one embodiment, the original document detection method is applied to a detection system, which includes a search crawler module and a text similarity detection module. The search crawler module is used to obtain multiple second documents most relevant to the first document from multiple data sources. The text similarity detection module is used to perform steps 101 to 104.
[0029] In the above embodiments of this application, a similarity search is first performed on the first document to be detected to obtain multiple similar second documents. By performing a similarity search on the documents, second documents similar to the first document are selected from a massive number of documents, thus narrowing the candidate range for subsequent fine comparison from the full data source, reducing computational overhead, and improving detection efficiency. Furthermore, the first document and multiple second documents are segmented into blocks to obtain a set of first document blocks corresponding to the first document and a set of second document blocks corresponding to the multiple second documents. A first hash process is then applied to both the first and second document block sets to filter out similar document block sets from the second document block sets. These similar document block sets are then aggregated to obtain an aggregated document. A second hash process is then applied to both the first document block set and the aggregated document to filter out identical document blocks from the first document block set that are identical to the aggregated document. In essence, the document is split into document blocks. First, the first hash process is used to filter out a set of similar document blocks with high similarity to the first document. Then, the more accurate second hash process is used to filter out the first document blocks to be tested that have high overall similarity to the similar document block sets. This two-level document block filtering mechanism can accurately locate the identical parts in the first document, improving both the accuracy of document comparison and the detection efficiency. Furthermore, based on the similar document blocks and the first document, the originality detection result of the first document is generated. That is, by comparing the similar parts in the first document with the entire first document, the proportion of the similar parts in the whole document can be quantified, thereby distinguishing between the two different situations of overall plagiarism and partial similarity. This avoids misjudging documents containing legally cited content as non-original documents and improves the accuracy of the detection results.
[0030] In an optional specific embodiment, the similarity search in step 101 includes: an Internet similarity search.
[0031] Specifically, similarity search includes at least an internet similarity search to detect second documents similar to the first document in an internet document repository. Similarity search may also include at least one local database to detect second documents similar to the first document in at least one local database. The local document repository is a privately stored document database.
[0032] The above embodiments, by performing similarity searches in Internet databases and local databases, overcome the technical defects of existing technologies that limit the coverage due to comparison with only a single fixed database, significantly expand the search coverage, effectively avoid the problem of missed detections caused by incomplete database coverage, and improve the reliability of detection results.
[0033] In an optional specific embodiment, the method further includes: Obtain N keywords from the first document; where N is an integer greater than 1. When N is greater than the quantity threshold, the N keywords are grouped to obtain multiple word sets; A similarity search is performed between each word set and the title of the first document to obtain multiple second documents; If N is less than or equal to the specified threshold, a similarity search is performed on the N keywords and the title of the first document to obtain multiple second documents.
[0034] Specifically, after obtaining the first document to be tested, the title of the first document is used as input to the search engine. The search engine searches for the most relevant documents, and the searched documents are sorted from highest to lowest relevance. A web crawler then crawls K1 third documents according to this sorting. The value of K1 can be set as needed, and K1 is an integer greater than 1. Keyword extraction is performed on the first document to obtain N keywords. The number of keywords N is compared with a threshold. If N is less than or equal to the threshold, the N keywords are used as input to search for the most relevant documents using a search engine. The searched documents are then sorted in descending order of relevance, and a web crawler is used to crawl K2 fourth documents according to this sorting. The value of K2 can be set as needed, and K2 is an integer greater than 1.
[0035] If N is greater than the quantity threshold, the N keywords are first grouped into T groups, with each group containing at least one keyword. The specific grouping method can be set as needed. Each group of keywords is then input into a search engine for similarity searching. For each group of keywords, the searched documents are sorted from highest to lowest relevance, and K3 fourth documents are crawled from this sorted list using a web crawler. The K3 fourth documents corresponding to each group of keywords are obtained in the same way. The value of K3 is determined by the quotient of K2 divided by T. If the quotient of K2 divided by T is not an integer, it is rounded up to the nearest integer and used as the K3 value. If the quotient of K2 divided by T is an integer, it is used as the K3 value.
[0036] The K1 third documents and K2 fourth documents are deduplicated to obtain K documents, which are the K second documents.
[0037] In one embodiment, the detection system further includes a keyword extraction module. The keyword extraction module is used to extract keywords from the first document and perform a similarity search between the keywords and the title.
[0038] The above embodiments perform grouped searches when there are many keywords, reducing the number of keywords carried in a single search, thus lowering the computational load on the search engine and improving search speed. Furthermore, each group is independent of the others; a search failure in one group does not affect the search results of other groups, improving the fault tolerance and robustness of the detection method.
[0039] In an optional specific embodiment, the step of obtaining N keywords in the first document specifically includes: The first document is segmented into words to obtain a sequence of words arranged in order; The word sequence is deduplicated to obtain M words; Obtain the co-occurrence score and inverse document frequency of each of the M words; The co-occurrence weight of each word is calculated based on its co-occurrence score and inverse document frequency. The co-occurrence weights of the M words are sorted from largest to smallest, and the words corresponding to the top N co-occurrence weights are determined as keywords; Where M is an integer greater than N.
[0040] Specifically, after obtaining the first document, the document is segmented and stop words, punctuation marks, etc., are filtered out, and keywords such as verbs and nouns are retained, thus obtaining a sequentially arranged word sequence, which includes repeated words. The word sequence is then deduplicated to obtain M unique words.
[0041] We obtain the Inverse Document Frequency (IDF) of each of the M words. IDF measures the rarity of a word within a document. We then calculate the co-occurrence score of each of the M words using the TextRank algorithm. TextRank is an unsupervised text processing algorithm based on graph ranking, used to automatically extract keywords and generate summaries from text. It requires no pre-training and evaluates the importance of units based on the internal structural relationships within the text.
[0042] For any one of the M words, multiply its co-occurrence score by its inverse document frequency to obtain its co-occurrence weight. Calculate the co-occurrence weight of each word using this method. Sort the M words by their co-occurrence weights from largest to smallest, and determine the words corresponding to the top N highest co-occurrence weights as keywords.
[0043] The co-occurrence score multiplied by the inverse document frequency is used as the co-occurrence weight. Keywords are determined by ranking the co-occurrence weights, avoiding the omission of key but low-frequency professional terms and solving the problem of long-tail keyword omission in the original algorithm.
[0044] In an optional specific embodiment, the step of obtaining the co-occurrence score of each of the M words specifically includes: For the i-th word among the M words, based on each word position of the i-th word in the word sequence, a sliding window corresponding to each word position is obtained; where i takes the value of each integer from 1 to M; where the sliding window includes the i-th word and the other words to the right of the i-th word; Using the M words as nodes, establish edges between the node corresponding to the i-th word and the nodes corresponding to the other words in each sliding window; The number of times each pair of words co-occurs in all sliding windows is counted, and the number of co-occurrences is used as the edge weight of the edge between the corresponding nodes of each pair of words to construct a co-occurrence graph; Set the same initial co-occurrence score for each node, and iteratively update the co-occurrence score of each node based on the current co-occurrence scores of its neighboring nodes and the edge weights between each node and its neighboring nodes. The co-occurrence scores of each node after iterative updates are determined as the co-occurrence scores of the words corresponding to each node.
[0045] Specifically, a co-occurrence graph is constructed using M words as nodes. During the construction of the co-occurrence graph, each word has at least one position in the word sequence, and the sliding window size is set to 2 to 8 words, with the specific number of words set as needed.
[0046] For the i-th word among M words, based on each word position of the i-th word in the word sequence, obtain the corresponding sliding window for each word position. Each sliding window includes only the i-th word and the other words to its right. An edge is established between the node of the i-th word and the nodes of the other words to its right within each sliding window; that is, the node of the i-th word only establishes an edge with the words to its right within the sliding window.
[0047] The co-occurrence count of the words corresponding to the two nodes connected by each edge is counted across all sliding windows, and this co-occurrence count is used as the edge weight between the two nodes. Furthermore, all nodes are assigned the same initial co-occurrence score, for example, 1. Based on the current co-occurrence scores of the adjacent nodes connected to each node and the edge weights between each node and its neighbors, the co-occurrence score of each node is iteratively updated. Iteration stops when a preset number of iterations is reached or the change in the co-occurrence scores of all nodes is less than a threshold, yielding the final co-occurrence score of each node. This final co-occurrence score is then used as the co-occurrence score of the words corresponding to each node.
[0048] The formula for calculating the co-occurrence fraction of each node is formula (1): (1) in, Let be the co-occurrence score of the i-th word; This is a preset damping coefficient used to ensure the convergence of the algorithm; The set of other words to the right of the i-th word; The current co-occurrence score of the j-th other word in the other word set; Let be the number of neighboring nodes of the node containing the i-th word.
[0049] In the above real-time example, by considering the order of words, the co-occurrence relationship is constructed by only considering the words to the right of the current word, in order to solve the problem of semantic information incompatibility between seemingly minor matters.
[0050] In an optional specific embodiment, step 102 performs a first hash process on the first document block set and the second document block set respectively, to filter out a set of similar document blocks from the second document block set that are similar to the first document block set, including: The first document block set and the second document block set are respectively subjected to a first hash process to obtain a first hash fingerprint corresponding to each first document block in the first document block set and a second hash fingerprint corresponding to each second document block in the second document block set; For any first document block, calculate the Hamming distance between the first hash fingerprint of the first document block and the second hash fingerprint of each second document block, and determine the second document block corresponding to the smallest Hamming distance among the Hamming distances less than the distance threshold as a similar document block similar to the first document block; A set of similar document blocks is obtained based on the similar document blocks corresponding to each first document block.
[0051] Specifically, the SimHash algorithm is used to perform a first hash operation on each first document block in the first document block set to obtain a first hash fingerprint, i.e., a SimHash fingerprint, corresponding to each first document block. Similarly, the SimHash algorithm is used to perform a first hash operation on each second document block in the second document block set to obtain a second hash fingerprint, i.e., a SimHash fingerprint, corresponding to each second document block.
[0052] For any first document block: Calculate the Hamming distance between the first hash fingerprint of the first document block and the second hash fingerprints of each second document block, thus obtaining multiple Hamming distances corresponding to the first document block. Select second document blocks whose Hamming distance is less than a distance threshold. If only one second document block is selected, it is considered a similar document block to the first document block. If multiple second document blocks are selected, the second document block with the smallest Hamming distance among them is considered a similar document block to the first document block. If the content differences between two document blocks are small, the Hamming distance between the two SimHash fingerprints is small; if the content differences between two document blocks are large, the Hamming distance between the two SimHash fingerprints is large.
[0053] By using the above method, the similar document blocks corresponding to each first document block are determined, and the similar document blocks corresponding to each first document block constitute a set of similar document blocks.
[0054] In the above embodiments, the SimHash algorithm maps high-dimensional feature vectors to low-dimensional feature vectors and determines whether documents are duplicates or highly similar by using the Hamming distance between two vectors. This avoids the complex calculation of cosine similarity or Euclidean distance between high-dimensional vectors, significantly reducing computational complexity and storage overhead, and improving comparison efficiency. Furthermore, it only requires comparing the Hamming distance between fingerprints to quickly determine whether document blocks are duplicates or highly similar, eliminating the need for word-by-word comparison and further improving comparison efficiency.
[0055] In an optional specific embodiment, step 103 performs a second hash process on the first document block set and the aggregated document respectively, to filter out identical document blocks that are similar to the aggregated document from the first document block set, including: The first document block set and the aggregated document are subjected to a second hash process to obtain a third hash fingerprint corresponding to each first document block in the first document block set and a fourth hash fingerprint corresponding to the aggregated document. For any first document block, calculate the edit distance between the third hash fingerprint and the fourth hash fingerprint of the first document block, and calculate the similarity between the first document block and the aggregated document based on the sequence length of the third hash fingerprint of the first document block, the sequence length of the fourth hash fingerprint, and the edit distance. The first document block in the first document block set whose similarity is greater than the similarity threshold is identified as a similar document block that is identical to the aggregated document.
[0056] Specifically, the CTPH algorithm is used to perform a second hashing process on each first document block in the first document block set to obtain a third hash fingerprint, i.e., the CTPH fingerprint, corresponding to each first document block. The CTPH algorithm is then used to perform a second hashing process on the aggregated documents to obtain a fourth hash fingerprint, i.e., the CTPH fingerprint, corresponding to the aggregated documents.
[0057] For any first document block: calculate the edit distance between the third hash fingerprint of the first document block and the fourth hash fingerprint of the aggregated document. Obtain the sequence length of the third hash fingerprint and the sequence length of the fourth hash fingerprint of the first document block, where the sequence length refers to the length of the hash fingerprint string. Calculate the similarity between the first document block and the aggregated document using the following formula (2): (2) in, The similarity between the first document block and the aggregated documents; To edit distance; The larger of the sequence lengths of the third hash fingerprint and the fourth hash fingerprint of the first document block.
[0058] The similarity between each first document block and the aggregated document is calculated using the method described above. Each similarity score is compared to a similarity threshold, and the first document blocks with similarities greater than the threshold are considered identical document blocks to the aggregated document. The number of such identical document blocks can be zero, one, or multiple.
[0059] In the above embodiments, CTPH is a fuzzy hashing algorithm used to detect locally similar document blocks. By using the CTPH algorithm to determine whether two document blocks are identical, it is possible to finely filter first document blocks in the first document that are highly similar to the aggregated document, thereby improving detection accuracy.
[0060] In an optional specific embodiment, step 104, based on the similar document blocks and the first document, generates an originality detection result for the first document, including: Obtain the first character count of the identical document block and the second character count of the first document; Based on the first word count and the second word count, calculate the similarity rate of the first document; If the similarity rate is less than the similarity rate threshold, an originality detection result is generated indicating that the first document is an original document. If the similarity rate is greater than or equal to the similarity rate threshold, an originality detection result is generated indicating that the first document is a non-original document.
[0061] Specifically, if there is only one identical document block, the first word count of that identical document block is obtained. If there are multiple identical document blocks, the total word count of all identical document blocks is obtained, and this total word count is used as the first word count. The total word count of the first document is obtained, and this total word count is used as the second word count. The quotient of the first word count divided by the second word count is calculated, and this quotient is converted into a percentage as the similarity rate of the first document. The similarity rate is compared with a similarity rate threshold. If the similarity rate is less than the similarity rate threshold, the first document is determined to be an original document, and an originality detection result for the first document as an original document is generated. If the similarity rate is greater than or equal to the similarity rate threshold, the first document is determined to be a non-original document, and an originality detection result for the first document as a non-original document is generated.
[0062] The above embodiments, by comparing the number of words in the identical document blocks in the first document with the total number of words in the first document, can quantify the proportion of identical parts in the whole document, thereby distinguishing between the two different situations of overall plagiarism and partial similarity, avoiding misjudging documents containing legally cited content as non-original documents, and improving the accuracy of detection results.
[0063] like Figure 2 As shown below, the detection process for the aforementioned original documents will be explained through a specific embodiment: Step 201: Perform word segmentation on the first document to obtain a sequence of words arranged in order. Perform deduplication on the word sequence to obtain M words.
[0064] In a specific example, the document to be tested is first parsed to obtain its content and title; the content constitutes the first document. The first document is then segmented, stop words are removed, and nouns and verbs are retained.
[0065] Step 202: For the i-th word among the M words, take each word position of the i-th word in the word sequence as the basis and obtain the sliding window corresponding to each word position respectively; the sliding window includes the i-th word and the other words to the right of the i-th word; take the M words as nodes and establish edges between the node corresponding to the i-th word and the nodes corresponding to the other words in each sliding window respectively; count the number of co-occurrences of each pair of words in all sliding windows, and use the number of co-occurrences as the edge weight of the edge between the corresponding nodes of each pair of words to construct a co-occurrence graph.
[0066] In a specific example, a co-occurrence graph is constructed using M words as nodes: For the i-th word among the M words, the sliding window only includes the i-th word and the other words to the right of the i-th word; within the sliding window, edges are established between the i-th word and the words that co-occur with the i-th word, and the edge weight is set to the number of times the two words co-occur in all sliding windows.
[0067] Step 203: Set the same initial co-occurrence score for each node, and iteratively update the co-occurrence score of each node based on the current co-occurrence scores of the neighboring nodes of each node and the edge weights between each node and its neighboring nodes; determine the co-occurrence score of each node after the iterative update as the co-occurrence score of the word corresponding to each node.
[0068] In a specific example, the initial co-occurrence score of each node is set to 1. The co-occurrence scores of each node are iteratively updated using formula (1). The final co-occurrence scores of each node after the iterative update are used as the co-occurrence scores of the words corresponding to each node.
[0069] Step 204: Obtain the inverse document frequency of each of the M words. Based on the co-occurrence score and inverse document frequency of each word, calculate the co-occurrence weight of each word. Sort the co-occurrence weights of the M words from largest to smallest and determine the words corresponding to the top N co-occurrence weights as keywords.
[0070] In a specific example, the co-occurrence score of each word is multiplied by its corresponding inverse document frequency to obtain the co-occurrence weight of each word. The co-occurrence weight of each word is calculated in the above manner. The co-occurrence weights of the M words are sorted from largest to smallest, and the words corresponding to the top N co-occurrence weights are determined as keywords.
[0071] Step 205: Perform similarity searches on the N keywords and the title of the first document to obtain multiple duplicate second documents.
[0072] In a specific example, the question is input into a search engine to search for highly relevant documents. The top K1 third documents are obtained through web crawling. N keywords are used in the search engine to obtain the K2 fourth documents with the strongest relevance. The K1 third documents and K2 fourth documents are deduplicated to obtain K documents, which are the K second documents.
[0073] Step 206: Divide the first document to be detected and the multiple second documents into blocks to obtain a set of first document blocks corresponding to the first document and a set of second document blocks corresponding to the multiple second documents; perform a first hashing process on the first document block set and the second document block set using the SimHash algorithm to obtain the SimHash fingerprints corresponding to each first document block in the first document block set and each second document block in the second document block set; for any first document block, calculate the Hamming distance between the SimHash fingerprint of the first document block and the SimHash fingerprints of each second document block, and determine the second document block corresponding to the smallest Hamming distance among the Hamming distances less than the distance threshold as a similar document block similar to the first document block; based on the similar document blocks corresponding to each first document block, obtain a set of similar document blocks, and aggregate the set of similar document blocks to obtain an aggregated document.
[0074] In a specific example, the SimHash fingerprints of each first document block and each second document block are first calculated using the SimHash algorithm. Then, similar second document blocks are selected by comparing the Hamming distance between the first and second document blocks. By using this method, similar second document blocks corresponding to each first document block are determined. This allows for a quick determination of whether document blocks are duplicated or highly similar simply by comparing the Hamming distance between fingerprints, eliminating the need for word-by-word comparison and improving comparison efficiency.
[0075] Step 207: Perform a second hashing process on the first document block set and the aggregated document using the CTPH algorithm to obtain the CTPH fingerprints corresponding to each first document block in the first document block set and the CTPH fingerprints corresponding to the aggregated document; for any first document block, calculate the edit distance between the CTPH fingerprint of the first document block and the CTPH fingerprint of the aggregated document, and calculate the similarity between the first document block and the aggregated document based on the sequence length of the CTPH fingerprint of the first document block, the sequence length of the CTPH fingerprint of the aggregated document, and the edit distance; identify the first document blocks in the first document block set whose similarity is greater than the similarity threshold as identical document blocks that are identical to the aggregated document.
[0076] In a specific example, during the second hashing process using the CTPH algorithm, each document block is further divided according to punctuation marks to calculate the CTPH fingerprint of each document block. The similarity is calculated by the edit distance between each first document block and the aggregated document; that is, the CTPH algorithm determines whether two document blocks are identical. This allows for more precise filtering of first document blocks in the first document that are highly similar to the aggregated document, improving detection accuracy.
[0077] Step 208: Obtain the first word count of the identical document block and the second word count of the first document; calculate the similarity rate of the first document based on the first word count and the second word count.
[0078] In a specific example, the first word count of all identical document blocks is counted, and combined with the second word count of the entire first document, the similarity rate of the first document is calculated.
[0079] Step 209: If the similarity rate is less than the similarity rate threshold, generate an originality detection result indicating that the first document is an original document.
[0080] In a specific example, if the similarity rate is less than the set similarity rate threshold, the first document is considered to be an original document.
[0081] Step 210: If the similarity rate is greater than or equal to the similarity rate threshold, generate an originality detection result for the first document as a non-original document.
[0082] In a specific example, if the similarity rate is greater than or equal to the set similarity rate threshold, the first document is considered to be a non-original document with a risk of plagiarism.
[0083] In summary, the embodiments described above in this application extract keywords representing the core information of documents, facilitating search engine searches for the most relevant documents. The document title is a crucial representation of the document's theme; by inputting the title into the search engine to query relevant documents, combined with keyword searches, the robustness of the overall detection is improved. When there are many keywords, they are grouped, and each group is searched separately to increase search coverage. Since the most relevant documents or web pages are searched and ranked at the top by the search engine, only the top K documents need to be detected. Comparing massive amounts of content is transformed into comparing only K documents, significantly reducing computational load and improving detection speed. First, the extremely fast SimHash algorithm is used to filter out a set of similar document blocks with high similarity to the first document. Then, the more accurate CTPH algorithm is used to filter out the first document block to be tested with high overall similarity to the set of similar document blocks. This two-level document block filtering mechanism can accurately locate the identical parts in the first document. Through two-level hash fingerprint comparison, duplicate detection of massive amounts of internet content can be quickly achieved, enabling rapid and accurate originality detection of documents.
[0084] The above describes the original document detection method provided by the embodiments of this application. The original document detection device provided by the embodiments of this application will be described below with reference to the accompanying drawings.
[0085] like Figure 3 As shown in the illustration, this application also provides an original document detection device 300, the device comprising: The processing module 301 is used to perform block processing on the first document to be detected and the multiple second documents respectively to obtain a first document block set corresponding to the first document and a second document block set corresponding to the multiple second documents; wherein, the multiple second documents are multiple similar documents obtained by the first document through similarity search of multiple data sources; The first document block set and the second document block set are respectively subjected to a first hash process to filter out a set of similar document blocks that are similar to the first document block set from the second document block set, and the set of similar document blocks is aggregated to obtain an aggregated document; The first document block set and the aggregated document are respectively subjected to a second hash process to filter out identical document blocks that are similar to the aggregated document from the first document block set; The generation module 302 is used to generate the originality detection result of the first document based on the similar document blocks and the first document.
[0086] Optionally, the similarity search includes: Internet similarity search.
[0087] Optionally, the device further includes: The acquisition module is used to acquire N keywords from the first document; where N is an integer greater than 1. The grouping module is used to group the N keywords into multiple word sets when N is greater than a quantity threshold. The search module is used to perform a similarity search on each word set and the title of the first document to obtain multiple second documents; The search module is further configured to perform a similarity search on the N keywords and the title of the first document when N is less than or equal to the quantity threshold, thereby obtaining multiple second documents.
[0088] Optionally, when the acquisition module acquires N keywords from the first document, it is specifically used to: The first document is segmented into words to obtain a sequence of words arranged in order; The word sequence is deduplicated to obtain M words; Obtain the co-occurrence score and inverse document frequency of each of the M words; The co-occurrence weight of each word is calculated based on its co-occurrence score and inverse document frequency. The co-occurrence weights of the M words are sorted from largest to smallest, and the words corresponding to the top N co-occurrence weights are determined as keywords; Where M is an integer greater than N.
[0089] Optionally, when obtaining the co-occurrence score of each word among the M words, the acquisition module is specifically used for: For the i-th word among the M words, based on each word position of the i-th word in the word sequence, a sliding window corresponding to each word position is obtained; where i takes the value of each integer from 1 to M; where the sliding window includes the i-th word and the other words to the right of the i-th word; Using the M words as nodes, establish edges between the node corresponding to the i-th word and the nodes corresponding to the other words in each sliding window; The number of times each pair of words co-occurs in all sliding windows is counted, and the number of co-occurrences is used as the edge weight of the edge between the corresponding nodes of each pair of words to construct a co-occurrence graph; Set the same initial co-occurrence score for each node, and iteratively update the co-occurrence score of each node based on the current co-occurrence scores of its neighboring nodes and the edge weights between each node and its neighboring nodes. The co-occurrence scores of each node after iterative updates are determined as the co-occurrence scores of the words corresponding to each node.
[0090] Optionally, when the processing module 301 performs a first hash process on the first document block set and the second document block set respectively, in order to filter out a set of similar document blocks from the second document block set that are similar to the first document block set, it is specifically used for: The first document block set and the second document block set are respectively subjected to a first hash process to obtain a first hash fingerprint corresponding to each first document block in the first document block set and a second hash fingerprint corresponding to each second document block in the second document block set; For any first document block, calculate the Hamming distance between the first hash fingerprint of the first document block and the second hash fingerprint of each second document block, and determine the second document block corresponding to the smallest Hamming distance among the Hamming distances less than the distance threshold as a similar document block similar to the first document block; A set of similar document blocks is obtained based on the similar document blocks corresponding to each first document block.
[0091] Optionally, when the processing module 301 performs a second hash process on the first document block set and the aggregated document respectively to filter out identical document blocks that are similar to the aggregated document from the first document block set, it is specifically used for: The first document block set and the aggregated document are subjected to a second hash process to obtain a third hash fingerprint corresponding to each first document block in the first document block set and a fourth hash fingerprint corresponding to the aggregated document. For any first document block, calculate the edit distance between the third hash fingerprint and the fourth hash fingerprint of the first document block, and calculate the similarity between the first document block and the aggregated document based on the sequence length of the third hash fingerprint of the first document block, the sequence length of the fourth hash fingerprint, and the edit distance. The first document block in the first document block set whose similarity is greater than the similarity threshold is identified as a similar document block that is identical to the aggregated document.
[0092] Optionally, when generating the originality detection result of the first document based on the similar document blocks and the first document, the generation module 302 is specifically used for: Obtain the first character count of the identical document block and the second character count of the first document; Based on the first word count and the second word count, calculate the similarity rate of the first document; If the similarity rate is less than the similarity rate threshold, an originality detection result is generated indicating that the first document is an original document. If the similarity rate is greater than or equal to the similarity rate threshold, an originality detection result is generated indicating that the first document is a non-original document.
[0093] It should be noted that the original document detection device provided in this application embodiment can implement all the method steps implemented in the original document detection method embodiment and can achieve the same technical effect. Therefore, the parts and beneficial effects that are the same as those in the method embodiment will not be described in detail here.
[0094] It should be noted that the division of units in the embodiments of this application is illustrative and only represents one logical functional division. In actual implementation, other division methods may be used. Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated units described above can be implemented in hardware or as software functional units.
[0095] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a processor-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0096] like Figure 4 As shown, embodiments of this application also provide an electronic device, including a memory 420, a transceiver 410, and a processor 400: Memory 420 is used to store computer programs; Transceiver 410 is used to send and receive data under the control of the processor; Processor 400 is configured to read a computer program from memory and execute the steps of the original document detection method as described in any of the above embodiments.
[0097] Among them, Figure 4 In this context, the bus architecture can include any number of interconnected buses and bridges, specifically linking various circuits together, represented by one or more processors (processor 400) and memory (memory 420). The bus architecture can also link various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. The bus interface provides an interface. The transceiver 410 can be multiple elements, including transmitters and receivers, providing a unit for communicating with various other devices over transmission media, including wireless channels, wired channels, optical fibers, etc. The processor 400 is responsible for managing the bus architecture and general processing, and the memory 420 can store data used by the processor 400 during operation.
[0098] The processor 400 can be a central processing unit (CPU), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or a complex programmable logic device (CPLD). The processor can also adopt a multi-core architecture.
[0099] The processor executes the original document detection method provided in this application embodiment by calling a computer program stored in memory, according to the obtained executable instructions. The processor and memory can also be physically separated.
[0100] It should be noted that the electronic device provided in this application embodiment can implement all the method steps implemented in the above original document detection method embodiment and can achieve the same technical effect. Here, the parts that are the same as those in the method embodiment and the beneficial effects will not be described in detail.
[0101] Embodiments of this application also provide a processor-readable storage medium storing a computer program for causing the processor to execute the aforementioned method for detecting original documents.
[0102] The processor-readable storage medium can be any available medium or data storage device that the processor can access, including but not limited to magnetic memory (e.g., floppy disk, hard disk, magnetic tape, magneto-optical disk (MO)), optical memory (e.g., CD, DVD, BD, HVD), and semiconductor memory (e.g., ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), solid-state drive (SSD)).
[0103] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.
[0104] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-executable instructions. These computer-executable instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0105] These processor-executable instructions may also be stored in a processor-readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the processor-readable memory produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0106] These processors can execute instructions that can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable device for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0107] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A method for detecting original documents, characterized in that, The method includes: The first document to be detected and the multiple second documents are respectively divided into blocks to obtain a first document block set corresponding to the first document and a second document block set corresponding to the multiple second documents; wherein, the multiple second documents are multiple similar documents obtained from the first document through similarity search; The first document block set and the second document block set are respectively subjected to a first hash process to filter out a set of similar document blocks that are similar to the first document block set from the second document block set, and the set of similar document blocks is aggregated to obtain an aggregated document; The first document block set and the aggregated document are respectively subjected to a second hash process to filter out identical document blocks that are similar to the aggregated document from the first document block set; Based on the identical document blocks and the first document, the originality detection result of the first document is generated.
2. The method according to claim 1, characterized in that, The similarity search includes: Internet similarity search.
3. The method according to claim 1, characterized in that, The method further includes: Obtain N keywords from the first document; where N is an integer greater than 1. When N is greater than the quantity threshold, the N keywords are grouped to obtain multiple word sets; A similarity search is performed between each word set and the title of the first document to obtain multiple second documents; If N is less than or equal to the specified threshold, a similarity search is performed on the N keywords and the title of the first document to obtain multiple second documents.
4. The method according to claim 3, characterized in that, The step of obtaining N keywords from the first document includes: The first document is segmented into words to obtain a sequence of words arranged in order; The word sequence is deduplicated to obtain M words; Obtain the co-occurrence score and inverse document frequency of each of the M words; The co-occurrence weight of each word is calculated based on its co-occurrence score and inverse document frequency. The co-occurrence weights of the M words are sorted from largest to smallest, and the words corresponding to the top N co-occurrence weights are determined as keywords. Where M is an integer greater than N.
5. The method according to claim 4, characterized in that, The step of obtaining the co-occurrence score of each of the M words includes: For the i-th word among the M words, based on each word position of the i-th word in the word sequence, a sliding window corresponding to each word position is obtained; where i takes the value of each integer from 1 to M; where the sliding window includes the i-th word and the other words to the right of the i-th word; Using the M words as nodes, establish edges between the node corresponding to the i-th word and the nodes corresponding to the other words in each sliding window; The number of times each pair of words co-occurs in all sliding windows is counted, and the number of co-occurrences is used as the edge weight of the edge between the corresponding nodes of each pair of words to construct a co-occurrence graph; Set the same initial co-occurrence score for each node, and iteratively update the co-occurrence score of each node based on the current co-occurrence scores of its neighboring nodes and the edge weights between each node and its neighboring nodes. The co-occurrence scores of each node after iterative updates are determined as the co-occurrence scores of the words corresponding to each node.
6. The method according to claim 1, characterized in that, The step of performing a first hash process on the first document block set and the second document block set respectively, in order to filter out a set of similar document blocks from the second document block set that are similar to the first document block set, includes: The first document block set and the second document block set are respectively subjected to a first hash process to obtain a first hash fingerprint corresponding to each first document block in the first document block set and a second hash fingerprint corresponding to each second document block in the second document block set; For any first document block, calculate the Hamming distance between the first hash fingerprint of the first document block and the second hash fingerprint of each second document block, and determine the second document block corresponding to the smallest Hamming distance among the Hamming distances less than the distance threshold as a similar document block similar to the first document block; A set of similar document blocks is obtained based on the similar document blocks corresponding to each first document block.
7. The method according to claim 1, characterized in that, The step of performing a second hash process on the first document block set and the aggregated document respectively, to filter out identical document blocks that are similar to the aggregated document from the first document block set, includes: The first document block set and the aggregated document are subjected to a second hash process to obtain a third hash fingerprint corresponding to each first document block in the first document block set and a fourth hash fingerprint corresponding to the aggregated document. For any first document block, calculate the edit distance between the third hash fingerprint and the fourth hash fingerprint of the first document block, and calculate the similarity between the first document block and the aggregated document based on the sequence length of the third hash fingerprint of the first document block, the sequence length of the fourth hash fingerprint, and the edit distance. The first document block in the first document block set whose similarity is greater than the similarity threshold is identified as a similar document block that is identical to the aggregated document.
8. The method according to claim 1, characterized in that, The step of generating the originality detection result of the first document based on the similar document blocks and the first document includes: Obtain the first character count of the identical document block and the second character count of the first document; Based on the first word count and the second word count, calculate the similarity rate of the first document; If the similarity rate is less than the similarity rate threshold, an originality detection result is generated indicating that the first document is an original document. If the similarity rate is greater than or equal to the similarity rate threshold, an originality detection result is generated indicating that the first document is a non-original document.
9. A device for detecting original documents, characterized in that, The device includes: The processing module is used to perform block processing on the first document to be detected and the multiple second documents respectively to obtain a first document block set corresponding to the first document and a second document block set corresponding to the multiple second documents; wherein, the multiple second documents are multiple similar documents obtained by the first document through similarity search of multiple data sources; The first document block set and the second document block set are respectively subjected to a first hash process to filter out a set of similar document blocks that are similar to the first document block set from the second document block set, and the set of similar document blocks is aggregated to obtain an aggregated document; The first document block set and the aggregated document are respectively subjected to a second hash process to filter out identical document blocks that are similar to the aggregated document from the first document block set; The generation module is used to generate the originality detection result of the first document based on the similar document blocks and the first document.
10. An electronic device, characterized in that, Includes memory, transceiver, and processor: Memory, used to store computer programs; Transceiver, used to send and receive data under the control of the processor; A processor for reading a computer program from the memory and executing the original document detection method as described in any one of claims 1 to 8.
11. A processor-readable storage medium, characterized in that, The processor-readable storage medium stores a computer program for causing the processor to perform the original document detection method as described in any one of claims 1 to 8.
