(self, candidates: Iterable[dict], *, keep_dups=True)
return [cs.candidate for cs in candidates_scores]
Returns a list of matches.

        If ``keep_dups`` is False, allows for an arbitrary number of
        candidates but only returns the best two, or fewer.
Returns a list of matches.
Returns a list of matches .
def find_matches(self, candidates: Iterable[dict], *, keep_dups=True):
        """
        Returns a list of matches.

        If ``keep_dups`` is False, allows for an arbitrary number of
        candidates but only returns the best two, or fewer.
        """

        def top_two(list_):
            return sorted(list_, key=lambda l: l.score, reverse=True)[:2]

        candidates_scores = []
        for candidate in candidates:
            score = self.get_score(candidate)
            if score >= 1:
                candidates_scores.append(CandidateScore(candidate, score))
            if not keep_dups:
                candidates_scores = top_two(candidates_scores)

        if len(candidates_scores) > 1:
            best, second = top_two(candidates_scores)
            if best.score / second.score >= 1 + self.confidence_margin:
                return [best.candidate]
        return [cs.candidate for cs in candidates_scores]
def find_matches ( self , candidates : Iterable [ dict ] , * , keep_dups = True ) : def top_two ( list_ ) : return sorted ( list_ , key = lambda l : l . score , reverse = True ) [ : 2 ] candidates_scores = [ ] for candidate in candidates : score = self . get_score ( candidate ) if score >= 1 : candidates_scores . append ( CandidateScore ( candidate , score ) ) if not keep_dups : candidates_scores = top_two ( candidates_scores ) if len ( candidates_scores ) > 1 : best , second = top_two ( candidates_scores ) if best . score / second . score >= 1 + self . confidence_margin : return [ best . candidate ] return [ cs . candidate for cs in candidates_scores ]