Skip to content

Commit b331440

Browse files
committed
Bugfix: When merging names, round confidence value consistently
1 parent b9af992 commit b331440

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ingredient_parser/en/postprocess.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,9 @@ def _convert_name_indices_to_object(
510510
# If we need to merge the previous name, do it now.
511511
ing_text = IngredientText(
512512
text=merge_with_next.text + " " + ing_text.text,
513-
confidence=(merge_with_next.confidence + ing_text.confidence) / 2,
513+
confidence=round(
514+
(merge_with_next.confidence + ing_text.confidence) / 2, 6
515+
),
514516
starting_index=min(
515517
[merge_with_next.starting_index, ing_text.starting_index]
516518
),

0 commit comments

Comments
 (0)