opctim/php-nilsimsa

A PHP implementation of the Nilsimsa hash.

1.0.4 2019-05-08 10:11 UTC

This package is auto-updated.

Last update: 2024-05-24 11:44:21 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

php-nilsimsa

PHP library to calculate and compare Nilsimsa digests.

The Nilsimsa hash is a locality senstive hash function. Generally similar documents will have similar Nilsimsa digests. The Hamming distance between the digests can be used to approximate the similarity between documents. For further information consult http://en.wikipedia.org/wiki/Nilsimsa_Hash and the references (particularly Damiani et al.)

Implementation details:

The Nilsimsa class takes in a data parameter which is the string of the document to digest Calling the methods hexdigest() and digest() give the nilsimsa digests in hex or array format. The helper function compare_digests takes in two digests and computes the Nilsimsa score. You can also use compare_files() and compare_strings() to compare files and strings directly.

This code is a port of py-nilsimsa located at https://code.google.com/p/py-nilsimsa

This repository has been forked from beager/php-nilsimsa. It has been cleaned up and restructured so it can be used as a composer package.

@beager released this under the MIT license, (c) 2015 Bill Eager