Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a key / mapping parameter for extract/extractOne in process #81

Open
micostabal opened this issue Feb 28, 2025 · 1 comment
Open

Comments

@micostabal
Copy link

I don't know if this already exists hereor somewhere else, but it would be cool If the extract methods could have an extra optional, None by default key parameter, just like the sorted function in python.

Imagine being able to extract most similar elements based on attributes or methods of an object for example:

`
class Sth:
a: str
b: int

def __init__(self, _a, _b):
    self.a=_a
    self.b=_b

process.extractOne(Sth('hi', 1), [Sth('bye', 2), Sth('hi!', 3)], key=lambda x: x.a)
`

@maxbachmann
Copy link
Contributor

you should be able to pass this as processor function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants