Simhash algorithm:
The input to the Simhash algorithm is a vector, and the output is an F-bit signature value. For the sake of presentation, it is assumed that the input is a set of features of a document, each with a certain weight. For example, a feature can be a word in a document, and its weight can be the number of times the word appears. The Simhash algorithm is as follows:
1, an F-dimensional vector V is initialized to 0, and the F-bit binary number S is initialized to 0;
2, for each feature: using the traditional hash algorithm to generate an F-bit signature B for this feature. For I=1 to F: if the bit I of B is 1, then the element I of V is weighted with the feature, otherwise, the I element of V subtracts the weight of the feature.
3, if the first element of V is greater than 0, then the first bit of S is 1, otherwise 0;
4, output S as signature.
A simhash algorithm for the analysis of similar text documents