@biu/simhash
v0.1.1
Published
Javascript implementation for `simhash` algorithm which is widely used by Google for massive web pages
Downloads
11
Readme
simhash
Javascript implementation for simhash algorithm which is widely used by Google for massive web pages
Installation
npm i @biu/simhashUsage
const { simhash, similarity } = require( '@biu/simhash' )
const hash1 = simhash( [
{
text: '你',
weight: 1,
},
{
text: '好',
weight: 1,
},
{
text: '世界',
weight: 2,
}
] )
const hash2 = simhash( [
{
text: '你',
weight: 1,
},
{
text: '呀',
weight: 1,
},
{
text: '世界',
weight: 1,
}
] )
console.log( similarity( hash1, hash2 ) ) // -> 0.78125License
MIT
