# US 2025/0165536 A1 · Automated near-duplicate detection for text documents

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2025/0165536 A1
- Document ID: US20250165536A1
- Status: Published application
- Kind: A1
- Application number: 18/896,244
- Filed: 2024-09-25
- Published: 2025-05-22
- Earliest claimed: 2023-08-23
- Assignees: SAS Institute Inc.
- Applicants: SAS Institute Inc.
- Inventors: Fan Wang; Teresa S. Jade; Xu Yang
- Web page: https://patentgrep.com/patent/US20250165536A1

## CPC

- G06F 16/906: Clustering; Classification
- G06F 16/93: Document management systems
- G06F 16/355: Creation or modification of classes or clusters
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Techniques described herein provide for automated detection of near-duplicate documents. In one example, a system can cluster documents into a set of clusters based on character frequencies associated with the documents. For a given cluster, the system can generate first similarity scores associated with every pair of documents in the cluster. The system can then select a filtered group of documents associated with first similarity scores that meet or exceed a first predefined similarity threshold. Next, the system can convert the filtered group of documents into matrix representations. The system can generate second similarity scores for every pair of matrix representations. The system can then identify documents, from among the filtered group of documents, associated with second similarity scores that meet or exceed a second predefined similarity threshold. The identified documents can be duplicate or near-duplicate text documents.

## Claims

### Claim 1

A system comprising:
one or more processors; and
one or more memories including program code that is executable by the one or more processors for causing the one or more processors to:
cluster a plurality of documents into a plurality of clusters based on a respective set of character frequencies corresponding to each document of the plurality of documents, such that each cluster in the plurality of clusters includes a respective subset of documents selected from the plurality of documents; and
for at least one cluster of the plurality of clusters, execute operations including:
generating first similarity scores representing first similarities between every pair of documents in the respective subset of documents assigned to the at least one cluster;
selecting a filtered group of documents, from among the respective subset of documents assigned to the at least one cluster, for which the first similarity scores meet or exceed a first predefined similarity threshold;
converting each document in the filtered group of documents into a corresponding matrix representation, to generate a plurality of matrix representations of the filtered group of documents; and
generating second similarity scores representing second similarities between every pair of matrix representations in the plurality of matrix representations; and
selecting a set of similar documents, from among the filtered group of documents, for which the second similarity scores meet or exceed a second predefined similarity threshold; and
outputting identifiers of the set of similar documents.

### Claim 2 (depends on 1)

The system of claim 1, wherein the one or more memories further include program code that is executable by the one or more processors for causing the one or more processors to:
execute the operations for each cluster of the plurality of clusters, to determine a respective set of similar documents associated with each cluster of the plurality of clusters.

### Claim 3 (depends on 1)

The system of claim 1, wherein the one or more memories further include program code that is executable by the one or more processors for causing the one or more processors to:
prior to clustering the plurality of documents into the plurality of clusters:
determine a frequency of each character of a language in each document of the plurality of documents;
store the frequency of each character in each document of the plurality of documents in a data structure; and
remove, from the data structure, rows or columns for which all values are zero, to thereby generate a reduced data structure; and
provide the reduced data structure as input to a clustering algorithm, the clustering algorithm being configured to classify the plurality of documents into the plurality of clusters based on the reduced data structure.

### Claim 4 (depends on 1)

The system of claim 1, wherein the one or more memories further include program code that is executable by the one or more processors for causing the one or more processors to:
generate term frequency and inverse document frequency (TF-IDF) values for the respective subset of documents assigned to the at least one cluster;
determine pairwise cosine similarities between the TF-IDF values, wherein the pairwise cosine similarities serve as the first similarity scores; and
select the filtered group of documents, from among the respective subset of documents assigned to the at least one cluster, based on their pairwise cosine similarities meeting or exceeding the first predefined similarity threshold.

### Claim 5 (depends on 1)

The system of claim 1, wherein the one or more memories further include program code that is executable by the one or more processors for causing the one or more processors to convert the filtered group of documents into the plurality of matrix representations by:
for each document in the filtered group of documents:
determining frequency vectors for unique characters in the document, each of the frequency vectors being associated with a corresponding unique character in the document, and each of the frequency vectors indicating respective frequencies of neighboring characters within a predefined window adjacent to the corresponding unique character in the document; and
generating a matrix representation of the document based on the frequency vectors.

### Claim 6 (depends on 1)

The system of claim 1, wherein the one or more memories further include program code that is executable by the one or more processors for causing the one or more processors to generate the second similarity scores by:
for each pair of matrix representations in the plurality of matrix representations:
removing, from a first matrix and a second matrix in the pair of matrix representations, rows or columns for which all values are zero;
determining an absolute difference matrix having absolute values of differences between each row of the first matrix and the second matrix;
determining a mean matrix having means of each row of the first matrix and the second matrix;
dividing the absolute difference matrix by the mean matrix to determine a resulting matrix;
generating a row-mean vector by determining a respective mean of each row of the resulting matrix; and
determining a second similarity score, among the second similarity scores, based on at least the row-mean vector.

