simhash-js
simhash-js copied to clipboard
the similarity is not expected
TEST 1: let a = 'the cat sat on the mat' let b = 'the cat sat on a mat' let h1 = simhash.hash(a) let h2 = simhash.hash(b) console.log(h1, h2, sjs.Comparator.similarity(h1, h2)) // ------------ result // 687990018 690349194 0.16666666666666666
TEST2: let a = 'the cat sat on the mat' let b = 'xxx xxxxxx xx xxx xxx' let h1 = simhash.hash(a) let h2 = simhash.hash(b) console.log(h1, h2, sjs.Comparator.similarity(h1, h2)) // -------------- result // 687990018 236331081 0.23529411764705882