Given a list of embedding vectors and a cosine-similarity threshold, perform greedy semantic deduplication. Iterate over the embeddings in their given order and keep a sample only if its maximum cosine similarity to all previously kept samples is strictly less than the threshold. Otherwise discard it.
Implement greedy_semantic_dedup(embeddings, threshold) where:
embeddings is a list (or 2D array-like) of shape (N, D) of real-valued vectors.threshold is a float in [-1.0, 1.0].The cosine similarity between two vectors and is
If either vector has zero norm, treat their cosine similarity as 0.0. The first sample is always kept (it has no predecessors). Use only NumPy and pure Python.