Closed Scrxtchy closed 6 months ago
Probably those do need a second look. Especially to make sure the documentation is the same as the type hint above.
I assume you are trying to use the Mapping version, which according to the type hint would be Mapping[Any, Sequence[Hashable] | None]
. However you are passing a Sequence[Mapping[...]]
instead.
What you could do is something like the following:
>>> items=[{"name": "test", "key": "test2"}]
>>> process.extract("Test",choices={item['key']: item['name'] for item in items},scorer=fuzz.WRatio ,limit=7)
[('test', 75.0, 'test2')]
https://github.com/rapidfuzz/RapidFuzz/blob/af9e1b76bea9c6f5dcfd7bf37f2ab571fef4d8f7/src/rapidfuzz/process_py.py#L77-L79
Is this still accurate? I've found that using a dict with
Will return a KeyError 0,
Trace
``` Traceback (most recent call last): File "but a tuple is what I should be using
Ref: https://github.com/rapidfuzz/RapidFuzz/blob/af9e1b76bea9c6f5dcfd7bf37f2ab571fef4d8f7/src/rapidfuzz/process_py.py#L142