### Claim 7 (depends on 6)

The system of claim 6, wherein the one or more memories further include program code that is executable by the one or more processors for causing the one or more processors to generate the second similarity scores by:
for each pair of matrix representations in the plurality of matrix representations:
generating a row-sum vector by determining a respective sum of each row of the resulting matrix;
generating a row-weight vector by dividing the row-sum vector by a sum of the resulting matrix;
generating a swapped-weight vector by swapping an Nth highest value in the row-weight vector with the Nth lowest value of the row-weight vector; and
determining the second similarity score based on the row-mean vector and the swapped-weight vector.

### Claim 8 (depends on 7)

The system of claim 7, wherein the one or more memories further include program code that is executable by the one or more processors for causing the one or more processors to determine the second similarity score based on the row-mean vector and the swapped-weight vector by:
determining a cross product of the row-mean vector and the swapped-weight vector;
determining a summation of the cross product; and
subtracting the summation from the number 1.

### Claim 9 (depends on 1)

The system of claim 1, wherein the one or more memories further include program code that is executable by the one or more processors for causing the one or more processors to, prior to clustering the plurality of documents into the plurality of clusters:
receive a group of documents written in a corresponding language;
determine that the corresponding language is one of a predefined set of languages having fewer than a threshold number of characters;
in response to determining that the corresponding language is one of the predefined set of languages, convert any uppercase characters in the group of documents to lowercase letters to thereby generate converted documents; and
use the converted documents as the plurality of documents.

### Claim 10 (depends on 1)

The system of claim 1, wherein the one or more memories further include program code that is executable by the one or more processors for causing the one or more processors to, prior to clustering the plurality of documents:
receive a document written in a first language;
determine that the first language is one of a predefined set of languages having greater than a threshold number of characters; and
in response to determining that the first language is one of the predefined set of languages:
for each respective token of a plurality of tokens in the document:
determine a transliterated representation of the respective token by converting the respective token from the first language to a second language, the second language having less than the threshold number of characters;
determine a preliminary Unicode representation of the respective token;
remove duplicate characters from the preliminary Unicode representation to generate a final Unicode representation for the respective token; and
generate a combined representation for the respective token by concatenating the transliterated representation and the final Unicode representation;
generate a modified document that includes the combined representation for each respective token of the plurality of tokens; and
use the modified document as one of the plurality of documents.

### Claim 11

A method comprising:
clustering, by one or more processors, a plurality of documents into a plurality of clusters based on a respective set of character frequencies corresponding to each document of the plurality of documents, such that each cluster in the plurality of clusters includes a respective subset of documents selected from the plurality of documents; and
for at least one cluster of the plurality of clusters, execute operations including:
generating, by the one or more processors, first similarity scores representing first similarities between every pair of documents in the respective subset of documents assigned to the at least one cluster;
selecting, by the one or more processors, a filtered group of documents, from among the respective subset of documents assigned to the at least one cluster, for which the first similarity scores meet or exceed a first predefined similarity threshold;
converting, by the one or more processors, each document in the filtered group of documents into a corresponding matrix representation, to generate a plurality of matrix representations of the filtered group of documents; and
generating, by the one or more processors, second similarity scores representing second similarities between every pair of matrix representations in the plurality of matrix representations; and
selecting, by the one or more processors, a set of similar documents, from among the filtered group of documents, for which the second similarity scores meet or exceed a second predefined similarity threshold; and
outputting, by the one or more processors, identifiers of the set of similar documents.

### Claim 12 (depends on 11)

The method of claim 11, further comprising:
execute the operations for each cluster of the plurality of clusters, to determine a respective set of similar documents associated with each cluster of the plurality of clusters.

### Claim 13 (depends on 11)

The method of claim 11, further comprising:
prior to clustering the plurality of documents into the plurality of clusters:
determining a frequency of each character of a language in each document of the plurality of documents;
storing the frequency of each character in each document of the plurality of documents in a data structure; and
removing, from the data structure, rows or columns for which all values are zero, to thereby generate a reduced data structure; and
providing the reduced data structure as input to a clustering algorithm, the clustering algorithm being configured to classify the plurality of documents into the plurality of clusters based on the reduced data structure.

### Claim 14 (depends on 11)

