return dict([x, getattr(self, x)] for x in self.__slots__)
def __setstate__(self, d):
for key in d:
setattr(self, key, d[key])
def jaccard(mhs):
"""
Compute Jaccard similarity measure for a list of MinHash objects.
"""
After Change
Python pickle.loads function.
"""
seed, num_perm = struct.unpack_from("qi", buffer, 0)
self.__init__(num_perm=num_perm, seed=seed)
offset = struct.calcsize("qi")
for i in range(num_perm):
self.hashvalues[i] = struct.unpack_from("I", buffer, offset)[0]
offset += struct.calcsize("I")