Skip to content

Commit

Permalink
ensure that gazetteMatching does not return empty blocks
Browse files Browse the repository at this point in the history
downstream code assumed that gazetteMatching returned non
empty blocks, this assumption did not hold. closes #850.
closes #841
  • Loading branch information
fgregg committed Sep 1, 2020
1 parent 5f1ca0a commit dd0c2e0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions dedupe/clustering.py
Expand Up @@ -286,10 +286,11 @@ def gazetteMatching(scored_blocks: Iterable[numpy.ndarray],
block.sort(order='score')
block = block[::-1]

if n_matches:
yield block[:n_matches].copy()
else:
yield block.copy()
if len(block):
if n_matches:
yield block[:n_matches].copy()
else:
yield block.copy()


def pair_gazette_matching(scored_pairs: numpy.ndarray,
Expand Down

0 comments on commit dd0c2e0

Please sign in to comment.