Skip to content

Commit 4472725

Browse files
committed
Revert "feat: add language code validation for ingredient parsing"
This reverts commit 01705a2.
1 parent 01705a2 commit 4472725

1 file changed

Lines changed: 0 additions & 15 deletions

File tree

robotoff/workers/tasks/import_image.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -882,15 +882,6 @@ def extract_ingredients_job(
882882
logger.info(imported)
883883

884884

885-
def is_valid_language_code(lang_id: str) -> bool:
886-
"""Check if the language code is a valid 2-letter ISO-639-1 code.
887-
888-
:param lang_id: The language code to validate
889-
:return: True if the language code is a valid 2-letter code, False otherwise
890-
"""
891-
return len(lang_id) == 2 and lang_id.isalpha()
892-
893-
894885
def generate_ingredient_prediction_data(
895886
ingredient_prediction_output: ingredient_list.IngredientPredictionOutput,
896887
image_width: int,
@@ -926,12 +917,6 @@ def generate_ingredient_prediction_data(
926917
# available
927918
if entity["lang"]:
928919
lang_id = entity["lang"]["lang"]
929-
# Skip if the language code is not a valid 2-letter code
930-
if not is_valid_language_code(lang_id):
931-
logger.warning(
932-
f"Skipping ingredient parsing for invalid language code: {lang_id}"
933-
)
934-
continue
935920
try:
936921
# Parse ingredients using Product Opener ingredient parser,
937922
# and add it to the entity data

0 commit comments

Comments
 (0)