Skip to main content

data_curation

Version: v1.3.0 | Status: Active | Last Updated: March 2026

Overview​

MinHash-based near-duplicate detection and deduplication for text corpora. Implements the Broder (1997) MinHash algorithm with Locality-Sensitive Hashing (LSH) for sub-quadratic similarity search. Pure Python + NumPy, no external NLP dependencies.

Key Components​

ComponentFileDescription
MinHashminhash.pyMinHash signature generator (universal hashing, character n-gram shingling)
LSHIndexminhash.pyLSH index for fast candidate pair generation via banding
DataCuratorminhash.pyEnd-to-end deduplication pipeline (hash → index → deduplicate)

Quick Start​

from codomyrmex.data_curation import DataCurator

curator = DataCurator(similarity_threshold=0.8)
unique_texts, stats = curator.deduplicate([
"The quick brown fox jumps over the lazy dog",
"The quick brown fox leaps over the lazy dog", # near-duplicate
"Completely different text about machine learning",
])
print(f"Kept {stats['unique_documents']}/{stats['total_documents']}")

MCP Tools​

ToolDescription
data_curation_deduplicateDeduplicate a text list using MinHash + LSH
data_curation_similarityEstimate Jaccard similarity between two texts

Directory Contents​

FilePurpose
minhash.pyCore MinHash, LSHIndex, and DataCurator implementations (182 lines)
mcp_tools.pyMCP tool definitions (2 tools)
__init__.pyPublic exports: DataCurator, LSHIndex, MinHash