The method of claim 11, further comprising:
generating term frequency and inverse document frequency (TF-IDF) values for the respective subset of documents assigned to the at least one cluster;
determining pairwise cosine similarities between the TF-IDF values, wherein the pairwise cosine similarities serve as the first similarity scores; and
selecting the filtered group of documents, from among the respective subset of documents, based on their pairwise cosine similarities meeting or exceeding the first predefined similarity threshold.

### Claim 15 (depends on 11)

The method of claim 11, further comprising converting the filtered group of documents into the plurality of matrix representations by:
for each document in the filtered group of documents:
determining frequency vectors for unique characters in the document, each of the frequency vectors being associated with a corresponding unique character in the document, and each of the frequency vectors indicating respective frequencies of neighboring characters within a predefined window adjacent to the corresponding unique character in the document; and
generating a matrix representation of the document based on the frequency vectors.

### Claim 16 (depends on 11)

The method of claim 11, further comprising generating the second similarity scores by:
for each pair of matrix representations in the plurality of matrix representations:
removing, from a first matrix and a second matrix in the pair of matrix representations, rows or columns for which all values are zero;
determining an absolute difference matrix having absolute values of differences between each row of the first matrix and the second matrix;
determining a mean matrix having means of each row of the first matrix and the second matrix;
dividing the absolute difference matrix by the mean matrix to determine a resulting matrix;
generating a row-mean vector by determining a respective mean of each row of the resulting matrix; and
determining a second similarity score, among the second similarity scores, based on at least the row-mean vector.

### Claim 17 (depends on 16)

The method of claim 16, further comprising generating the second similarity scores by:
for each pair of matrix representations in the plurality of matrix representations:
generating a row-sum vector by determining a respective sum of each row of the resulting matrix;
generating a row-weight vector by dividing the row-sum vector by a sum of the resulting matrix;
generating a swapped-weight vector by swapping an Nth highest value in the row-weight vector with the Nth lowest value of the row-weight vector; and
determining the second similarity score based on the row-mean vector and the swapped-weight vector.

### Claim 18 (depends on 17)

The method of claim 17, further comprising determining the second similarity score based on the row-mean vector and the swapped-weight vector by:
determining a cross product of the row-mean vector and the swapped-weight vector;
determining a summation of the cross product; and
subtracting the summation from the number 1.

### Claim 19 (depends on 11)

The method of claim 11, further comprising, prior to clustering the plurality of documents into the plurality of clusters:
receiving a group of documents written in a corresponding language;
determining that the corresponding language is one of a predefined set of languages having fewer than a threshold number of characters;
in response to determining that the corresponding language is one of the predefined set of languages, converting any uppercase characters in the group of documents to lowercase letters to thereby generate converted documents; and
using the converted documents as the plurality of documents.

### Claim 20 (depends on 11)

The method of claim 11, further comprising, prior to clustering the plurality of documents:
receiving a document written in a first language;
determining that the first language is one of a predefined set of languages having greater than a threshold number of characters; and
in response to determining that the first language is one of the predefined set of languages:
for each respective token of a plurality of tokens in the document:
determining a transliterated representation of the respective token by converting the respective token from the first language to a second language, the second language having less than the threshold number of characters;
determining a preliminary Unicode representation of the respective token;
removing duplicate characters from the preliminary Unicode representation to generate a final Unicode representation for the respective token; and
generating a combined representation for the respective token by concatenating the transliterated representation and the final Unicode representation;
generating a modified document that includes the combined representation for each respective token of the plurality of tokens; and
using the modified document as one of the plurality of documents.

### Claim 21

A non-transitory computer-readable medium comprising program code that is executable by one or more processors for causing the one or more processors to:
cluster a plurality of documents into a plurality of clusters based on a respective set of character frequencies corresponding to each document of the plurality of documents, such that each cluster in the plurality of clusters includes a respective subset of documents selected from the plurality of documents; and
for at least one cluster of the plurality of clusters, execute operations including:
generating first similarity scores representing first similarities between every pair of documents in the respective subset of documents assigned to the at least one cluster;
selecting a filtered group of documents, from among the respective subset of documents, for which the first similarity scores meet or exceed a first predefined similarity threshold;
converting each document in the filtered group of documents into a corresponding matrix representation, to generate a plurality of matrix representations of the filtered group of documents; and
generating second similarity scores representing second similarities between every pair of matrix representations in the plurality of matrix representations; and
selecting a set of similar documents, from among the filtered group of documents, for which the second similarity scores meet or exceed a second predefined similarity threshold; and
outputting identifiers of the set of similar documents.

### Claim 22 (depends on 21)

The non-transitory computer-readable medium of claim 21, further comprising program code that is executable by the one or more processors for causing the one or more processors to:
execute the operations for each cluster of the plurality of clusters, to determine a respective set of similar documents associated with each cluster of the plurality of clusters.

### Claim 23 (depends on 21)

