Skip to content

Commit 8b66dd8

Browse files
committed
Bugfix: When selecting best match in FuzzyEmbeddingMatcher, ensure selected match meets score threshold so we don't select an entry from a preferred data type when there's a better one in a less preferred data type.
1 parent 7a556cd commit 8b66dd8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ingredient_parser/en/_foundationfoods.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ def _select_best_match(
511511
data_type_matches = [
512512
m for m in alternatives if m.fdc.data_type == data_type
513513
]
514-
if data_type_matches:
514+
if data_type_matches and data_type_matches[0].score <= 0.4:
515515
return data_type_matches[0]
516516

517517
return matches[0]

0 commit comments

Comments
 (0)