MCPcopy Create free account
hub / github.com/BIT-DataLab/LakeBench / _query_b

Method _query_b

join/LSH/datasketch/lsh.py:301–316  ·  view source on GitHub ↗
(self, minhash, b)

Source from the content-addressed store, hash-verified

299
300 # 对第b个hashtable做冲突判断
301 def _query_b(self, minhash, b):
302 if len(minhash) != self.h:
303 raise ValueError("Expecting minhash with length %d, got %d"
304 % (self.h, len(minhash)))
305 if b > len(self.hashtables):
306 raise ValueError("b must be less or equal to the number of hash tables")
307 candidates = set()
308 for (start, end), hashtable in zip(self.hashranges[:b], self.hashtables[:b]):
309 H = self._H(minhash.hashvalues[start:end])
310 if H in hashtable:
311 for key in hashtable[H]:
312 candidates.add(key)
313 if self.prepickle:
314 return {pickle.loads(key) for key in candidates}
315 else:
316 return candidates
317
318 def get_counts(self):
319 '''

Callers 1

queryMethod · 0.80

Calls 1

addMethod · 0.45

Tested by

no test coverage detected