The non-transitory computer-readable medium of claim 21, further comprising code that is executable by the one or more processors for causing the one or more processors to:
prior to clustering the plurality of documents into the plurality of clusters:
determine a frequency of each character of a language in each document of the plurality of documents;
store the frequency of each character in each document of the plurality of documents in a data structure; and
remove, from the data structure, rows or columns for which all values are zero, to thereby generate a reduced data structure; and
provide the reduced data structure as input to a clustering algorithm, the clustering algorithm being configured to classify the plurality of documents into the plurality of clusters based on the reduced data structure.

### Claim 24 (depends on 21)

The non-transitory computer-readable medium of claim 21, further comprising program code that is executable by the one or more processors for causing the one or more processors to:
generate term frequency and inverse document frequency (TF-IDF) values for the respective subset of documents assigned to the at least one cluster;
determine pairwise cosine similarities between the TF-IDF values, wherein the pairwise cosine similarities serve as the first similarity scores; and
select the filtered group of documents, from among the respective subset of documents assigned to the at least one cluster, based on their pairwise cosine similarities meeting or exceeding the first predefined similarity threshold.

### Claim 25 (depends on 21)

The non-transitory computer-readable medium of claim 21, further comprising program code that is executable by the one or more processors for causing the one or more processors to convert the filtered group of documents into the plurality of matrix representations by:
for each document in the filtered group of documents:
determining frequency vectors for unique characters in the document, each of the frequency vectors being associated with a corresponding unique character in the document, and each of the frequency vectors indicating respective frequencies of neighboring characters within a predefined window adjacent to the corresponding unique character in the document; and
generating a matrix representation of the document based on the frequency vectors.

### Claim 26 (depends on 21)

The non-transitory computer-readable medium of claim 21, further comprising program code that is executable by the one or more processors for causing the one or more processors to generate the second similarity scores by:
for each pair of matrix representations in the plurality of matrix representations:
removing, from a first matrix and a second matrix in the pair of matrix representations, rows or columns for which all values are zero;
determining an absolute difference matrix having absolute values of differences between each row of the first matrix and the second matrix;
determining a mean matrix having means of each row of the first matrix and the second matrix;
dividing the absolute difference matrix by the mean matrix to determine a resulting matrix;
generating a row-mean vector by determining a respective mean of each row of the resulting matrix; and
determining a second similarity score, among the second similarity scores, based on at least the row-mean vector.

### Claim 27 (depends on 26)

The non-transitory computer-readable medium of claim 26, further comprising program code that is executable by the one or more processors for causing the one or more processors to generate the second similarity scores by:
for each pair of matrix representations in the plurality of matrix representations:
generating a row-sum vector by determining a respective sum of each row of the resulting matrix;
generating a row-weight vector by dividing the row-sum vector by a sum of the resulting matrix;
generating a swapped-weight vector by swapping an Nth highest value in the row-weight vector with the Nth lowest value of the row-weight vector; and
determining the second similarity score based on the row-mean vector and the swapped-weight vector.

### Claim 28 (depends on 27)

The non-transitory computer-readable medium of claim 27, further comprising program code that is executable by the one or more processors for causing the one or more processors to determine the second similarity score based on the row-mean vector and the swapped-weight vector by:
determining a cross product of the row-mean vector and the swapped-weight vector;
determining a summation of the cross product; and
subtracting the summation from the number 1.

### Claim 29 (depends on 21)

The non-transitory computer-readable medium of claim 21, further comprising program code that is executable by the one or more processors for causing the one or more processors to, prior to clustering the plurality of documents into the plurality of clusters:
receive a group of documents written in a corresponding language;
determine that the corresponding language is one of a predefined set of languages having fewer than a threshold number of characters;
in response to determining that the corresponding language is one of the predefined set of languages, convert any uppercase characters in the group of documents to lowercase letters to thereby generate converted documents; and
use the converted documents as the plurality of documents.

### Claim 30 (depends on 21)

The non-transitory computer-readable medium of claim 21, further comprising program code that is executable by the one or more processors for causing the one or more processors to, prior to clustering the plurality of documents:
receive a document written in a first language;
determine that the first language is one of a predefined set of languages having greater than a threshold number of characters; and
in response to determining that the first language is one of the predefined set of languages:
for each respective token of a plurality of tokens in the document:
determine a transliterated representation of the respective token by converting the respective token from the first language to a second language, the second language having less than the threshold number of characters;
determine a preliminary Unicode representation of the respective token;
remove duplicate characters from the preliminary Unicode representation to generate a final Unicode representation for the respective token; and
generate a combined representation for the respective token by concatenating the transliterated representation and the final Unicode representation;
generate a modified document that includes the combined representation for each respective token of the plurality of tokens; and
use the modified document as one of the plurality of documents.
