Skip to content

Commit

Permalink
fix: parse origins (ingredient from origin) in German, Italian and Sp…
Browse files Browse the repository at this point in the history
…anish (#8938)
  • Loading branch information
stephanegigandet committed Sep 2, 2023
1 parent bda3567 commit 1c416ee
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/ProductOpener/Ingredients.pm
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,10 @@ my %of = (

my %from = (
en => " from ",
de => " aus ",
es => " de ",
fr => " de la | de | du | des | d'",
it => " dal | della | dalla | dagli | dall'",
pl => " z | ze ",
);

Expand Down
17 changes: 17 additions & 0 deletions tests/unit/match_ingredient_origin.t
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,23 @@ my @tests = (
}
],
},
{
desc => 'German ingredient aus origin',
lc => 'de',
text => 'Zucker aus Deutschland, Bio natives Olivenöl extra aus Spanien',
expected => [
{
'ingredient' => 'Zucker',
'matched_text' => 'Zucker aus Deutschland,',
'origins' => 'Deutschland'
},
{
'ingredient' => 'Bio natives Olivenöl extra',
'matched_text' => ' Bio natives Olivenöl extra aus Spanien',
'origins' => 'Spanien'
}
]
}
);

init_origins_regexps();
Expand Down

0 comments on commit 1c416ee

Please sign in to comment.