Skip to content

extract should return all best scores #432

@mdziezyc

Description

@mdziezyc

Current:

>>> import rapidfuzz
>>> rapidfuzz.process.extract("aa", ["ab", "ba"], scorer=rapidfuzz.distance.Levenshtein.distance) 
[('ab', 1, 0), ('ba', 1, 1)]
>>> rapidfuzz.process.extract("aa", ["ab", "ba", "cc"], scorer=rapidfuzz.distance.Levenshtein.distance) 
[('ab', 1, 0), ('ba', 1, 1), ('cc', 2, 2)]
>>> rapidfuzz.process.extractOne("aa", ["ab", "ba", "cc"], scorer=rapidfuzz.distance.Levenshtein.distance) 
('ab', 1, 0)
>>> rapidfuzz.process.extract("aa", ["ab", "ba", "cc"], scorer=rapidfuzz.distance.Levenshtein.distance, limit=1) 
[('ab', 1, 0)]

Hypothetical/suggested:

>>> rapidfuzz.process.extract("aa", ["ab", "ba", "cc"], scorer=rapidfuzz.distance.Levenshtein.distance, limit="best") 
[('ab', 1, 0), ('ba', 1, 1)] # returns all with the lowest score

Together with #188 seems to me that it would be a killer option 🥇 to find all closest matches for the bulk queries lists.

Thanks for the great work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions