
com.magictools.core.text.Simhash Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of magic-tools-all Show documentation
Show all versions of magic-tools-all Show documentation
magic-tools 是一个小而全的Java工具类库,通过静态方法封装,降低相关API的学习成本,提高工作效率,使Java拥有函数式语言般的优雅,让Java语言也可以“甜甜的”。
The newest version!
package com.magictools.core.text;
import com.magictools.core.lang.hash.MurmurHash;
import java.math.BigInteger;
import java.util.*;
import java.util.concurrent.locks.StampedLock;
/**
*
* Simhash是一种局部敏感hash,用于海量文本去重。
* 算法实现来自:https://github.com/xlturing/Simhash4J
*
*
*
* 局部敏感hash定义:假定两个字符串具有一定的相似性,在hash之后,仍然能保持这种相似性,就称之为局部敏感hash。
*
*
* @author Looly, litaoxiao
* @since 4.3.3
*/
public class Simhash {
private final int bitNum = 64;
/** 存储段数,默认按照4段进行simhash存储 */
private final int fracCount;
private final int fracBitNum;
/** 汉明距离的衡量标准,小于此距离标准表示相似 */
private final int hammingThresh;
/** 按照分段存储simhash,查找更快速 */
private final List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy