Download the PHP package swatchion/simhash without Composer
On this page you can find all versions of the php package swatchion/simhash. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download swatchion/simhash
More information about swatchion/simhash
Files in swatchion/simhash
Download swatchion/simhash
More information about swatchion/simhash
Files in swatchion/simhash
Vendor swatchion
Package simhash
Short Description A PHP implementation of SimHash algorithm for fast document similarity detection
License MIT
Package simhash
Short Description A PHP implementation of SimHash algorithm for fast document similarity detection
License MIT
Please rate this library. Is it a good library?
Informations about the package simhash
SimHash PHP Library
一个高效的 PHP 8.0+ SimHash 算法实现库,用于快速文档相似性检测和去重。
功能特点
- 🚀 高性能的 SimHash 算法实现
- 📊 支持文本相似度计算和比较
- 🔧 灵活的配置选项(哈希位数、K-shingles)
- 🌍 支持中文和多语言文本处理
- 📦 标准 Composer 包,易于集成
- ✅ 完整的单元测试覆盖
- 📖 详细的文档和示例
安装
使用 Composer 安装:
快速开始
基本使用
高级使用
API 参考
SimHash 类
构造函数
主要方法
hash(string $text): string- 生成文本的SimHash值similarity(string $text1, string $text2): float- 计算两个文本的相似度百分比isSimilar(string $text1, string $text2, float $threshold = 85.0): bool- 判断两个文本是否相似hammingDistance(string $hash1, string $hash2): int- 计算两个哈希值的汉明距离toHex(string $binaryHash): string- 转换为十六进制fromHex(string $hexHash): string- 从十六进制转换回二进制
SimHashFactory 类
便捷的静态方法:
SimHashFactory::create(): SimHash- 创建默认实例SimHashFactory::similarity(string $text1, string $text2): float- 快速相似度计算SimHashFactory::isSimilar(string $text1, string $text2, float $threshold = 85.0): bool- 快速相似性判断
算法原理
SimHash 是一种局部敏感哈希算法,具有以下特点:
- 相似文档生成相似的哈希值
- 通过汉明距离快速比较相似性
- 适合大规模文档去重和相似性检测
性能特点
- 时间复杂度: O(n),其中 n 是文本长度
- 空间复杂度: O(1)
- 支持大规模文档处理
- 内存占用低
开发
运行测试
代码分析
许可证
MIT License
贡献
欢迎提交 Issue 和 Pull Request!
All versions of simhash with dependencies
PHP Build Version
Package Version
Requires
php Version
>=8.0
ext-mbstring Version *
ext-mbstring Version *
The package swatchion/simhash contains the following files
Loading the files please wait ...