ray_bts_minhash_cpp_deduplicator#
A MinHash LSH deduplicator that operates in Ray distributed mode with C++ acceleration.
Same as ray_bts_minhash_deduplicator but with tokenization and MinHash signature computation implemented in C++ for improved performance.
This operator uses the MinHash LSH technique to identify and remove near-duplicate samples from a dataset. It supports various tokenization methods, including space, punctuation, character, and sentencepiece. The Jaccard similarity threshold is used to determine if two samples are considered duplicates. If the Jaccard similarity of two samples is greater than or equal to the specified threshold, one of the samples is filtered out. The operator computes the MinHash values for each sample and uses a union- find algorithm to group similar samples. The key metric, Jaccard similarity, is computed based on the shingling of the text.
一种在 Ray 分布式模式下运行并采用 C++ 加速的 MinHash LSH 去重器。
与 ray_bts_minhash_deduplicator 相同,但其分词和 MinHash 签名计算使用 C++ 实现,以提升性能。
该算子使用 MinHash LSH 技术识别并从数据集中移除近似重复样本。它支持多种分词方法,包括空格、标点符号、字符和 sentencepiece。使用 Jaccard 相似度阈值来判断两个样本是否被视为重复:若两个样本的 Jaccard 相似度大于或等于指定阈值,则其中一个样本将被过滤掉。该算子为每个样本计算 MinHash 值,并使用并查集算法对相似样本进行分组。关键指标 Jaccard 相似度基于文本的 shingling 计算得出。
Type 算子类型: deduplicator
Tags 标签: cpu, text
🔧 Parameter Configuration 参数配置#
name 参数名 |
type 类型 |
default 默认值 |
desc 说明 |
|---|---|---|---|
|
<class ‘str’> |
|
tokenization method for sample texts. It should be one of [space, punctuation, character, sentencepiece]. For English-like languages, we recommend to use ‘space’, for Chinese-like languages, we recommend to use ‘character’, and for multiple languages, we recommend to use ‘sentencepiece’. If using ‘sentencepiece’, please provided the model path in the ‘tokenizer_model’ field. |
|
typing.Annotated[int, Gt(gt=0)] |
|
window size of shingling |
|
<class ‘bool’> |
|
whether to convert text to lower case first |
|
typing.Optional[str] |
|
whether to ignore sub-strings with specific pattern when computing minhash |
|
typing.Optional[str] |
|
path for the sentencepiece model, used for sentencepiece tokenization. |
|
typing.Annotated[int, Gt(gt=0)] |
|
number of permutations in minhash computing |
|
typing.Annotated[float, FieldInfo(annotation=NoneType, required=True, metadata=[Ge(ge=0), Le(le=1)])] |
|
the min jaccard similarity threshold in near-duplicate detection. When the jaccard similarity of two sample texts is >= this threshold, they are regarded as similar samples and this op will only keep one of them after deduplication |
|
typing.Optional[typing.Annotated[int, Gt(gt=0)]] |
|
number of bands in LSH. Default it’s None, and it will be determined by an optimal params computation algorithm by minimize the weighted sum of probs of False Positives and False Negatives |
|
typing.Optional[typing.Annotated[int, Gt(gt=0)]] |
|
number of rows in each band in LSH. Default it’s None, and it will be determined by an optimal params computation algorithm |
|
typing.Union[int, str] |
|
|
|
typing.Optional[int] |
|
|
|
typing.Optional[int] |
|
|
|
typing.Optional[int] |
|
|
|
typing.Optional[int] |
|
|
|
typing.Optional[int] |
|
|
|
typing.Optional[int] |
|
|
|
|
||
|
|