allow any object with items
This commit is contained in:
parent
2e29648ef4
commit
f0f8247d02
|
@ -10,7 +10,7 @@ def iterExtract(query: str, choices: Iterable, scorer: Callable = fuzz.WRatio, p
|
||||||
score_cutoff: float = 0) -> Generator[Tuple[str, float], None, None]:
|
score_cutoff: float = 0) -> Generator[Tuple[str, float], None, None]:
|
||||||
a = processor(query) if processor else query
|
a = processor(query) if processor else query
|
||||||
|
|
||||||
if isinstance(choices, dict):
|
if hasattr(choices, "items"):
|
||||||
for choice, match_choice in choices.items():
|
for choice, match_choice in choices.items():
|
||||||
b = processor(match_choice) if processor else match_choice
|
b = processor(match_choice) if processor else match_choice
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ def extractOne(query: str, choices: Iterable, scorer: Callable = fuzz.WRatio, pr
|
||||||
result_score = 0
|
result_score = 0
|
||||||
result_choice = ""
|
result_choice = ""
|
||||||
|
|
||||||
if isinstance(choices, dict):
|
if hasattr(choices, "items"):
|
||||||
choice_key = ""
|
choice_key = ""
|
||||||
for choice, match_choice in choices.items():
|
for choice, match_choice in choices.items():
|
||||||
b = processor(match_choice) if processor else match_choice
|
b = processor(match_choice) if processor else match_choice
|
||||||
|
|
Loading…
Reference in New Issue